Public Types | Public Member Functions | Static Public Member Functions | List of all members
Celartem::DjVu::JB2Page Class Referenceabstract

#include <djv_jb2decoder.h>

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

Public Types

typedef SimpleArray< AutoPtr
< JB2Page > > 
Array
 

Public Member Functions

virtual void addFGbz (Stream *inFGbz)=0
 
virtual void addFGbz (const Chunk *inFGbz)=0
 
virtual bool addChunk (const Chunk *inChunk)=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, size_t inFgX, size_t inFgY, 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 renderPacked (u8 *outMaskPtr, ssize_t inMaskStride, const Rect &inRect) 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=65535, const u8 *CEL_RESTRICT inImage=NULL, ssize_t inImageRowStride=NULL, Photometric inImagePm=pmRGB8, size_t inWidth=0, size_t inHeight=0, u32 inFlags=0)=0
 
virtual void resetPalette (bool inShouldHavePalette)=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
 
virtual void optimizeDictionaryForSinglePage ()=0
 
- Public Member Functions inherited from Celartem::Referable
 Referable ()
 
void addRef () const
 
void releaseRef () const
 
size_t getReferenceCount () const
 

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)
 
- Static Public Member Functions inherited from Celartem::Referable
static void dumpDbgAllRefCount ()
 

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 bool Celartem::DjVu::JB2Page::addChunk ( const Chunk inChunk)
pure virtual

Set additional chunks such as FGbz, FGbx, Sjbx and JB2x.
The method can be used an extended version of addFGbz method.

Parameters
inChunkPointer to the FGbz, FGbx, Sjbx or JB2x chunk.
virtual void Celartem::DjVu::JB2Page::addFGbz ( Stream inFGbz)
pure virtual

Set FGbz (palette) to this page.

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

Set FGbz (palette) to this page.

Parameters
inFGbzPointer 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 ( Stream inSjbz,
JB2Dictionary inDict = NULL 
)
static

Create a new JB2Page instance from the specified stream.

Parameters
inSjbzA stream which contains the Sjbz chunk.
inDictOptional pointer to the JB2Dictionary instance.
It can be NULL if there's no dictionary.
static AutoPtr<JB2Page> Celartem::DjVu::JB2Page::create ( const Chunk inSjbz,
JB2Dictionary inDict = NULL 
)
static

Create a new JB2Page instance from the specified chunk.

Parameters
inSjbzPointer to the Sjbz chunk.
inDictOptional 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
inWidthThe width of the page in pixels.
inHeightThe height of the page in pixels.
inDictOptional 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
inNumRecordsThe 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
inFGbzA 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
inSjbzA 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 = 65535,
const u8 *CEL_RESTRICT  inImage = NULL,
ssize_t  inImageRowStride = NULL,
Photometric  inImagePm = pmRGB8,
size_t  inWidth = 0,
size_t  inHeight = 0,
u32  inFlags = 0 
)
pure virtual

Generate/Regenerate palette for shapes in this page.

Parameters
inMaxPaletteSizeThe maximum numbers of palette. The maximum is 65535.
inImageOptional; pointer to an image if you want to encolor shapes using external image.
inImageRowStrideOptional; row-stride of the image.
inImagePmOptional; photometric of the image.
inWidthOptional; width of the image.
inHeightOptional; height of the image.
inFlagsOptional; see JB2Encoder::Params::flags for more details.
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::optimizeDictionaryForSinglePage ( )
pure virtual

Merge referenced shapes in the dictionary (Djbz) into page (Sjbz).
This operation removes dependency to the dictionary. Thie method does nothing if the page is not associated to any dictionary.

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,
size_t  inFgX,
size_t  inFgY,
bool  inNeedAlphaChannel,
bool  inUseFastRescaling = false 
) const
pure virtual
        Render the JB2 image (mask).\n
        \param outImagePtr
            Pointer to a buffer which receives the rendered image.
        \param inRowStride
            The row-stride of the image.
        \param inPm
            The photometric of the image.
        \param inRect
            Rectangle to draw in the rescaled image coordination.
        \param inRescaledWidth
            The virtual width of the rescaled page image.\n
            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.
        \param inRescaledHeight
            The virtual height of the rescaled page image.\n
            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.
        \param inFg
            Optional pointer to the foreground image. If this is
            \c NULL, then all the foreground related parameters are
            ignored and then the mask is painted with its own palette.
        \param inFgRowStride
            The row-stride of the foreground image.
        \param inFgWidth
            The width of the foreground image.
        \param inFgHeight
            The height of the foreground image.
        \param inNeedAlphaChannel
            Determine whether or not to add the alpha (opacity)
            channel to the output image.
        \param inUseFastRescaling
            Determine whether to use fast rescaling algorithm or not.\n
            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::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
outImagePtrPointer to a buffer which receives the rendered image.
inRowStrideThe row-stride of the image.
inPmThe photometric of the image.
inRectRectangle to draw in the rescaled image coordination.
inRescaledWidthThe 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.
inRescaledHeightThe 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.
inNeedAlphaChannelDetermine whether or not to add the alpha (opacity) channel to the output image.
inUseFastRescalingDetermine whether to use fast rescaling algorithm or not.
The default is not to use fast rescaling algorithm.
virtual void Celartem::DjVu::JB2Page::renderPacked ( u8 outMaskPtr,
ssize_t  inMaskStride,
const Rect inRect 
) const
pure virtual

Render the JB2 image (mask) in packed bitmap form.

Parameters
outMaskPtrPointer to a buffer which receives the mask image.
inMaskStrideThe row-stride of the mask.
inRectRectangle to draw in the rescaled image coordination.
virtual void Celartem::DjVu::JB2Page::resetPalette ( bool  inShouldHavePalette)
pure virtual

Reset palette state.

Parameters
inShouldHavePaletteWhether the instance should have a palette or not.
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
inDictPointer 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
inBeginThe beginning of index of shapes.
inEndThe end of index of shapes.
virtual void Celartem::DjVu::JB2Page::setSjbzProgressiveDecoding ( bool  inProgressive)
pure virtual

Enable/disable Sjbz progressive decoding mode.

Parameters
inProgressiveWhether or not to decode Sjbz in progressive mode.

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

Cuminas DjVu SDK 3.0.33103
This document is made with doxygen 1.8.5 at Sun Dec 15 2013 19:38:07.
Cuminas Logo