CLAW Library (a C++ Library Absolutely Wonderful) 1.5.5
Public Types | Private Member Functions
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 
) [private, virtual]

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

Parameters:
inputThe input stream (the bitmap file).
outputThe 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().

{
  this->m_mode = this->stop;
  bool ok = true;

  if ( input.remaining() < 2)
    ok = input.read_more(2);

  if (ok)
    {
      unsigned char key, pattern;
      
      key = input.get_next();
      pattern = input.get_next();
      
      // compressed data, next byte is the pattern
      if (key > 0)
        {
          this->m_mode = this->compressed;
          this->m_count = key;
          this->m_pattern = pattern;
        }
      else switch( pattern )
        {
          // end of line
        case 0 : output.next_line(); read_mode(input, output); break;
          // end of file
        case 1 : this->m_mode = this->stop; break;
          // delta move
        case 2 :
          {
            if ( input.remaining() < 1 )
              ok = input.read_more(1);

            if (ok)
              {
                unsigned char x, y;
                x = pattern;
                y = input.get_next();
                output.delta_move(x, y);
                read_mode(input, output);
                break;
              }
          }
          // raw data
        default: this->m_mode = this->raw; this->m_count = pattern; break;
        }
    }
} // bitmap::reader::rle_bitmap_decoder::read_mode()

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