30 #ifndef __CLAW_PCX_HPP__
31 #define __CLAW_PCX_HPP__
62 v_2_8_with_palette = 2,
63 v_2_8_without_palette = 3,
68 # pragma pack (push,1)
106 u_int_16 horizontal_dpi;
109 u_int_16 vertical_dpi;
118 u_int_8 color_planes;
122 u_int_16 bytes_per_line;
125 u_int_16 palette_info;
149 typedef std::vector<u_int_8> color_plane_type;
172 class rle_pcx_output_buffer
175 rle_pcx_output_buffer( color_plane_type& result );
177 void fill(
unsigned int n, u_int_8 pattern );
180 bool completed()
const;
184 color_plane_type& m_result;
187 unsigned int m_position;
195 class rle_pcx_decoder
197 rle_pcx_input_buffer,
198 rle_pcx_output_buffer >
202 read_mode( input_buffer_type& input, output_buffer_type& output );
216 unsigned int y )
const;
227 converter_16(
const header& h );
230 unsigned int y )
const;
234 const header& m_header;
249 unsigned int y )
const;
262 class converter_true_color
267 unsigned int y )
const;
275 void load( std::istream& f );
278 void check_if_pcx(
const header& h )
const;
280 void load_mono(
const header& h, std::istream& f );
281 void load_16_color_mapped(
const header& h, std::istream& f );
282 void load_true_color(
const header& h, std::istream& f );
283 void load_256_color_mapped(
const header& h, std::istream& f );
286 decompress_line( std::istream& f, color_plane_type&
scanline )
const;
288 template<
typename Converter>
290 (
const header& h, std::istream& f,
const Converter& convert );
321 template<
typename Iterator>
322 void raw( Iterator
first, Iterator last );
329 std::ostream& m_stream;
344 void save( std::ostream& os )
const;
348 ( std::ostream& os,
unsigned int bytes_per_line )
const;
349 void save_rle_true_color
350 ( std::ostream& os,
unsigned int bytes_per_line )
const;
354 const image& m_image;
359 pcx(
unsigned int w,
unsigned int h );
361 pcx( std::istream& f );
363 void save( std::ostream& os )
const;
372 #endif // __CLAW_PCX_HPP__
pcx(unsigned int w, unsigned int h)
Constructor. Creates an empty image.
This class read data from a pcx file and store it in an image.
writer(const image &img)
Constructor.
Define the type of an unsigned integer stored with a given number of bits. Template parameters...
A class for pcx pictures.
file_output_buffer(std::ostream &os)
Constructor.
find_type_by_size< Size, signed_integers >::type type
The integer type that matches the given size.
unsigned int min_interesting() const
Get the minimum number of pixels needed for encoding.
reader(image &img)
Constructor.
Some classes for the raw manipulation of the base types.
u_int_8 pattern_type
The typ of the output patterns.
A palette of color, for palettized images.
void fill(const math::rectangle< int > r, const pixel_type &c)
Fill an area of the image with a given color.
The type of the output buffer associated with the file when encoding RLE data.
Fuction object to get the first element of a std::pair.
A class to help decoding run-length encoded (RLE) streams.
This class write an image in a pcx file.
void save(std::ostream &os) const
Save the content of the image in a stream.
A class to help run-length encoding (RLE) streams.
A palette of colors, for palettized images.
Implementation of the template methods of the pcx::writer class.
A class to help decoding run-length encoded (RLE) streams.
void raw(Iterator first, Iterator last)
Write raw data int the stream.
This class is made to help reading istreams with a buffer.
void encode(unsigned int n, pattern_type pattern)
Encode a pixel data.
rle_encoder< file_output_buffer > rle_pcx_encoder
RLE encoder for pcx format.
Implementation of the template methods of the pcx::reader class.
void save(std::ostream &os) const
Save the content of the image in a stream.
unsigned int max_encodable() const
Get the maximum number of pixel a code can encode.
A class to deal with images.
void load(std::istream &f)
Load an image from a pcx file.
A class to help run-length encoding (RLE) streams.
A class to deal with images.