A class to help decoding run-length encoded (RLE) streams. More...
#include <rle_decoder.hpp>
Public Types | |
typedef Pattern | pattern_type |
The type of the patterns we will read in the input buffer. | |
typedef InputBuffer | input_buffer_type |
The type of the input buffer. | |
typedef OutputBuffer | output_buffer_type |
The type of the output buffer. | |
Public Member Functions | |
rle_decoder () | |
Constructor. | |
virtual | ~rle_decoder () |
Destructor. | |
void | decode (input_buffer_type &input, output_buffer_type &output) |
Decode a RLE stream. | |
Protected Types | |
enum | mode { stop, raw, compressed } |
State of the decompression. More... | |
Protected Member Functions | |
virtual void | read_mode (input_buffer_type &input, output_buffer_type &output)=0 |
Protected Attributes | |
mode | m_mode |
Current mode of the decompression. | |
unsigned int | m_count |
Case of m_mode :
| |
pattern_type | m_pattern |
The pattern to repeat. |
A class to help decoding run-length encoded (RLE) streams.
Template parameters :
The Pattern and InputBuffer parameters don't have any type requirement.
The OutputBuffer type must have the following methods :
Definition at line 54 of file rle_decoder.hpp.
typedef InputBuffer claw::rle_decoder< Pattern, InputBuffer, OutputBuffer >::input_buffer_type |
The type of the input buffer.
Reimplemented in claw::graphic::targa::reader::rle_targa_decoder< InputBuffer, OutputBuffer >.
Definition at line 61 of file rle_decoder.hpp.
typedef OutputBuffer claw::rle_decoder< Pattern, InputBuffer, OutputBuffer >::output_buffer_type |
The type of the output buffer.
Reimplemented in claw::graphic::bitmap::reader::rle_bitmap_decoder< OutputBuffer >, and claw::graphic::targa::reader::rle_targa_decoder< InputBuffer, OutputBuffer >.
Definition at line 64 of file rle_decoder.hpp.
typedef Pattern claw::rle_decoder< Pattern, InputBuffer, OutputBuffer >::pattern_type |
The type of the patterns we will read in the input buffer.
Definition at line 58 of file rle_decoder.hpp.
enum claw::rle_decoder::mode [protected] |
State of the decompression.
stop |
Stop the decoding. |
raw |
Next bytes represent raw data. |
compressed |
Next bytes represent compressed data. |
Definition at line 70 of file rle_decoder.hpp.
00071 { 00073 stop, 00074 00076 raw, 00077 00079 compressed 00080 }; // enum mode
claw::rle_decoder< Pattern, InputBuffer, OutputBuffer >::rle_decoder | ( | ) | [inline] |
Constructor.
Definition at line 36 of file rle_decoder.tpp.
claw::rle_decoder< Pattern, InputBuffer, OutputBuffer >::~rle_decoder | ( | ) | [inline, virtual] |
Destructor.
Definition at line 47 of file rle_decoder.tpp.
void claw::rle_decoder< Pattern, InputBuffer, OutputBuffer >::decode | ( | input_buffer_type & | input, | |
output_buffer_type & | output | |||
) | [inline] |
Decode a RLE stream.
input | The RLE stream. | |
output | The raw stream. |
Definition at line 60 of file rle_decoder.tpp.
Referenced by claw::graphic::pcx::reader::decompress_line(), claw::graphic::bitmap::reader::load_4bpp_rle(), and claw::graphic::bitmap::reader::load_8bpp_rle().
00061 { 00062 m_mode = stop; 00063 read_mode(input, output); 00064 00065 while( m_mode != stop ) 00066 { 00067 if ( m_mode == compressed ) 00068 output.fill( m_count, m_pattern ); 00069 else 00070 output.copy( m_count, input ); 00071 00072 read_mode(input, output); 00073 } 00074 } // rle_decoder::decode()
virtual void claw::rle_decoder< Pattern, InputBuffer, OutputBuffer >::read_mode | ( | input_buffer_type & | input, | |
output_buffer_type & | output | |||
) | [protected, pure virtual] |
unsigned int claw::rle_decoder< Pattern, InputBuffer, OutputBuffer >::m_count [protected] |
Case of m_mode :
Definition at line 101 of file rle_decoder.hpp.
mode claw::rle_decoder< Pattern, InputBuffer, OutputBuffer >::m_mode [protected] |
Current mode of the decompression.
Definition at line 94 of file rle_decoder.hpp.
pattern_type claw::rle_decoder< Pattern, InputBuffer, OutputBuffer >::m_pattern [protected] |
The pattern to repeat.
Definition at line 104 of file rle_decoder.hpp.