|
CLAW Library (a C++ Library Absolutely Wonderful) 1.5.5
|
This class write an image in a targa file. More...
#include <targa.hpp>
Classes | |
| class | file_output_buffer |
| The type of the output buffer associated with the file when encoding RLE data. More... | |
| class | rle_targa_encoder |
| RLE encoder for targa format. More... | |
Public Types | |
| typedef rle_targa_encoder < rgba_pixel_8 > | rle32_encoder |
| RLE encoder for 32 bpp targa images. | |
Public Member Functions | |
| writer (const image &img) | |
| Constructor. | |
| writer (const image &img, std::ostream &f, bool rle) | |
| Constructor. | |
| void | save (std::ostream &f, bool rle) const |
| Save the content of the image in a stream. | |
Private Member Functions | |
| void | save_true_color (std::ostream &os) const |
| Save the content of the image, without compression. | |
| void | save_rle_true_color (std::ostream &os) const |
| Save the content of the image, with RLE compression. | |
Private Attributes | |
| const image & | m_image |
| The image from which we read the data. | |
| claw::graphic::targa::writer::writer | ( | const image & | img | ) |
Constructor.
| img | The image to save. |
Definition at line 71 of file targa_writer.cpp.
: m_image(img) { } // targa::writer::writer()
| claw::graphic::targa::writer::writer | ( | const image & | img, |
| std::ostream & | f, | ||
| bool | rle | ||
| ) |
Constructor.
| img | The image to save. |
| f | The file in which we save the data. |
| rle | Tell if we must encode the data. |
Definition at line 85 of file targa_writer.cpp.
References claw::graphic::targa::save().
| void claw::graphic::targa::writer::save | ( | std::ostream & | os, |
| bool | rle | ||
| ) | const |
Save the content of the image in a stream.
| os | The stream in which we write. |
| rle | Tell if we must encode the data. |
Definition at line 97 of file targa_writer.cpp.
References claw::graphic::targa::file_structure::header::image_type.
{
header h( m_image.width(), m_image.height() );
if (rle)
h.image_type = rle_true_color;
else
h.image_type = true_color;
os.write( reinterpret_cast<char*>(&h), sizeof(header) );
if (rle)
save_rle_true_color(os);
else
save_true_color(os);
footer f;
os.write( reinterpret_cast<char*>(&f), sizeof(footer) );
} // targa::writer::save()
| void claw::graphic::targa::writer::save_rle_true_color | ( | std::ostream & | os | ) | const [private] |
Save the content of the image, with RLE compression.
| os | The stream in which we write. |
Definition at line 135 of file targa_writer.cpp.
References claw::rle_encoder< OutputBuffer >::encode().
{
rle32_encoder encoder;
rle32_encoder::output_buffer_type output_buffer(os);
for ( unsigned int y=0; y!=m_image.height(); ++y )
encoder.encode( m_image[y].begin(), m_image[y].end(), output_buffer );
} // targa::writer::save_rle_true_color()
| void claw::graphic::targa::writer::save_true_color | ( | std::ostream & | os | ) | const [private] |
Save the content of the image, without compression.
| os | The stream in which we write. |
Definition at line 122 of file targa_writer.cpp.
References claw::graphic::targa::writer::file_output_buffer< Pixel >::order_pixel_bytes().
{
file_output_buffer<rgba_pixel_8> output_buffer(os);
for (const_iterator it=m_image.begin(); it!=m_image.end(); ++it)
output_buffer.order_pixel_bytes(*it);
} // targa::writer::save_true_color()
const image& claw::graphic::targa::writer::m_image [private] |
1.7.3