48 explicit PnmInfo( std::istream & ) ;
51 explicit PnmInfo(
const std::vector<char> & ) ;
60 PnmInfo(
const char * ,
size_t ) ;
63 PnmInfo(
const unsigned char * ,
size_t ) ;
113 G_EXCEPTION( Error ,
"pnm image format error" ) ;
115 explicit PnmReader(
int scale = 1 ,
bool monochrome_out =
false ) ;
118 void setup(
int scale ,
bool monochrome_out =
false ) ;
139 static bool readBody( std::istream & ,
const PnmInfo & ,
ImageData & ,
int ,
bool ) ;
144 bool m_monochrome_out ;
bool valid() const
Returns true if successfully constructed.
int dx() const
Returns the image width.
A holder for image data, having eight bits per sample and one or three channels.
PnmReader(int scale=1, bool monochrome_out=false)
Constructor.
int maxval() const
Returns the maximum value, or zero for bitmap formats (p1/p4).
int pn() const
Returns the p-number.
Vectors ImageBuffer
An ImageBuffer is used to hold raw image data, typically in more than one chunk.
int dy() const
Returns the image height.
bool binary() const
Returns true if a binary format.
void decode(ImageData &out, const G::Path &in)
Decodes a pnm file into an image. Throws on error.
int channels() const
Returns the number of channels.
bool binary8() const
Returns true if an eight-bit binary format, ie. P5 or P6.
void setup(int scale, bool monochrome_out=false)
Sets the decoding scale factor.
A structure holding portable-anymap metadata.
PnmInfo()
Default constructor for an invalid structure.
A static interface for reading portable-anymap (pnm) files.
const PnmInfo & info() const
Returns the pnm header info, ignoring scaling.
A Path object represents a file system path.
size_t rowsize() const
Returns dx() * channels().
size_t offset() const
Returns the size of the header.