54 G_EXCEPTION( Error ,
"jpeg error" ) ;
66 JpegInfo(
const unsigned char * p ,
size_t ) ;
71 JpegInfo(
const char * p ,
size_t ) ;
74 explicit JpegInfo( std::istream & ) ;
105 typedef Jpeg::Error Error ;
107 JpegReader(
int scale = 1 ,
bool monochrome_out =
false ) ;
113 void setup(
int scale ,
bool monochrome_out =
false ) ;
125 void decode(
ImageData & out ,
const unsigned char * p_in ,
size_t n ) ;
136 unique_ptr<JpegReaderImp> m_imp ;
138 bool m_monochrome_out ;
147 explicit JpegWriter(
int scale = 1 ,
bool monochrome_out =
false ) ;
153 void setup(
int scale ,
bool monochrome_out =
false ) ;
171 unique_ptr<JpegWriterImp> m_imp ;
int dx() const
Returns the image width.
A holder for image data, having eight bits per sample and one or three channels.
void encode(const ImageData &in, const G::Path &path_out)
Encodes to a file.
A private pimple class for Gr::JpegWriter.
unsigned char jpeg_byte
Equivalent to libjpeg JSAMPLE. A static-assert checks the size.
int dy() const
Returns the image height.
Vectors ImageBuffer
An ImageBuffer is used to hold raw image data, typically in more than one chunk.
void setup(int scale, bool monochrome_out=false)
Sets the decoding scale factor.
A scoping class for other jpeg classes.
static bool available()
Returns true if a jpeg library is available.
A private implementation class for Gr::JpegReader.
int channels() const
Returns the number of channels (eg. 3).
bool valid() const
Returns true if constructed successfully.
A read interface for libjpeg.
void decode(ImageData &out, const G::Path &in)
Decodes a jpeg file into an image. Throws on error.
A write interface for libjpeg.
Provides some basic information about a jpeg image without full decoding.
JpegReader(int scale=1, bool monochrome_out=false)
Constructor.
void setup(int scale, bool monochrome_out=false)
Sets the encoding scale factor.
JpegWriter(int scale=1, bool monochrome_out=false)
Constructor.
A Path object represents a file system path.
JpegInfo(const unsigned char *p, size_t)
Constructor.