#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 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< Chunk > | encodeSjbzChunk () const =0 |
| virtual void | encodeFGbz (Stream *inFGbz) const =0 |
| virtual AutoPtr< Chunk > | encodeFGbzChunk () 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::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 |
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) |
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.
| virtual void Celartem::DjVu::JB2Page::addFGbz | ( | Stream * | inFGbz | ) | [pure virtual] |
Set FGbz (palette) to this page.
| 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.
| 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.
| 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.
| 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.
| 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.
| 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. |
| virtual void Celartem::DjVu::JB2Page::encodeFGbz | ( | Stream * | inFGbz | ) | const [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. | virtual void Celartem::DjVu::JB2Page::encodeSjbz | ( | Stream * | inSjbz | ) | const [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. | 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.
| 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. |
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.
NULL. | virtual const JB2Dictionary* Celartem::DjVu::JB2Page::getDictionary | ( | ) | const [pure virtual] |
Get the dictionary Djbz if available.
NULL. | virtual size_t Celartem::DjVu::JB2Page::getHeight | ( | ) | const [pure virtual] |
Get the height of the page.
| virtual Shape::Array& Celartem::DjVu::JB2Page::getShapes | ( | ) | [pure virtual] |
Get the Shape::Array instance used by this 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.
Implements Celartem::DjVu::JB2ShapeStore.
| virtual size_t Celartem::DjVu::JB2Page::getWidth | ( | ) | const [pure virtual] |
Get the width of the page.
| virtual bool Celartem::DjVu::JB2Page::hasPalette | ( | ) | const [pure virtual] |
Determine whether the page has palette.
This method determines whether the page has palette (FGbz).
true if the page has palette. | virtual bool Celartem::DjVu::JB2Page::isEmpty | ( | ) | const [pure virtual] |
Determine whether the page is empty or not.
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.
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.
| 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).
| 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:
| 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.
| 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.
| 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.
| inProgressive | Whether or not to decode Sjbz in progressive mode. |