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 );
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;
507 #endif // __CLAW_TARGA_HPP__