Public Types | Public Member Functions | Static Public Member Functions

Celartem::DjVu::JB2Page Class Reference

#include <djv_jb2decoder.h>

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

List of all members.

Public Types

typedef SimpleArray< AutoPtr
< JB2Page > > 
Array

Public Member Functions

virtual void addFGbz (Stream *inFGbz)=0
virtual void addFGbz (const Chunk *inFGbz)=0
virtual size_t getWidth () const =0
virtual size_t getHeight () const =0
virtual bool hasPalette () const =0
virtual bool isPaletteIsBlackOnly () const =0
virtual void render (u8 *ioImagePtr, ssize_t inRowStride, Photometric inPm, const Rect &inRect, size_t inRescaledWidth, size_t inRescaledHeight, const u8 *inFg, ssize_t inFgRowStride, size_t inFgWidth, size_t inFgHeight, bool inNeedAlphaChannel, bool inUseFastRescaling=false) const =0
virtual void render (u8 *outImagePtr, ssize_t inRowStride, Photometric inPm, const Rect &inRect, size_t inRescaledWidth, size_t inRescaledHeight, bool inNeedAlphaChannel, bool inUseFastRescaling=false) const =0
virtual void encodeSjbz (Stream *inSjbz) const =0
virtual AutoPtr< ChunkencodeSjbzChunk () const =0
virtual void encodeFGbz (Stream *inFGbz) const =0
virtual AutoPtr< ChunkencodeFGbzChunk () const =0
virtual bool generatePalette (size_t inMaxPaletteSize, const u8 *CEL_RESTRICT inImage=NULL, ssize_t inImageRowStride=NULL, Photometric inImagePm=pmRGB8, size_t inWidth=0, size_t inHeight=0)=0
virtual Shape::ArraygetShapes ()=0
virtual const Shape::ArraygetShapes () const =0
virtual bool isEmpty () const =0
virtual JB2DictionarygetDictionary ()=0
virtual const JB2DictionarygetDictionary () const =0
virtual void setDictionary (JB2Dictionary *inDict)=0
virtual void compact ()=0
virtual void setSjbzProgressiveDecoding (bool inProgressive)=0
virtual size_t decodeSjbzProgressively (size_t inNumRecords)=0
virtual bool isSjbzDecodeCompleted () const =0
virtual void setRenderingShapeRange (size_t inBegin, size_t inEnd)=0
virtual void clearRenderingShapeRange ()=0

Static Public Member Functions

static AutoPtr< JB2Pagecreate (Stream *inSjbz, JB2Dictionary *inDict=NULL)
static AutoPtr< JB2Pagecreate (const Chunk *inSjbz, JB2Dictionary *inDict=NULL)
static AutoPtr< JB2Pagecreate (size_t inWidth, size_t inHeight, JB2Dictionary *inDict=NULL)

Detailed Description

This class defines JB2 Page class.
This class manages the JB2 shapes in a page. It may have a link to the shared dictionary.

See also:
JB2Dictionary

Member Typedef Documentation

Definition for easy access.


Member Function Documentation

virtual void Celartem::DjVu::JB2Page::addFGbz ( Stream inFGbz  )  [pure virtual]

Set FGbz (palette) to this page.

Parameters:
inFGbz A stream which contains the FGbz chunk.
virtual void Celartem::DjVu::JB2Page::addFGbz ( const Chunk inFGbz  )  [pure virtual]

Set FGbz (palette) to this page.

Parameters:
inFGbz Pointer to the FGbz chunk.
virtual void Celartem::DjVu::JB2Page::clearRenderingShapeRange (  )  [pure virtual]

Clear the range of rendering shapes.

virtual void Celartem::DjVu::JB2Page::compact (  )  [pure virtual]

Minimize the memory usage.

Implements Celartem::DjVu::JB2ShapeStore.

static AutoPtr<JB2Page> Celartem::DjVu::JB2Page::create ( const Chunk inSjbz,
JB2Dictionary inDict = NULL 
) [static]

Create a new JB2Page instance from the specified chunk.

Parameters:
inSjbz Pointer to the Sjbz chunk.
inDict Optional pointer to the JB2Dictionary instance.
It can be NULL if there's no dictionary.
static AutoPtr<JB2Page> Celartem::DjVu::JB2Page::create ( Stream inSjbz,
JB2Dictionary inDict = NULL 
) [static]

Create a new JB2Page instance from the specified stream.

Parameters:
inSjbz A stream which contains the Sjbz chunk.
inDict Optional pointer to the JB2Dictionary instance.
It can be NULL if there's no dictionary.
static AutoPtr<JB2Page> Celartem::DjVu::JB2Page::create ( size_t  inWidth,
size_t  inHeight,
JB2Dictionary inDict = NULL 
) [static]

Create a n empty JB2Page instance.

Parameters:
inWidth The width of the page in pixels.
inHeight The height of the page in pixels.
inDict Optional pointer to the JB2Dictionary instance.
It can be NULL if there's no dictionary.
virtual size_t Celartem::DjVu::JB2Page::decodeSjbzProgressively ( size_t  inNumRecords  )  [pure virtual]

Decode Sjbz chunk partially.

Parameters:
inNumRecords The number of records to be decoded on this call.
It can be larger than the actual number of records in the Sjbz chunk; ultimately, set it to SIZE_MAX to decode all the records at once.
Returns:
The number of total shapes decoded so far.
virtual void Celartem::DjVu::JB2Page::encodeFGbz ( Stream inFGbz  )  const [pure virtual]

Encode the current palette as FGbz and write out to the specified stream.

Parameters:
inFGbz A stream to write to.
virtual AutoPtr<Chunk> Celartem::DjVu::JB2Page::encodeFGbzChunk (  )  const [pure virtual]

Encode the current palette as FGbz.

Returns:
A newly created FGbz chunk, which contains the encoding result.
virtual void Celartem::DjVu::JB2Page::encodeSjbz ( Stream inSjbz  )  const [pure virtual]

Encode the current page as Sjbz and write out to the specified stream.

Parameters:
inSjbz A stream to write to.
virtual AutoPtr<Chunk> Celartem::DjVu::JB2Page::encodeSjbzChunk (  )  const [pure virtual]

Encode the current page as Sjbz.

Returns:
A newly created Sjbz chunk, which contains the encoding result.
virtual bool Celartem::DjVu::JB2Page::generatePalette ( size_t  inMaxPaletteSize,
const u8 *CEL_RESTRICT  inImage = NULL,
ssize_t  inImageRowStride = NULL,
Photometric  inImagePm = pmRGB8,
size_t  inWidth = 0,
size_t  inHeight = 0 
) [pure virtual]

Generate/Regenerate palette for shapes in this page.

Parameters:
inMaxPaletteSize The maximum numbers of palette.
inImage Optional; pointer to an image if you want to encolor shapes using external image.
inImageRowStride Optional; row-stride of the image.
inImagePm Optional; photometric of the image.
inWidth Optional; width of the image.
inHeight Optional; height of the image.
Returns:
true if palettes are generated correctly; otherwise, if the palette is actually not needed by the page, this method returns false.
virtual JB2Dictionary* Celartem::DjVu::JB2Page::getDictionary (  )  [pure virtual]

Get the dictionary Djbz if available.

Returns:
Pointer to JB2Dictionary instance if available; otherwise NULL.
virtual const JB2Dictionary* Celartem::DjVu::JB2Page::getDictionary (  )  const [pure virtual]

Get the dictionary Djbz if available.

Returns:
Pointer to JB2Dictionary instance if available; otherwise NULL.
virtual size_t Celartem::DjVu::JB2Page::getHeight (  )  const [pure virtual]

Get the height of the page.

Returns:
The height of the page in pixels.
virtual Shape::Array& Celartem::DjVu::JB2Page::getShapes (  )  [pure virtual]

Get the Shape::Array instance used by this instance.

Returns:
Reference to the Shape::Array instance.

Implements Celartem::DjVu::JB2ShapeStore.

virtual const Shape::Array& Celartem::DjVu::JB2Page::getShapes (  )  const [pure virtual]

Get the Shape::Array instance used by this instance.

Returns:
Reference to the Shape::Array instance.

Implements Celartem::DjVu::JB2ShapeStore.

virtual size_t Celartem::DjVu::JB2Page::getWidth (  )  const [pure virtual]

Get the width of the page.

Returns:
The width of the page in pixels.
virtual bool Celartem::DjVu::JB2Page::hasPalette (  )  const [pure virtual]

Determine whether the page has palette.
This method determines whether the page has palette (FGbz).

Returns:
true if the page has palette.
virtual bool Celartem::DjVu::JB2Page::isEmpty (  )  const [pure virtual]

Determine whether the page is empty or not.

Returns:
true if the page is empty (no shapes); otherwise false.
virtual bool Celartem::DjVu::JB2Page::isPaletteIsBlackOnly (  )  const [pure virtual]

Determine whether the palette is black-only or not.
Basically, black-only palette is meaningless but old DjVu decoder implementation does not accept 2-layer DjVu files without palette so we should emit palette even if there's only a palette entry for black.

Returns:
true if the palette has only one entry for black.
virtual bool Celartem::DjVu::JB2Page::isSjbzDecodeCompleted (  )  const [pure virtual]

Determine whether the Sjbz chunk is decoded completely or not.

virtual void Celartem::DjVu::JB2Page::render ( u8 outImagePtr,
ssize_t  inRowStride,
Photometric  inPm,
const Rect inRect,
size_t  inRescaledWidth,
size_t  inRescaledHeight,
bool  inNeedAlphaChannel,
bool  inUseFastRescaling = false 
) const [pure virtual]

Render the JB2 image (mask).
To draw black/white mask, use another version of render method.

Parameters:
outImagePtr Pointer to a buffer which receives the rendered image.
inRowStride The row-stride of the image.
inPm The photometric of the 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.
inNeedAlphaChannel Determine whether or not to add the alpha (opacity) channel to the output image.
inUseFastRescaling Determine whether to use fast rescaling algorithm or not.
The default is not to use fast rescaling algorithm.
virtual void Celartem::DjVu::JB2Page::render ( u8 ioImagePtr,
ssize_t  inRowStride,
Photometric  inPm,
const Rect inRect,
size_t  inRescaledWidth,
size_t  inRescaledHeight,
const u8 inFg,
ssize_t  inFgRowStride,
size_t  inFgWidth,
size_t  inFgHeight,
bool  inNeedAlphaChannel,
bool  inUseFastRescaling = false 
) const [pure virtual]

Render the JB2 image (mask).

Parameters:
outImagePtr Pointer to a buffer which receives the rendered image.
inRowStride The row-stride of the image.
inPm The photometric of the 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.
inFg Optional pointer to the foreground image. If this is NULL, then all the foreground related parameters are ignored and then the mask is painted with its own palette.
inFgRowStride The row-stride of the foreground image.
inFgWidth The width of the foreground image.
inFgHeight The height of the foreground image.
inNeedAlphaChannel Determine whether or not to add the alpha (opacity) channel to the output image.
inUseFastRescaling Determine whether to use fast rescaling algorithm or not.
The default is not to use fast rescaling algorithm.

To draw black/white mask, specify 1x1 foreground picture. The following code illustrates this:

static const u8 black[] = {0};
jb2page->render(
buffer, rowStride, pmGray8,
Rect(0, 0, width, height), width, height,
black, 0, 1, 1, false); // specify 1x1 black picture
virtual void Celartem::DjVu::JB2Page::setDictionary ( JB2Dictionary inDict  )  [pure virtual]

Set the dictionary.
This method may break internal consistency and overriding an existing dictionary is highly discouraged.

Parameters:
inDict Pointer to JB2Dictionary instance.
NULL to remove the associated dictionary instance.
virtual void Celartem::DjVu::JB2Page::setRenderingShapeRange ( size_t  inBegin,
size_t  inEnd 
) [pure virtual]

Set a range of rendering shapes.
This function restricts renderable shapes in the array of shapes until clearRenderingShapeRange is called.

Parameters:
inBegin The beginning of index of shapes.
inEnd The end of index of shapes.
virtual void Celartem::DjVu::JB2Page::setSjbzProgressiveDecoding ( bool  inProgressive  )  [pure virtual]

Enable/disable Sjbz progressive decoding mode.

Parameters:
inProgressive Whether or not to decode Sjbz in progressive mode.

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