30 #ifndef __CLAW_TARGA_HPP__ 31 #define __CLAW_TARGA_HPP__ 68 rle_black_and_white = 11
80 header(
unsigned int w,
unsigned int h);
119 unsigned char alpha()
const;
169 static const std::string s_signature;
197 typedef color_palette<rgba_pixel_8> color_palette32;
215 template <
typename Pixel>
223 file_input_buffer(std::istream& f);
235 template <
typename Pixel>
260 template <
typename InputBuffer>
261 class rle_targa_output_buffer
268 typedef InputBuffer input_buffer_type;
271 rle_targa_output_buffer(
image& img,
bool up_down,
bool left_right);
274 void copy(
unsigned int n, input_buffer_type& buffer);
276 bool completed()
const;
279 void adjust_position(
int x);
311 template <
typename InputBuffer,
312 typename OutputBuffer
313 = rle_targa_output_buffer<InputBuffer> >
314 class rle_targa_decoder
315 :
public rle_decoder<rgba_pixel_8, InputBuffer, OutputBuffer>
319 typedef InputBuffer input_buffer_type;
322 typedef OutputBuffer output_buffer_type;
325 virtual void read_mode(input_buffer_type& input,
326 output_buffer_type& output);
331 typedef rle_targa_decoder<file_input_buffer<rgba_pixel_8> >
335 typedef rle_targa_decoder<file_input_buffer<rgb_pixel_8> >
339 typedef rle_targa_decoder<file_input_buffer<pixel16> > rle16_decoder;
342 typedef rle_targa_decoder<mapped_file_input_buffer<pixel8> >
349 void load(std::istream& f);
352 void check_if_targa(std::istream& f)
const;
354 void load_palette(
const header& h, std::istream& f,
357 void load_color_mapped(
const header& h, std::istream& f);
358 void load_rle_color_mapped(
const header& h, std::istream& f);
359 void load_true_color(
const header& h, std::istream& f);
360 void load_rle_true_color(
const header& h, std::istream& f);
362 template <
typename Pixel>
363 void load_color_mapped_raw(
const header& h, std::istream& f,
366 template <
typename Decoder>
367 void decompress_rle_color_mapped(
const header& h, std::istream& f,
370 template <
typename Pixel>
371 void load_true_color_raw(
const header& h, std::istream& f);
373 template <
typename Decoder>
374 void decompress_rle_true_color(
const header& h, std::istream& f);
376 template <
typename Pixel>
377 void load_palette_content(std::istream& f,
400 template <
typename Pixel>
414 template <
typename Iterator>
415 void raw(Iterator
first, Iterator last);
417 unsigned int min_interesting()
const;
418 unsigned int max_encodable()
const;
429 std::ostream& m_stream;
441 template <
typename Pixel>
456 writer(
const image& img, std::ostream& f,
bool rle);
458 void save(std::ostream& f,
bool rle)
const;
461 void save_true_color(std::ostream& os)
const;
462 void save_rle_true_color(std::ostream& os)
const;
466 const image& m_image;
471 targa(
unsigned int w,
unsigned int h);
473 targa(std::istream& f);
475 void save(std::ostream& os,
bool rle)
const;
481 #include <claw/graphic/targa_reader.tpp> 482 #include <claw/graphic/targa_writer.tpp> 484 #endif // __CLAW_TARGA_HPP__ reader(image &img)
Constructor.
void save(std::ostream &os, bool rle) const
Save the content of the image in a stream.
A class for targa pictures.
rgba_pixel pixel_type
The type representing the colors of the pixels in the image.
void save(std::ostream &f, bool rle) const
Save the content of the image in a stream.
unsigned short tag
Item identifier.
unsigned int size
Fielf size.
file_output_buffer< Pixel > output_buffer_type
Type of the output buffer.
This class read data from a targa file and store it in an image.
rle_targa_encoder< rgba_pixel_8 > rle32_encoder
RLE encoder for 32 bpp targa images.
void load(std::istream &f)
Load an image from a targa file.
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.
RLE encoder for targa format.
Fuction object to get the first element of a std::pair.
Item in the developper directory.
This class is made to help reading istreams with a buffer.
A class to help decoding run-length encoded (RLE) streams.
A class to help run-length encoding (RLE) streams.
A palette of colors, for palettized images.
void order_pixel_bytes(const pixel_type &p)
Write a pixel in the stream and set its value in the good order.
A class to help decoding run-length encoded (RLE) streams.
unsigned int offset
Offset in the file.
pixel_type pattern_type
The type of the patterns to encode.
targa(unsigned int w, unsigned int h)
Constructor. Creates an empty image.
This class is made to help reading istreams with a buffer.
writer(const image &img)
Constructor.
Pixel pixel_type
The type of the pixels in the input buffer.
A class to deal with images.
A class to help run-length encoding (RLE) streams.
This class write an image in a targa file.
This is the main namespace.
The type of the output buffer associated with the file when encoding RLE data.
A class to deal with images.