VideoTools
|
An encapsulation of image type, including width, height and number of channels, with support for a string form that encodes the same information. More...
#include <grimagetype.h>
Classes | |
struct | String |
A small-string class used for stringised Gr::ImageType instances. More... | |
Public Member Functions | |
ImageType () | |
Default constructor for an in-valid() image type with dimensions of zero. More... | |
ImageType (std::istream &) | |
Constructor that examines the image data to determine its type. More... | |
ImageType (const std::vector< char > &) | |
Constructor that examines the image data to determine its type. More... | |
ImageType (const ImageBuffer &) | |
Constructor overload for ImageBuffer. | |
ImageType (const char *p, size_t n) | |
Constructor overload for a char buffer. | |
ImageType (const unsigned char *p, size_t n) | |
Constructor overload for an unsigned char buffer. | |
ImageType (const std::string &) | |
Constructor taking a stringised image type that includes image size information. More... | |
bool | valid () const |
Returns true if valid. | |
bool | matches (const std::string &str) const |
Returns true if this type matches the given type (including size decorations). | |
std::string | str () const |
Returns the image type string (including the size parameter). | |
String & | set (String &out) const |
Returns str() by reference. | |
std::string | simple () const |
Returns the basic image type string, excluding the size parameter. | |
bool | isRaw () const |
Returns true if a raw image type. | |
bool | isJpeg () const |
Returns true if a jpeg image type. | |
bool | isPng () const |
Returns true if a png image type. | |
bool | isPnm () const |
Returns true if a pnm image type. | |
int | dx () const |
Returns the image width. | |
int | dy () const |
Returns the image height. | |
int | channels () const |
Returns the number of channels. | |
size_t | size () const |
Returns the product of dx, dy and channels. More... | |
size_t | rowsize () const |
Returns the product of dx and channels. More... | |
bool | operator== (const ImageType &) const |
Comparison operator. | |
bool | operator!= (const ImageType &) const |
Comparison operator. | |
bool | operator< (const ImageType &) const |
Comparison operator. | |
void | streamOut (std::ostream &) const |
Used by op<<(). | |
Static Public Member Functions | |
static ImageType | jpeg (int dx, int dy, int channels=3) |
Factory function for a jpeg image type. | |
static ImageType | jpeg (ImageType, int scale=1, bool monochrome_out=false) |
Factory function for a jpeg image type with the same dimensions as the given image type, optionally scaled. More... | |
static ImageType | png (int dx, int dy, int channels=3) |
Factory function for a png image type. | |
static ImageType | png (ImageType, int scale=1, bool monochrome_out=false) |
Factory function for a png image type with the same dimensions as the given image type, optionally scaled. More... | |
static ImageType | raw (int dx, int dy, int channels) |
Factory function for a raw image type. | |
static ImageType | raw (ImageType, int scale=1, bool monochrome_out=false) |
Factory function for a raw image type with the same dimensions as the given image type, optionally scaled. More... | |
An encapsulation of image type, including width, height and number of channels, with support for a string form that encodes the same information.
The string format is like "image/png;xsize=640x480x3" where the last of the three numbers is the number of channels (1 or 3), and the image type is "x.raw", "jpeg", "png" or "x-portable-anymap".
Definition at line 43 of file grimagetype.h.
Gr::ImageType::ImageType | ( | ) |
Default constructor for an in-valid() image type with dimensions of zero.
Definition at line 91 of file grimagetype.cpp.
|
explicit |
Constructor that examines the image data to determine its type.
The stream position is not advanced. Throws if the stream is not seekable.
Definition at line 99 of file grimagetype.cpp.
|
explicit |
Constructor that examines the image data to determine its type.
The image data should be for the complete image, not just the first section (because jpeg).
Definition at line 110 of file grimagetype.cpp.
|
explicit |
Constructor taking a stringised image type that includes image size information.
Definition at line 157 of file grimagetype.cpp.
|
static |
Factory function for a jpeg image type with the same dimensions as the given image type, optionally scaled.
Definition at line 318 of file grimagetype.cpp.
|
static |
Factory function for a png image type with the same dimensions as the given image type, optionally scaled.
Definition at line 338 of file grimagetype.cpp.
|
static |
Factory function for a raw image type with the same dimensions as the given image type, optionally scaled.
Definition at line 328 of file grimagetype.cpp.
size_t Gr::ImageType::rowsize | ( | ) | const |
Returns the product of dx and channels.
This is usually only meaningful for raw types.
Definition at line 289 of file grimagetype.cpp.
size_t Gr::ImageType::size | ( | ) | const |
Returns the product of dx, dy and channels.
This is usually only meaningful for raw types.
Definition at line 284 of file grimagetype.cpp.