Go to the documentation of this file.
30 #ifndef __CLAW_TARGA_HPP__
31 #define __CLAW_TARGA_HPP__
67 rle_black_and_white = 11
70 # pragma pack (push,1)
80 header(
unsigned int w,
unsigned int h );
119 unsigned char alpha()
const;
174 static const std::string s_signature;
207 typedef color_palette<rgba_pixel_8> color_palette32;
227 template<
typename Pixel>
235 file_input_buffer( std::istream& f );
248 template<
typename Pixel>
249 class mapped_file_input_buffer:
275 template<
typename InputBuffer >
276 class rle_targa_output_buffer
283 typedef InputBuffer input_buffer_type;
286 rle_targa_output_buffer(
image& img,
bool up_down,
bool left_right );
289 void copy(
unsigned int n, input_buffer_type& buffer );
291 bool completed()
const;
294 void adjust_position(
int x);
327 template<
typename InputBuffer,
328 typename OutputBuffer = rle_targa_output_buffer<InputBuffer> >
329 class rle_targa_decoder
330 :
public rle_decoder< rgba_pixel_8, InputBuffer, OutputBuffer >
334 typedef InputBuffer input_buffer_type;
337 typedef OutputBuffer output_buffer_type;
341 read_mode( input_buffer_type& input, output_buffer_type& output );
348 rle_targa_decoder< file_input_buffer<rgba_pixel_8> > rle32_decoder;
353 rle_targa_decoder< file_input_buffer<rgb_pixel_8> > rle24_decoder;
357 typedef rle_targa_decoder< file_input_buffer<pixel16> > rle16_decoder;
361 typedef rle_targa_decoder< mapped_file_input_buffer<pixel8> >
368 void load( std::istream& f );
371 void check_if_targa( std::istream& f )
const;
376 void load_color_mapped(
const header& h, std::istream& f );
377 void load_rle_color_mapped(
const header& h, std::istream& f );
378 void load_true_color(
const header& h, std::istream& f );
379 void load_rle_true_color(
const header& h, std::istream& f );
381 template<
typename Pixel>
382 void load_color_mapped_raw
385 template<
typename Decoder>
386 void decompress_rle_color_mapped
389 template<
typename Pixel>
390 void load_true_color_raw(
const header& h, std::istream& f );
392 template<
typename Decoder>
393 void decompress_rle_true_color(
const header& h, std::istream& f );
395 template<
typename Pixel>
397 load_palette_content( std::istream& f,
color_palette32& palette )
const;
421 template<
typename Pixel>
435 template<
typename Iterator>
436 void raw( Iterator
first, Iterator last );
438 unsigned int min_interesting()
const;
439 unsigned int max_encodable()
const;
450 std::ostream& m_stream;
463 template<
typename Pixel>
479 writer(
const image& img, std::ostream& f,
bool rle );
481 void save( std::ostream& f,
bool rle )
const;
484 void save_true_color( std::ostream& os )
const;
485 void save_rle_true_color( std::ostream& os )
const;
489 const image& m_image;
494 targa(
unsigned int w,
unsigned int h );
496 targa( std::istream& f );
498 void save( std::ostream& os,
bool rle )
const;
504 #include <claw/impl/targa_writer.tpp>
505 #include <claw/impl/targa_reader.tpp>
507 #endif // __CLAW_TARGA_HPP__
void order_pixel_bytes(const pixel_type &p)
Write a pixel in the stream and set its value in the good order.
Pixel pixel_type
The type of the pixels in the input buffer.
A class to help decoding run-length encoded (RLE) streams.
A class to help run-length encoding (RLE) streams.
unsigned int offset
Offset in the file.
void save(std::ostream &os, bool rle) const
Save the content of the image in a stream.
This class write an image in a targa file.
reader(image &img)
Constructor.
Fuction object to get the first element of a std::pair.
file_output_buffer< Pixel > output_buffer_type
Type of the output buffer.
rle_targa_encoder< rgba_pixel_8 > rle32_encoder
RLE encoder for 32 bpp targa images.
This is the main namespace.
void save(std::ostream &f, bool rle) const
Save the content of the image in a stream.
This class is made to help reading istreams with a buffer.
This class read data from a targa file and store it in an image.
void load(std::istream &f)
Load an image from a targa file.
pixel_type pattern_type
The type of the patterns to encode.
A palette of colors, for palettized images.
Item in the developper directory.
A palette of color, for palettized images.
RLE encoder for targa format.
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.
A class to deal with images.
A class to help decoding run-length encoded (RLE) streams.
targa(unsigned int w, unsigned int h)
Constructor. Creates an empty image.
A class to deal with images.
A class for targa pictures.
rgba_pixel pixel_type
The type representing the colors of the pixels in the image.
writer(const image &img)
Constructor.
A class to help run-length encoding (RLE) streams.
unsigned short tag
Item identifier.
unsigned int size
Fielf size.
This class is made to help reading istreams with a buffer.