Public Types | Public Member Functions | Static Public Member Functions

Celartem::DjVu::IW44Decoder Class Reference

#include <djv_iw44decoder.h>

Inheritance diagram for Celartem::DjVu::IW44Decoder:
Inheritance graph
[legend]

List of all members.

Public Types

enum  SliceCallbackResult { continueDecoding = 0, quitDecoding }
typedef SliceCallbackResult(* SliceCallback )(IW44Decoder *inIW44Decoder, size_t inChunkIndex, size_t inSlicesInChunk, size_t inBytesInChunk, void *inContext)

Public Member Functions

virtual bool decode (Stream *inStream)=0
virtual bool decode (const Chunk *inChunk)=0
virtual bool isNextIW44Data (Stream *inStream) const =0
virtual bool isNextIW44Data (const Chunk *inChunk) const =0
virtual bool isReadyToRender () const =0
virtual size_t getNumDecodedChunks () const =0
virtual size_t getWidth () const =0
virtual size_t getHeight () const =0
virtual bool isColorImage () const =0
virtual void render (u8 *outImagePtr, ssize_t inRowStride, Photometric inImagePm, size_t inSubsample=1, const Rect *inSubRect=NULL) const =0
virtual void render (u8 *outImagePtr, ssize_t inRowStride, Photometric inImagePm, const Rect &inRect, size_t inRescaledWidth=0, size_t inRescaledHeight=0, Rotation inRotation=rot0, bool inUseFastScaling=false) const =0

Static Public Member Functions

static AutoPtr< IW44Decodercreate (SliceCallback inSliceCallback=NULL, void *inSliceCallbackContext=NULL)

Detailed Description

This class decompresses color or grayscale images with the IW44 wavelet transformation and ZPCoder.


Member Typedef Documentation

typedef SliceCallbackResult(* Celartem::DjVu::IW44Decoder::SliceCallback)(IW44Decoder *inIW44Decoder, size_t inChunkIndex, size_t inSlicesInChunk, size_t inBytesInChunk, void *inContext)

Definition for the callback function which is called after decoding each slice.
The main purpose of the callback are to decide the end of decoding processes. You can optionally call render methods in this function to get the decoding image (which is not yet completely loaded).
Be sure that if you quit decoding in middle of a chunk, slices and chunks follows the chunk are simply discarded and you cannot restart the decoding from that point.

Parameters:
inIW44Decoder The instance of IW44Decoder.
inChunkIndex The index of the current chunk beeing decoded.
The index of the first chunk is 0.
inSlicesInChunk The number of slices already decoded in the current chunk.
At the first call to this function, this is 1.
inBytesInChunk The size of the data already decoded in the current chunk.
inContext Pointer to user defined context data.
Returns:
One of the SliceCallbackResult enumeration which decides whether decode process will continue or not.

Member Enumeration Documentation

This enumeration is used for the return values of SliceCallback callback functions.

Enumerator:
continueDecoding 

Continue decoding until the end of the chunk.

quitDecoding 

Quit decoding processes.


Member Function Documentation

static AutoPtr<IW44Decoder> Celartem::DjVu::IW44Decoder::create ( SliceCallback  inSliceCallback = NULL,
void *  inSliceCallbackContext = NULL 
) [static]

Create a new IW44Decoder instance that decodes the image from encoded data by IW44 encoders.

Parameters:
inSliceCallback The pointer to a callback function which will be called right after decoding each slice.
inSliceCallbackContext The pointer to a user defined context data. It is given to the callback specified as inSliceCallback.
Returns:
Pointer to the newly created IW44Decoder instance.
virtual bool Celartem::DjVu::IW44Decoder::decode ( Stream inStream  )  [pure virtual]

Decode the image from the stream.
You must feed the stream in the decoded order.
This method is for advanced purpose and you had better use decode(const Chunk*) in normal case.
Unlike other classes, this method is intended to be called repeatedly during decoding a IW44 encoded image.

Parameters:
inStream The stream to read from.
Returns:
Return false when a SliceCallback callback function is specified and it returns quitDecoding. After that, you cannot call decode to gain more quality for the resulting image.
virtual bool Celartem::DjVu::IW44Decoder::decode ( const Chunk inChunk  )  [pure virtual]

Decode the image in the chunk.
You must feed the chunk in the decoded (IFF chunk) order.
Unlike other classes, this method is intended to be called repeatedly during decoding a IW44 encoded image.

Parameters:
inChunk The chunk which contains **44 data.
Returns:
Return false when a SliceCallback callback function is specified and it returns quitDecoding. After that, you cannot call decode to gain more quality for the resulting image.
virtual size_t Celartem::DjVu::IW44Decoder::getHeight (  )  const [pure virtual]

Get the height of the resulting image.
Untill isReadyToRender returns true the result of this method is not valid.

Returns:
The height of the image in pixels.
virtual size_t Celartem::DjVu::IW44Decoder::getNumDecodedChunks (  )  const [pure virtual]

Get the number of IW44 chunks already decoded.
This is not the "number of slices" but the number of "chunks", which is actually same to the number of calls to decode methods.

Returns:
The number of decoded chunks.
virtual size_t Celartem::DjVu::IW44Decoder::getWidth (  )  const [pure virtual]

Get the width of the resulting image.
Untill isReadyToRender returns true, the result of this method is not valid.

Returns:
The width of the image in pixels.
virtual bool Celartem::DjVu::IW44Decoder::isColorImage (  )  const [pure virtual]

Determine whether the resulting image is color or grayscale.
Untill isReadyToRender returns true the result of this method is not valid.

Returns:
true if the image is color, otherwise false.
virtual bool Celartem::DjVu::IW44Decoder::isNextIW44Data ( const Chunk inChunk  )  const [pure virtual]

Determine whether the specified chunk contains the next IW44 data, which should be processed by decode method.

Parameters:
inChunk The chunk which contains **44 data.
Returns:
Return true if the chunk contains the next data.
virtual bool Celartem::DjVu::IW44Decoder::isNextIW44Data ( Stream inStream  )  const [pure virtual]

Determine whether the specified stream contains the next IW44 data, which should be processed by decode method.

Parameters:
inStream The stream to read from.
Returns:
Return true if the stream contains the next data.
virtual bool Celartem::DjVu::IW44Decoder::isReadyToRender (  )  const [pure virtual]

Determine whether the encoder instance is ready to render image.
This method returns true after the first call of decode method or even in the first time of SliceCallback callback function is called. Otherwise this method return false.

virtual void Celartem::DjVu::IW44Decoder::render ( u8 outImagePtr,
ssize_t  inRowStride,
Photometric  inImagePm,
size_t  inSubsample = 1,
const Rect inSubRect = NULL 
) const [pure virtual]

Render the resulting image onto the specified buffer. You may get incomplete rendered result if some of **44 chunks are not loaded.

Parameters:
outImagePtr The pointer to the first line of the buffer.
inRowStride The row-stride for the image on the buffer.
inImagePm The photometric of destination image. You can specify any of the Photometric enumeration values even if it does not match to the one of the original image.
inSubsample The subsampling ratio. It must be one of the values between 1 to 32. The default is 1, which means the original scale.
inSubRect The pointer to the Rect instance that indicates the portion to be extracted in pixels of the subsampled image. If it is NULL, this method returns whole the image.
virtual void Celartem::DjVu::IW44Decoder::render ( u8 outImagePtr,
ssize_t  inRowStride,
Photometric  inImagePm,
const Rect inRect,
size_t  inRescaledWidth = 0,
size_t  inRescaledHeight = 0,
Rotation  inRotation = rot0,
bool  inUseFastScaling = false 
) const [pure virtual]

Render the resulting image onto the specified buffer. You may get incomplete rendered result if some of **44 chunks are not loaded.

Parameters:
outImagePtr The pointer to the first line of the buffer.
inRowStride The row-stride for the image on the buffer.
inImagePm The photometric of destination image. You can specify any of the Photometric enumeration values even if it does not match to the one of the original image.
inRect Rectangle to draw in the rescaled image coordination.
inRescaledWidth The virtual width of the rescaled page image.
This method renders page image as if it had this width. If 0 is specified, the rendered image is same size to the original page size.
inRescaledHeight The virtual height of the rescaled page image.
This method renders page image as if it had this height. If 0 is specified, the rendered image is same size to the original page size.
inRotation The rotation of the image.
inUseFastScaling Determine whether to use faster scaling or not.
The default is not to use faster scaling.

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

This document is made with doxygen 1.7.1 at Thu Feb 17 2011 15:40:20.
Caminova Logo