#include <djv_jb2decoder.h>
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< Chunk > | encodeSjbzChunk () const =0 |
virtual void | encodeFGbz (Stream *inFGbz) const =0 |
virtual AutoPtr< Chunk > | encodeFGbzChunk () 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::Array & | getShapes ()=0 |
virtual const Shape::Array & | getShapes () const =0 |
virtual bool | isEmpty () const =0 |
virtual JB2Dictionary * | getDictionary ()=0 |
virtual const JB2Dictionary * | getDictionary () 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< JB2Page > | create (Stream *inSjbz, JB2Dictionary *inDict=NULL) |
static AutoPtr< JB2Page > | create (const Chunk *inSjbz, JB2Dictionary *inDict=NULL) |
static AutoPtr< JB2Page > | create (size_t inWidth, size_t inHeight, JB2Dictionary *inDict=NULL) |
Static Public Member Functions inherited from Celartem::Referable | |
static void | dumpDbgAllRefCount () |
This class defines JB2 Page class.
This class manages the JB2 shapes in a page. It may have a link to the shared dictionary.
typedef SimpleArray<AutoPtr<JB2Page> > Celartem::DjVu::JB2Page::Array |
Definition for easy access.
|
pure virtual |
Set additional chunks such as FGbz
, FGbx
, Sjbx
and JB2x
.
The method can be used an extended version of addFGbz method.
inChunk | Pointer to the FGbz , FGbx , Sjbx or JB2x chunk. |
|
pure virtual |
Set FGbz (palette) to this page.
inFGbz | A stream which contains the FGbz chunk. |
|
pure virtual |
Set FGbz (palette) to this page.
inFGbz | Pointer to the FGbz chunk. |
|
pure virtual |
Clear the range of rendering shapes.
|
pure virtual |
Minimize the memory usage.
Implements Celartem::DjVu::JB2ShapeStore.
|
static |
Create a new JB2Page instance from the specified stream.
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 |
Create a new JB2Page instance from the specified chunk.
inSjbz | Pointer to the Sjbz chunk. |
inDict | Optional pointer to the JB2Dictionary instance. It can be NULL if there's no dictionary. |
|
static |
Create a n empty JB2Page instance.
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. |
|
pure virtual |
Decode Sjbz chunk partially.
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. |
|
pure virtual |
Encode the current palette as FGbz
and write out to the specified stream.
inFGbz | A stream to write to. |
Encode the current palette as FGbz
.
FGbz
chunk, which contains the encoding result.
|
pure virtual |
Encode the current page as Sjbz
and write out to the specified stream.
inSjbz | A stream to write to. |
Encode the current page as Sjbz
.
Sjbz
chunk, which contains the encoding result.
|
pure virtual |
Generate/Regenerate palette for shapes in this page.
inMaxPaletteSize | The maximum numbers of palette. The maximum is 65535. |
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. |
inFlags | Optional; see JB2Encoder::Params::flags for more details. |
true
if palettes are generated correctly; otherwise, if the palette is actually not needed by the page, this method returns false
.
|
pure virtual |
Get the dictionary Djbz
if available.
NULL
.
|
pure virtual |
Get the dictionary Djbz
if available.
NULL
.
|
pure virtual |
Get the height of the page.
|
pure virtual |
Get the Shape::Array instance used by this instance.
Implements Celartem::DjVu::JB2ShapeStore.
|
pure virtual |
Get the Shape::Array instance used by this instance.
Implements Celartem::DjVu::JB2ShapeStore.
|
pure virtual |
Get the width of the page.
|
pure virtual |
Determine whether the page has palette.
This method determines whether the page has palette (FGbz
).
true
if the page has palette.
|
pure virtual |
Determine whether the page is empty or not.
true
if the page is empty (no shapes); otherwise false
.
|
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.
true
if the palette has only one entry for black.
|
pure virtual |
Determine whether the Sjbz chunk is decoded completely or not.
|
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.
|
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:
|
pure virtual |
Render the JB2 image (mask).
To draw black/white mask, use another version of render method.
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. |
|
pure virtual |
Render the JB2 image (mask) in packed bitmap form.
outMaskPtr | Pointer to a buffer which receives the mask image. |
inMaskStride | The row-stride of the mask. |
inRect | Rectangle to draw in the rescaled image coordination. |
|
pure virtual |
Reset palette state.
inShouldHavePalette | Whether the instance should have a palette or not. |
|
pure virtual |
Set the dictionary.
This method may break internal consistency and overriding an existing dictionary is highly discouraged.
inDict | Pointer to JB2Dictionary instance.NULL to remove the associated dictionary instance. |
|
pure virtual |
Set a range of rendering shapes.
This function restricts renderable shapes in the array of shapes until clearRenderingShapeRange is called.
inBegin | The beginning of index of shapes. |
inEnd | The end of index of shapes. |
|
pure virtual |
Enable/disable Sjbz progressive decoding mode.
inProgressive | Whether or not to decode Sjbz in progressive mode. |