kviewshell
MMRDecoder Class Reference
Class for G4/MMR decoding. More...
#include <MMRDecoder.h>
Public Member Functions | |
const unsigned char * | scanrle (const bool invert, const unsigned char **endptr=0) |
const unsigned short * | scanruns (const unsigned short **endptr=0) |
~MMRDecoder () | |
Static Public Member Functions | |
static GP< MMRDecoder > | create (GP< ByteStream > gbs, const int width, const int height, const bool striped=false) |
static GP< JB2Image > | decode (GP< ByteStream > gbs) |
static bool | decode_header (ByteStream &inp, int &width, int &height, int &invert) |
Protected Member Functions | |
void | init (GP< ByteStream > gbs, const bool striped=false) |
MMRDecoder (const int width, const int height) |
Detailed Description
Class for G4/MMR decoding.The simplest way to use this class is the static member function {MMRDecoder::decode}. This function internally creates an instance of MMRDecoder# which processes the MMR data scanline by scanline.
Definition at line 151 of file MMRDecoder.h.
Constructor & Destructor Documentation
MMRDecoder::MMRDecoder | ( | const int | width, | |
const int | height | |||
) | [protected] |
Definition at line 538 of file MMRDecoder.cpp.
MMRDecoder::~MMRDecoder | ( | ) |
Member Function Documentation
GP< MMRDecoder > MMRDecoder::create | ( | GP< ByteStream > | gbs, | |
const int | width, | |||
const int | height, | |||
const bool | striped = false | |||
) | [static] |
Create a MMRDecoder object for decoding an image of size width# by height#.
Flag $striped# must be set if the image is composed of multiple stripes.
Definition at line 561 of file MMRDecoder.cpp.
GP< JB2Image > MMRDecoder::decode | ( | GP< ByteStream > | gbs | ) | [static] |
Main decoding routine that (a) decodes the header using decode_header#, (b) decodes the MMR data using an instance of MMRDecoder#, and returns a new {JB2Image} composed of tiles whose maximal width and height is derived from the size of the image.
Definition at line 874 of file MMRDecoder.cpp.
bool MMRDecoder::decode_header | ( | ByteStream & | inp, | |
int & | width, | |||
int & | height, | |||
int & | invert | |||
) | [static] |
void MMRDecoder::init | ( | GP< ByteStream > | gbs, | |
const bool | striped = false | |||
) | [protected] |
Definition at line 551 of file MMRDecoder.cpp.
const unsigned char * MMRDecoder::scanrle | ( | const bool | invert, | |
const unsigned char ** | endptr = 0 | |||
) |
Decodes a scanline and returns a pointer to RLE encoded data.
The buffer contains the length of the runs for the current line encoded as described in {PNM and RLE file formats}.) The flag invert# can be used to indicate that the MMR data is encoded in reverse video. The RLE data is followed by two zero bytes. The position of these two zeroes is stored in the pointer specified by the optional argument endptr#. The buffer data should be processed before calling this function again. This is implemented by calling {MMRDecoder::scanruns}.
Definition at line 793 of file MMRDecoder.cpp.
const unsigned short * MMRDecoder::scanruns | ( | const unsigned short ** | endptr = 0 |
) |
Decodes a scanline and returns a pointer to an array of run lengths.
The returned buffer contains the length of alternative white and black runs. These run lengths sum to the image width. They are followed by two zeroes. The position of these two zeroes is stored in the pointer specified by the optional argument endptr#. The buffer data should be processed before calling this function again.
Definition at line 571 of file MMRDecoder.cpp.
The documentation for this class was generated from the following files: