30 #ifndef __CLAW_JPEG_HPP__ 31 #define __CLAW_JPEG_HPP__ 65 struct jpeg_error_mgr
pub;
100 struct jpeg_source_mgr
pub;
104 std::istream& m_input;
107 const JOCTET* m_buffer;
110 const unsigned int m_buffer_size;
113 unsigned int m_stream_size;
116 unsigned int m_stream_position;
135 class grayscale_to_pixel32
145 void load( std::istream& f );
148 template<
class Convert>
149 void read_data( jpeg_decompress_struct& cinfo,
150 const Convert& pixel_convert );
152 void read_from_file( std::istream& f );
153 void decompress( std::istream& f, jpeg_decompress_struct& cinfo );
155 void create_decompress_info( jpeg_decompress_struct& cinfo,
156 source_manager& infile )
const;
178 options(
unsigned char compression_quality_,
bool progressive_ );
207 struct jpeg_destination_mgr
pub;
211 std::ostream& m_output;
217 const unsigned int m_buffer_size;
229 void set_options( jpeg_compress_struct& cinfo,
231 void save_image( jpeg_compress_struct& cinfo )
const;
233 void copy_pixel_line( JSAMPLE* data,
unsigned int y )
const;
235 void create_compress_info( jpeg_compress_struct& cinfo,
240 const image& m_image;
244 static const unsigned int s_rgb_pixel_size;
249 jpeg(
unsigned int w,
unsigned int h );
251 jpeg( std::istream& f );
253 void save( std::ostream& os,
260 #include <claw/impl/jpeg_reader.tpp> 262 #endif // __CLAW_JPEG_HPP__ unsigned char quality
Quality level to use in the saved stream.
void term()
Write the last pending bytes in the file.
void load(std::istream &f)
Load an image from a jpeg file.
boolean fill_input_buffer()
Fill the input buffer with new data.
source_manager(std::istream &is)
Constructor.
jpeg(unsigned int w, unsigned int h)
Constructor. Creates an empty image.
struct jpeg_error_mgr pub
"public" fields, needed by the jpeg library.
~destination_manager()
Destructor.
void flush()
Write the content of the buffer in the file.
std::string error_string
A comprehensive description of the error.
struct jpeg_destination_mgr pub
"public" fields, needed by the jpeg library.
Destination manager that allow us to write in a std::ostream.
writer(const image &img)
Constructor.
bool progressive
Tell if we save a progressive jpeg.
jmp_buf setjmp_buffer
For return to caller.
void save(std::ostream &os, const writer::options &opt=writer::options()) const
Save the image.
This class write an image in a jpeg file.
This class read data from a jpeg file and store it in an image.
options()
Default constructor.
struct jpeg_source_mgr pub
"public" fields, needed by the jpeg library.
destination_manager(std::ostream &os)
Constructor.
Error handler that throw an exception instead of exiting the program.
Parameters of the writing algorithm.
Source manager that allow us to read from a std::istream.
A class for jpeg pictures.
A class to deal with images.
void save(std::ostream &f, const options &opt=options()) const
Save an image in a jpeg file.
~source_manager()
Destructor.
This is the main namespace.
reader(image &img)
Constructor.
void skip_input_data(long num_bytes)
Skip some bytes in the input buffer.
A class to deal with images.