30#ifndef __CLAW_PCX_HPP__
31#define __CLAW_PCX_HPP__
63 v_2_8_with_palette = 2,
64 v_2_8_without_palette = 3,
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;
147 typedef std::vector<u_int_8> color_plane_type;
167 class rle_pcx_output_buffer
170 rle_pcx_output_buffer(color_plane_type& result);
173 void copy(
unsigned int n, rle_pcx_input_buffer& buffer);
175 bool completed()
const;
179 color_plane_type& m_result;
182 unsigned int m_position;
189 class rle_pcx_decoder
190 :
public rle_decoder<u_int_8, rle_pcx_input_buffer,
191 rle_pcx_output_buffer>
206 void operator()(
const std::vector<color_plane_type>&
scanline,
207 image& img,
unsigned int y)
const;
217 converter_16(
const header& h);
218 void operator()(
const std::vector<color_plane_type>&
scanline,
219 image& img,
unsigned int y)
const;
223 const header& m_header;
234 converter_256(
const color_palette32& palette);
235 void operator()(
const std::vector<color_plane_type>&
scanline,
236 image& img,
unsigned int y)
const;
240 const color_palette32& m_palette;
248 class converter_true_color
251 void operator()(
const std::vector<color_plane_type>&
scanline,
252 image& img,
unsigned int y)
const;
260 void load(std::istream& f);
263 void check_if_pcx(
const header& h)
const;
265 void load_mono(
const header& h, std::istream& f);
266 void load_16_color_mapped(
const header& h, std::istream& f);
267 void load_true_color(
const header& h, std::istream& f);
268 void load_256_color_mapped(
const header& h, std::istream& f);
270 void decompress_line(std::istream& f,
273 template <
typename Converter>
274 void decompress(
const header& h, std::istream& f,
275 const Converter& convert);
304 template <
typename Iterator>
305 void raw(Iterator
first, Iterator last);
312 std::ostream& m_stream;
326 void save(std::ostream& os)
const;
329 void write_header(std::ostream& os,
unsigned int bytes_per_line)
const;
330 void save_rle_true_color(std::ostream& os,
331 unsigned int bytes_per_line)
const;
335 const image& m_image;
340 pcx(
unsigned int w,
unsigned int h);
342 pcx(std::istream& f);
344 void save(std::ostream& os)
const;
350#include <claw/graphic/pcx_reader.tpp>
351#include <claw/graphic/pcx_writer.tpp>
This class is made to help reading istreams with a buffer.
This class is made to help reading istreams with a buffer.
Fuction object to get the first element of a std::pair.
A palette of colors, for palettized images.
void fill(const math::rectangle< int > r, const pixel_type &c)
Fill an area of the image with a given color.
image()
Constructor. Creates an image without datas.
void load(std::istream &f)
Load an image from a pcx file.
reader(image &img)
Constructor.
unsigned int max_encodable() const
Get the maximum number of pixel a code can encode.
void encode(unsigned int n, pattern_type pattern)
Encode a pixel data.
unsigned int min_interesting() const
Get the minimum number of pixels needed for encoding.
file_output_buffer(std::ostream &os)
Constructor.
u_int_8 pattern_type
The typ of the output patterns.
void save(std::ostream &os) const
Save the content of the image in a stream.
writer(const image &img)
Constructor.
rle_encoder< file_output_buffer > rle_pcx_encoder
RLE encoder for pcx format.
pcx(unsigned int w, unsigned int h)
Constructor. Creates an empty image.
void save(std::ostream &os) const
Save the content of the image in a stream.
A class to help decoding run-length encoded (RLE) streams.
rle_pcx_output_buffer output_buffer_type
rle_pcx_input_buffer input_buffer_type
A class to help run-length encoding (RLE) streams.
A palette of color, for palettized images.
A class to deal with images.
Everything about image structures and processing.
rgb_pixel rgb_pixel_8
A color with 8 bits per component.
Here are the design patterns.
This is the main namespace.
A class to help decoding run-length encoded (RLE) streams.
A class to help run-length encoding (RLE) streams.
find_type_by_size< Size, signed_integers >::type type
The integer type that matches the given size.
find_type_by_size< Size, unsigned_integers >::type type
The integer type that matches the given size.
Some classes for the raw manipulation of the base types.