claw::graphic::bitmap::reader::rle_bitmap_decoder< OutputBuffer > Class Template Reference

RLE decoder for bitmap RLE format. More...

Inheritance diagram for claw::graphic::bitmap::reader::rle_bitmap_decoder< OutputBuffer >:
claw::rle_decoder< char, file_input_buffer, OutputBuffer >

List of all members.

Public Types

typedef OutputBuffer output_buffer_type
 Type of the output buffer.

Private Member Functions

virtual void read_mode (file_input_buffer &input, output_buffer_type &output)
 Get the type of the following data in the input buffer, eventually apply the special codes.

Detailed Description

template<typename OutputBuffer>
class claw::graphic::bitmap::reader::rle_bitmap_decoder< OutputBuffer >

RLE decoder for bitmap RLE format.

Template parameters :

The OutputBuffer type must match the type requirements of the template parameter OutputBuffer of the rle_decoder class, plus two methods :

Author:
Julien Jorge

Definition at line 196 of file bitmap.hpp.


Member Typedef Documentation

template<typename OutputBuffer >
typedef OutputBuffer claw::graphic::bitmap::reader::rle_bitmap_decoder< OutputBuffer >::output_buffer_type

Type of the output buffer.

Reimplemented from claw::rle_decoder< char, file_input_buffer, OutputBuffer >.

Definition at line 201 of file bitmap.hpp.


Member Function Documentation

template<typename OutputBuffer >
void claw::graphic::bitmap::reader::rle_bitmap_decoder< OutputBuffer >::read_mode ( file_input_buffer input,
output_buffer_type output 
) [inline, private, virtual]

Get the type of the following data in the input buffer, eventually apply the special codes.

Parameters:
input The input stream (the bitmap file).
output The output stream (the bitmap image).

Definition at line 94 of file bitmap_reader.tpp.

References claw::buffered_istream< Stream >::get_next(), claw::buffered_istream< Stream >::read_more(), and claw::buffered_istream< Stream >::remaining().

00095 {
00096   this->m_mode = this->stop;
00097   bool ok = true;
00098 
00099   if ( input.remaining() < 2)
00100     ok = input.read_more(2);
00101 
00102   if (ok)
00103     {
00104       unsigned char key, pattern;
00105       
00106       key = input.get_next();
00107       pattern = input.get_next();
00108       
00109       // compressed data, next byte is the pattern
00110       if (key > 0)
00111         {
00112           this->m_mode = this->compressed;
00113           this->m_count = key;
00114           this->m_pattern = pattern;
00115         }
00116       else switch( pattern )
00117         {
00118           // end of line
00119         case 0 : output.next_line(); read_mode(input, output); break;
00120           // end of file
00121         case 1 : this->m_mode = this->stop; break;
00122           // delta move
00123         case 2 :
00124           {
00125             if ( input.remaining() < 1 )
00126               ok = input.read_more(1);
00127 
00128             if (ok)
00129               {
00130                 unsigned char x, y;
00131                 x = pattern;
00132                 y = input.get_next();
00133                 output.delta_move(x, y);
00134                 read_mode(input, output);
00135                 break;
00136               }
00137           }
00138           // raw data
00139         default: this->m_mode = this->raw; this->m_count = pattern; break;
00140         }
00141     }
00142 } // bitmap::reader::rle_bitmap_decoder::read_mode()


The documentation for this class was generated from the following files:

Generated on 9 Nov 2009 for CLAW Library (a C++ Library Absolutely Wonderful) by  doxygen 1.6.1