52 m_stream << p.components.blue << p.components.green << p.components.red
53 << p.components.alpha;
89 header h(m_image.width(), m_image.height());
96 os.write(
reinterpret_cast<char*
>(&h),
sizeof(
header));
99 save_rle_true_color(os);
104 os.write(
reinterpret_cast<char*
>(&f),
sizeof(
footer));
111void claw::graphic::targa::writer::save_true_color(std::ostream& os)
const
113 file_output_buffer<rgba_pixel_8> output_buffer(os);
115 for(
const_iterator it = m_image.begin(); it != m_image.end(); ++it)
116 output_buffer.order_pixel_bytes(*it);
123void claw::graphic::targa::writer::save_rle_true_color(std::ostream& os)
const
125 rle32_encoder encoder;
126 rle32_encoder::output_buffer_type output_buffer(os);
128 for(
unsigned int y = 0; y != m_image.height(); ++y)
129 encoder.encode(m_image[y].begin(), m_image[y].end(), output_buffer);
image()
Constructor. Creates an image without datas.
base_iterator< const image, const pixel_type > const_iterator
The type of the iterator to access constant pixels.
The type of the output buffer associated with the file when encoding RLE data.
Pixel pixel_type
The type of the pixels in the input buffer.
void order_pixel_bytes(const pixel_type &p)
Write a pixel in the stream and set its value in the good order.
void save(std::ostream &f, bool rle) const
Save the content of the image in a stream.
writer(const image &img)
Constructor.
A simple class to use as exception with string message.
Everything about image structures and processing.
rgba_pixel rgba_pixel_8
A color with 8 bits per component and an alpha channel.
This is the main namespace.
A class for targa pictures.