The output buffer for the RLE decoder. More...
Public Member Functions | |
rle_targa_output_buffer (image &img, bool up_down, bool left_right) | |
Constructor. | |
void | fill (unsigned int n, rgba_pixel_8 pattern) |
Copy a pixel a certain number of times. | |
void | copy (unsigned int n, input_buffer_type &buffer) |
Direct copy of a certain number of pixels from the file. | |
bool | completed () const |
Tell if we have completely filled the image. | |
Private Types | |
typedef rgba_pixel_8 | pixel_type |
The type of he pixels in the input buffer. | |
typedef InputBuffer | input_buffer_type |
The type of the input buffer. | |
Private Member Functions | |
void | adjust_position (int x) |
Recalculate the position in the file. | |
Private Attributes | |
image & | m_image |
The targa image to fill. | |
unsigned int | m_x |
Current column index in the image. | |
unsigned int | m_y |
Current row index in the image. | |
const int | m_x_inc |
Horizontal increment. | |
const int | m_y_inc |
Vertical increment. |
The output buffer for the RLE decoder.
Template parameters
Definition at line 273 of file targa.hpp.
typedef InputBuffer claw::graphic::targa::reader::rle_targa_output_buffer< InputBuffer >::input_buffer_type [private] |
typedef rgba_pixel_8 claw::graphic::targa::reader::rle_targa_output_buffer< InputBuffer >::pixel_type [private] |
claw::graphic::targa::reader::rle_targa_output_buffer< InputBuffer >::rle_targa_output_buffer | ( | image & | img, | |
bool | up_down, | |||
bool | left_right | |||
) | [inline] |
Constructor.
img | The targa image we're loading. | |
up_down | Tell if the image is stored from top to bottom. | |
left_right | Tell if the image is stored from left to right. |
Definition at line 87 of file targa_reader.tpp.
References claw::graphic::image::height(), claw::graphic::targa::reader::rle_targa_output_buffer< InputBuffer >::m_image, claw::graphic::targa::reader::rle_targa_output_buffer< InputBuffer >::m_x, claw::graphic::targa::reader::rle_targa_output_buffer< InputBuffer >::m_y, and claw::graphic::image::width().
00088 : m_image(img), m_x_inc(left_right ? 1 : -1), m_y_inc(up_down ? 1 : -1) 00089 { 00090 if (up_down) 00091 m_y = 0; 00092 else 00093 m_y = m_image.height() - 1; 00094 00095 if (left_right) 00096 m_x = 0; 00097 else 00098 m_x = m_image.width() - 1; 00099 } // targa::reader::rle_targa_output_buffer::rle_targa_output_buffer()
void claw::graphic::targa::reader::rle_targa_output_buffer< InputBuffer >::adjust_position | ( | int | x | ) | [inline, private] |
Recalculate the position in the file.
x | The x-coordinate where we stopped. |
If x is lower tha zero, the position is set at the end of the previous line ; if is greater or equal to the width of the image, the position is set at the begining of the next line ; otherwise the position is set to x.
Definition at line 168 of file targa_reader.tpp.
References claw::graphic::targa::reader::rle_targa_output_buffer< InputBuffer >::m_image, claw::graphic::targa::reader::rle_targa_output_buffer< InputBuffer >::m_x, claw::graphic::targa::reader::rle_targa_output_buffer< InputBuffer >::m_y, claw::graphic::targa::reader::rle_targa_output_buffer< InputBuffer >::m_y_inc, and claw::graphic::image::width().
bool claw::graphic::targa::reader::rle_targa_output_buffer< InputBuffer >::completed | ( | ) | const [inline] |
Tell if we have completely filled the image.
Definition at line 151 of file targa_reader.tpp.
References claw::graphic::image::height(), claw::graphic::targa::reader::rle_targa_output_buffer< InputBuffer >::m_image, and claw::graphic::targa::reader::rle_targa_output_buffer< InputBuffer >::m_y.
void claw::graphic::targa::reader::rle_targa_output_buffer< InputBuffer >::copy | ( | unsigned int | n, | |
input_buffer_type & | buffer | |||
) | [inline] |
Direct copy of a certain number of pixels from the file.
n | The number of pixels to write. | |
buffer | The buffer from which we read. |
Definition at line 131 of file targa_reader.tpp.
References claw::graphic::targa::reader::m_image, and claw::graphic::image::width().
00132 { 00133 assert( (int)(m_x + m_x_inc * n) >= -1 ); 00134 assert( m_x + m_x_inc * n <= m_image.width() ); 00135 00136 const int bound = (int)m_x + m_x_inc * n; 00137 int x = m_x; 00138 00139 for ( ; x != bound; x += m_x_inc ) 00140 m_image[m_y][x] = buffer.get_pixel(); 00141 00142 adjust_position(x); 00143 } // targa::reader::rle_targa_output_buffer::copy()
void claw::graphic::targa::reader::rle_targa_output_buffer< InputBuffer >::fill | ( | unsigned int | n, | |
rgba_pixel_8 | pattern | |||
) | [inline] |
Copy a pixel a certain number of times.
n | The number of pixel to write. | |
pattern | The pixel to copy. |
Definition at line 109 of file targa_reader.tpp.
References claw::graphic::targa::reader::m_image, and claw::graphic::image::width().
00110 { 00111 assert( (int)(m_x + m_x_inc * n) >= -1 ); 00112 assert( m_x + m_x_inc * n <= m_image.width() ); 00113 00114 const int bound = (int)m_x + m_x_inc * n; 00115 int x = m_x; 00116 00117 for ( ; x != bound; x += m_x_inc ) 00118 m_image[m_y][x] = pattern; 00119 00120 adjust_position(x); 00121 } // targa::reader::rle_targa_output_buffer::fill()
image& claw::graphic::targa::reader::rle_targa_output_buffer< InputBuffer >::m_image [private] |
Definition at line 295 of file targa.hpp.
Referenced by claw::graphic::targa::reader::rle_targa_output_buffer< InputBuffer >::adjust_position(), claw::graphic::targa::reader::rle_targa_output_buffer< InputBuffer >::completed(), and claw::graphic::targa::reader::rle_targa_output_buffer< InputBuffer >::rle_targa_output_buffer().
unsigned int claw::graphic::targa::reader::rle_targa_output_buffer< InputBuffer >::m_x [private] |
Current column index in the image.
Definition at line 298 of file targa.hpp.
Referenced by claw::graphic::targa::reader::rle_targa_output_buffer< InputBuffer >::adjust_position(), and claw::graphic::targa::reader::rle_targa_output_buffer< InputBuffer >::rle_targa_output_buffer().
const int claw::graphic::targa::reader::rle_targa_output_buffer< InputBuffer >::m_x_inc [private] |
unsigned int claw::graphic::targa::reader::rle_targa_output_buffer< InputBuffer >::m_y [private] |
Current row index in the image.
Definition at line 301 of file targa.hpp.
Referenced by claw::graphic::targa::reader::rle_targa_output_buffer< InputBuffer >::adjust_position(), claw::graphic::targa::reader::rle_targa_output_buffer< InputBuffer >::completed(), and claw::graphic::targa::reader::rle_targa_output_buffer< InputBuffer >::rle_targa_output_buffer().
const int claw::graphic::targa::reader::rle_targa_output_buffer< InputBuffer >::m_y_inc [private] |
Vertical increment.
Definition at line 307 of file targa.hpp.
Referenced by claw::graphic::targa::reader::rle_targa_output_buffer< InputBuffer >::adjust_position().