#include <targa.hpp>
Template parameters
Definition at line 417 of file targa.hpp.
Public Types | |
| typedef Pixel | pixel_type |
| The type of the pixels in the input buffer. | |
| typedef pixel_type | pattern_type |
Public Member Functions | |
| file_output_buffer (std::ostream &os) | |
| Constructor. | |
| void | encode (unsigned int n, pattern_type pattern) |
| Code a pixel. | |
| template<typename Iterator> | |
| void | raw (Iterator first, Iterator last) |
| Write raw data int the stream. | |
| unsigned int | min_interesting () const |
| Get the minimum number of pixels needed for encoding. | |
| unsigned int | max_encodable () const |
| Get the maximum number of pixel a code can encode. | |
| void | order_pixel_bytes (const pixel_type &p) |
| template<> | |
| void | order_pixel_bytes (const pixel_type &p) |
Private Attributes | |
| std::ostream & | m_stream |
| The stream in which we write. | |
| typedef Pixel claw::graphic::targa::writer::file_output_buffer< Pixel >::pixel_type |
| typedef pixel_type claw::graphic::targa::writer::file_output_buffer< Pixel >::pattern_type |
| claw::graphic::targa::writer::file_output_buffer< Pixel >::file_output_buffer | ( | std::ostream & | os | ) | [inline] |
Constructor.
| os | The |
Definition at line 47 of file targa_writer.tpp.
00048 : m_stream(os) 00049 { 00050 00051 } // targa::writer::file_output_buffer::file_output_buffer()
| void claw::graphic::targa::writer::file_output_buffer< Pixel >::encode | ( | unsigned int | n, | |
| pattern_type | pattern | |||
| ) | [inline] |
Code a pixel.
| n | The number of time the pixel appears. | |
| pattern | The value of the pixel. |
Definition at line 61 of file targa_writer.tpp.
00062 { 00063 assert( n <= max_encodable() ); 00064 assert( n >= min_interesting() ); 00065 00066 unsigned char key = (n-1) | 0x80; 00067 00068 m_stream << key; 00069 order_pixel_bytes( pattern ); 00070 } // targa::writer::file_output_buffer::encode()
| void claw::graphic::targa::writer::file_output_buffer< Pixel >::raw | ( | Iterator | first, | |
| Iterator | last | |||
| ) | [inline] |
Write raw data int the stream.
Definition at line 81 of file targa_writer.tpp.
00082 { 00083 unsigned int n = std::distance(first, last); 00084 00085 unsigned int full = n / max_encodable(); 00086 unsigned int remaining = n % max_encodable(); 00087 00088 unsigned char key = max_encodable() - 1; 00089 00090 for (unsigned int i=0; i!=full; ++i) 00091 { 00092 m_stream << key; 00093 00094 for (unsigned int j=0; j!=max_encodable(); ++j, ++first) 00095 order_pixel_bytes( *first ); 00096 } 00097 00098 if (remaining) 00099 { 00100 key = remaining - 1; 00101 m_stream << key; 00102 00103 for (unsigned int j=0; j!=remaining; ++j, ++first) 00104 order_pixel_bytes( *first ); 00105 } 00106 00107 } // targa::writer::file_output_buffer::raw()
| unsigned int claw::graphic::targa::writer::file_output_buffer< Pixel >::min_interesting | ( | ) | const [inline] |
Get the minimum number of pixels needed for encoding.
Definition at line 115 of file targa_writer.tpp.
| unsigned int claw::graphic::targa::writer::file_output_buffer< Pixel >::max_encodable | ( | ) | const [inline] |
| void claw::graphic::targa::writer::file_output_buffer< Pixel >::order_pixel_bytes | ( | const pixel_type & | p | ) |
Referenced by claw::graphic::targa::writer::save_true_color().
| void claw::graphic::targa::writer::file_output_buffer< claw::graphic::pixel32 >::order_pixel_bytes | ( | const pixel_type & | p | ) | [inline] |
Definition at line 52 of file targa_writer.cpp.
References claw::graphic::pixel32::alpha, claw::graphic::pixel32::blue, claw::graphic::pixel32::components, claw::graphic::pixel32::green, claw::graphic::targa::writer::file_output_buffer< Pixel >::m_stream, and claw::graphic::pixel32::red.
00053 { 00054 m_stream << p.components.blue << p.components.green 00055 << p.components.red << p.components.alpha; 00056 } // targa::writer::file_output_buffer::order_pixel_bytes()
std::ostream& claw::graphic::targa::writer::file_output_buffer< Pixel >::m_stream [private] |
The stream in which we write.
Definition at line 439 of file targa.hpp.
Referenced by claw::graphic::targa::writer::file_output_buffer< Pixel >::order_pixel_bytes().
1.5.5