|
CLAW Library (a C++ Library Absolutely Wonderful) 1.5.5
|
Buffer passed to the LZW decoder to write decoded data. More...
Public Member Functions | |
| output_buffer (const palette_type &p, const image_descriptor &id, int transparent_color_index, image &output) | |
| Constructor. | |
| void | write (unsigned int code) |
| Write a data. | |
Private Attributes | |
| const palette_type & | m_palette |
| The palette from whick we take the colors of the image. | |
| const image_descriptor & | m_id |
| The image descriptor of the frame. | |
| const int | m_transparent_color_index |
| The index of the transparent color. -1 if none. | |
| image & | m_output |
| The image in which we save the decoded data. | |
| std::size_t | m_x |
| The x-position of the next pixel in the image. | |
| std::size_t | m_y |
| The y-position of the next pixel in the image. | |
| int | m_interlace_pass |
| Current pass in an interlaced image [0-3]. | |
| int | m_interlace_step |
| Increment in the current pass of an interlaced image. | |
| claw::graphic::gif::reader::output_buffer::output_buffer | ( | const palette_type & | p, |
| const image_descriptor & | id, | ||
| int | transparent_color_index, | ||
| image & | output | ||
| ) |
Constructor.
| p | The palette from which we take the color. |
| id | The descriptor of the frame. |
| transparent_color_index | The index of the transparent color in p. |
| output | The image in which we store the data. |
Definition at line 212 of file gif_reader.cpp.
: m_palette(p), m_id(id), m_transparent_color_index(transparent_color_index), m_output(output), m_x(0), m_y(0), m_interlace_pass(0), m_interlace_step(8) { } // gif::reader::output_buffer::output_buffer()
| void claw::graphic::gif::reader::output_buffer::write | ( | unsigned int | code | ) |
Write a data.
| code | The data to write. |
Definition at line 226 of file gif_reader.cpp.
{
assert(code < m_palette.size());
assert(m_x < m_id.width);
assert(m_y < m_id.height);
m_output[m_y + m_id.top][m_x + m_id.left] = m_palette[code];
if ( m_transparent_color_index != -1 )
if ( code == (unsigned int)m_transparent_color_index )
m_output[m_y + m_id.top][m_x + m_id.left].components.alpha = 0;
++m_x;
if (m_x == m_id.width)
{
m_x = 0;
if ( !m_id.is_interlaced() )
++m_y;
else
{
m_y += m_interlace_step;
while ( (m_y >= m_id.height) && (m_interlace_pass!=3) )
{
++m_interlace_pass;
switch (m_interlace_pass)
{
case 1: m_y = 4; m_interlace_step = 8; break;
case 2: m_y = 2; m_interlace_step = 4; break;
case 3: m_y = 1; m_interlace_step = 2; break;
}
}
}
}
} // gif::reader::output_buffer::write()
const image_descriptor& claw::graphic::gif::reader::output_buffer::m_id [private] |
const palette_type& claw::graphic::gif::reader::output_buffer::m_palette [private] |
const int claw::graphic::gif::reader::output_buffer::m_transparent_color_index [private] |
std::size_t claw::graphic::gif::reader::output_buffer::m_x [private] |
std::size_t claw::graphic::gif::reader::output_buffer::m_y [private] |
1.7.3