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

#include <djv_page.h>

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

Public Types

enum  RenderFlags { rfUseFastAlgorithm = 1, rfNoWaitForLoading = 2, rfNoWhiteFill = 4 }
 
enum  RenderMode {
  ForegroundNoMask = 1, MaskOnly = 2, ForegroundOnly = 3, BackgroundOnly = 4,
  FgAndBg = 5, BackgroundWithMask = 6, Normal = 7
}
 

Public Member Functions

virtual size_t getWidth () const =0
 
virtual size_t getHeight () const =0
 
virtual size_t getOriginalWidth () const =0
 
virtual size_t getOriginalHeight () const =0
 
virtual const PageInfogetOriginalPageInfo () const =0
 
virtual size_t getDpi () const =0
 
virtual void setDpi (size_t inDpi)=0
 
virtual size_t getFormatVersion () const =0
 
virtual void setFormatVersion (size_t version)=0
 
virtual Rotation getRotation () const =0
 
virtual void setRotation (Rotation inRotation)=0
 
virtual const ChunkgetTH44Chunk () const =0
 
virtual ChunkgetTH44Chunk ()=0
 
virtual void setTH44Chunk (Chunk *inTH44Chunk)=0
 
virtual void updateTH44Chunk (size_t inSize=96, bool inForceCreateTH44=false, IW44Encoder::Params *inIW44Params=NULL)=0
 
virtual AutoPtr< ChunkcreateTH44Chunk (size_t inSize=96, IW44Encoder::Params *inIW44Params=NULL) const =0
 
virtual bool renderThumbnail (u8 *outDest, ssize_t inDestRowStride, Photometric inDestPm, const Rect &inRect, size_t inRescaledWidth, size_t inRescaledHeight, bool inForceRenderThumbnail=true, u32 inFlags=0) const =0
 
virtual const PageInfogetPageInfo () const =0
 
virtual void updateChunks ()=0
 
virtual TextZonegetText ()=0
 
virtual const TextZonegetText () const =0
 
virtual AnnotationgetAnnotation ()=0
 
virtual const AnnotationgetAnnotation () const =0
 
virtual AnnotationgetSharedAnnotation ()=0
 
virtual const AnnotationgetSharedAnnotation () const =0
 
virtual void save (Storage *inStorage, const SecurityProvider *inSecProv=NULL, IFF::SerializationCallback inCallback=NULL, void *inContext=NULL, bool inForceReflectChanges=true) const =0
 
virtual const ChunkgetChunk () const =0
 
virtual ChunkgetChunk ()=0
 
virtual void render (u8 *outDest, ssize_t inDestRowStride, Photometric inDestPm, const Rect &inRect, size_t inRescaledWidth=0, size_t inRescaledHeight=0, RenderMode inRenderMode=Normal, u32 inFlags=0) const =0
 
virtual void render (u8 *outDest, ssize_t inDestRowStride, Photometric inDestPm, const Rect &inRect, size_t inRescaledWidth, size_t inRescaledHeight, RenderMode inRenderMode, Rotation inRotation, u32 inFlags=0) const =0
 
virtual void preload () const =0
 
virtual void unload () const =0
 
virtual bool isRendererReady () const =0
 
virtual const RenderergetFgRenderer (bool noWait=false) const =0
 
virtual const RenderergetBgRenderer (bool noWait=false) const =0
 
virtual const RenderergetMaskRenderer (bool noWait=false) const =0
 
virtual const IW44DecodergetBg44Decoder (bool noWait=false) const =0
 
virtual const IW44DecodergetFg44Decoder (bool noWait=false) const =0
 
virtual const JB2PagegetJB2Page (bool noWait=false) const =0
 
virtual void reloadChunks ()=0
 
virtual bool isLoaded () const =0
 
virtual void setOnChunkCallback (Chunk::OnChunkCallback inOnChunkCallback, void *inContext)=0
 
virtual void optimizeDictionaryForSinglePage ()=0
 
virtual void mergeSharedAnnotation ()=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< Pagecreate (Chunk *inChunk)
 
static AutoPtr< Pagecreate (Chunk *inChunk, Document *inDoc)
 
static AutoPtr< Pagecreate (Chunk *inChunk, const Page *inPageToShareDict)
 
- Static Public Member Functions inherited from Celartem::Referable
static void dumpDbgAllRefCount ()
 

Detailed Description

        This class provides an easy access to <tt>DJVU</tt> chunk based
        pages.\n
        Please note that the methods on a \ref Page instance is not
        serialized; they're not thread-safe. If you want to use the same
        instance between threads, you should lock the \ref Chunk instance
        obtained with \ref getChunk method
        (by calling \ref lock or using \ref Locker class)
        before manipulation on it. The following code illustrates this:
Locker lock(*page->getChunk());
page->render(...);

Member Enumeration Documentation

Flags to specify options for render, renderThumbnail functions.

Enumerator
rfUseFastAlgorithm 

Use faster algorithm.

rfNoWaitForLoading 

Rendering does not wait for all the data loaded.

This flag is very useful when you don't want to wait for the chunk arrival.

rfNoWhiteFill 

Never fill background even if background is not supplied.

This enumeration defines rendering modes which is used by render methods.
The value is combination of the following independent components:

  • Foreground (1)
  • Mask (2)
  • Background (4)
  • Opacity (8)
Enumerator
ForegroundNoMask 

Reserved.

MaskOnly 

Render only mask layer.

ForegroundOnly 

Render only foreground layer.

BackgroundOnly 

Render only background layer.

FgAndBg 

Reserved. (Impossible combination)

BackgroundWithMask 

Reserved.

Normal 

Render all the layers.

Member Function Documentation

static AutoPtr<Page> Celartem::DjVu::Page::create ( Chunk inChunk)
static

Create a new Page instance from the specified chunk.

Parameters
inChunkPointer to a DJVU chunk.
static AutoPtr<Page> Celartem::DjVu::Page::create ( Chunk inChunk,
Document inDoc 
)
static

Create a new Page instance from the specified chunk.

Parameters
inChunkPointer to a DJVU chunk.
inDocPointer to the Document instance which manages this instance. If no instance manages this Page instance, this can be NULL.
With this parameter, the page can share a JB2Dictionary instance to make dictionaries.
static AutoPtr<Page> Celartem::DjVu::Page::create ( Chunk inChunk,
const Page inPageToShareDict 
)
static

Create a new Page instance from the specified chunk.

Parameters
inChunkPointer to a DJVU chunk.
inPageToShareDictPointer to the Page instance which possibly share same dictionaries with the new Page instance. With this parameter, the page can share a JB2Dictionary instance to make dictionaries.
virtual AutoPtr<Chunk> Celartem::DjVu::Page::createTH44Chunk ( size_t  inSize = 96,
IW44Encoder::Params inIW44Params = NULL 
) const
pure virtual

Create TH44 chunk from the page image.

Parameters
inSizeThe new thumbnail size; the width/height of the newly generated thumbnail is fit into inSize x inSize bounding box.
inForceCreateTH44Whether this method creates a new TH44 chunk or not; if no corresponding TH44 chunk is found.
This method does nothing if inForceCreateTH44 is false and no TH44 chunk is found.
inIW44ParamsAdditional parameter to configure TH44 image quality and size. This can be NULL to use the default settings.
virtual Annotation* Celartem::DjVu::Page::getAnnotation ( )
pure virtual

Get associated annotation.

Returns
Pointer to the annotation associated to this instance. Please note that the modifications to the returned instance is not automatically reflected to the original chunk without explicit calls to updateChunks method.
virtual const Annotation* Celartem::DjVu::Page::getAnnotation ( ) const
pure virtual

Get associated annotation.

Returns
Pointer to the annotation associated to this instance.
virtual const IW44Decoder* Celartem::DjVu::Page::getBg44Decoder ( bool  noWait = false) const
pure virtual

Get the IW44Decoder instance which decodes the background.
This method internally calls getBgRenderer method and then use dynamic_cast against the instance returned by Renderer::getInternalRenderer method.

Parameters
noWaittrue to instruct not to acquire lock during getting the instance. The default is false.
Returns
Pointer to the IW44Decoder instance of the background
virtual const Renderer* Celartem::DjVu::Page::getBgRenderer ( bool  noWait = false) const
pure virtual

Get the Renderer instance used by this page to render the background.

Parameters
noWaittrue to instruct not to acquire lock during getting the instance. The default is false.
Returns
Pointer to the Renderer instance if it exists; otherwise NULL.
virtual const Chunk* Celartem::DjVu::Page::getChunk ( ) const
pure virtual

Get the actual Chunk instance.
Please note that modifications to the Annotation, TextZone and the other attributes are not reflected to the real chunk until you explicitly call updateChunks method.

Returns
Pointer to the Chunk instance.
virtual Chunk* Celartem::DjVu::Page::getChunk ( )
pure virtual

Get the actual Chunk instance.
Please note that modifications to the Annotation, TextZone and the other attributes are not reflected to the real chunk until you explicitly call updateChunks method.

Returns
Pointer to the Chunk instance.
virtual size_t Celartem::DjVu::Page::getDpi ( ) const
pure virtual

Get the resolution of the page in dot-per-inch.

Returns
The page resolution in dot-per-inch.
virtual const IW44Decoder* Celartem::DjVu::Page::getFg44Decoder ( bool  noWait = false) const
pure virtual

Get the IW44Decoder instance which decodes the foreground.
This method internally calls getBgRenderer method and then use dynamic_cast against the instance returned by Renderer::getInternalRenderer method.

Parameters
noWaittrue to instruct not to acquire lock during getting the instance. The default is false.
Returns
Pointer to the IW44Decoder instance of the foreground.
virtual const Renderer* Celartem::DjVu::Page::getFgRenderer ( bool  noWait = false) const
pure virtual

Get the Renderer instance used by this page to render the foreground.

Parameters
noWaittrue to instruct not to acquire lock during getting the instance. The default is false.
Returns
Pointer to the Renderer instance if it exists; otherwise NULL.
virtual size_t Celartem::DjVu::Page::getFormatVersion ( ) const
pure virtual

Get the format version of the DJVU chunk.

Returns
The DjVu format version.
virtual size_t Celartem::DjVu::Page::getHeight ( ) const
pure virtual

Get the height of the page.
This method returns the "rotated" height of the page. If you want to get the original height of the page, use getOriginalHeight method.

Returns
The height of the page in pixels.
virtual const JB2Page* Celartem::DjVu::Page::getJB2Page ( bool  noWait = false) const
pure virtual

Get the JB2Page instance which decodes the mask.
This method internally calls getBgRenderer method and then use dynamic_cast against the instance returned by Renderer::getInternalRenderer method.

Parameters
noWaittrue to instruct not to acquire lock during getting the instance. The default is false.
Returns
Pointer to the JB2Page instance.
virtual const Renderer* Celartem::DjVu::Page::getMaskRenderer ( bool  noWait = false) const
pure virtual

Get the Renderer instance used by this page to render the mask.

Parameters
noWaittrue to instruct not to acquire lock during getting the instance. The default is false.
Returns
Pointer to the Renderer instance if it exists; otherwise NULL.
virtual size_t Celartem::DjVu::Page::getOriginalHeight ( ) const
pure virtual

Get the original height of the page.

Returns
The height of the page in pixels.
virtual const PageInfo& Celartem::DjVu::Page::getOriginalPageInfo ( ) const
pure virtual

Get the original information of the page.

Returns
Reference to a PageInfo instance.
virtual size_t Celartem::DjVu::Page::getOriginalWidth ( ) const
pure virtual

Get the original width of the page.

Returns
The width of the page in pixels.
virtual const PageInfo& Celartem::DjVu::Page::getPageInfo ( ) const
pure virtual

Get the information of the page. Reference to a PageInfo instance.

virtual Rotation Celartem::DjVu::Page::getRotation ( ) const
pure virtual

Get the Rotation of the page.

Returns
The page rotation status.
virtual Annotation* Celartem::DjVu::Page::getSharedAnnotation ( )
pure virtual
Deprecated:
This method is only for backward compatibility, new
applications should use \ref Document::getSharedAnnotation
methods.
Get shared annotation.
Returns
Pointer to the annotation shared by several pages. Please note that the shared annotation could not be updated in the usual way because of its nature.
virtual const Annotation* Celartem::DjVu::Page::getSharedAnnotation ( ) const
pure virtual
Deprecated:
This method is only for backward compatibility, new
applications should use \ref Document::getSharedAnnotation
methods.
Get shared annotation.
Returns
Pointer to the annotation shared by several pages.
virtual TextZone* Celartem::DjVu::Page::getText ( )
pure virtual

Get associated text.
Please note that the modifications to the returned instance is not automatically reflected to the original chunk without explicit calls to updateChunks method.

Returns
Pointer to the text associated to this instance.
virtual const TextZone* Celartem::DjVu::Page::getText ( ) const
pure virtual

Get associated text.

Returns
Pointer to the text associated to this instance.
virtual const Chunk* Celartem::DjVu::Page::getTH44Chunk ( ) const
pure virtual
            Get the \c TH44 chunk of the page.\n
            If no \c TH44 (thumbnail) is associated to the page, this
            method returns \c NULL.
            \return
                Pointer to the \c TH44 chunk.

            You can decode \c TH44 chunk like the following code:
const Chunk* th44 = page->getTH44Chunk();
if(th44)
{
AutoPtr<IW44Decoder> th44dec = IW44Decoder::create();
th44dec->decode(th44);
size_t w = th44dec->getWidth();
size_t h = th44dec->getHeight();
th44dec->render(....);
}
virtual Chunk* Celartem::DjVu::Page::getTH44Chunk ( )
pure virtual

Get the TH44 chunk of the page.
If no TH44 (thumbnail) is associated to the page, this method returns NULL.

Returns
Pointer to the TH44 chunk.
virtual size_t Celartem::DjVu::Page::getWidth ( ) const
pure virtual

Get the width of the page.
This method returns the "rotated" width of the page. If you want to get the original width of the page, use getOriginalWidth method.

Returns
The width of the page in pixels.
virtual bool Celartem::DjVu::Page::isLoaded ( ) const
pure virtual

Gets loaded flag.
This method is for internal purpose only.

Returns
true if the chunk data is loaded; otherwise false.
virtual bool Celartem::DjVu::Page::isRendererReady ( ) const
pure virtual

Whether the renderer is ready to render the image or not.
This method actually determines whether the data is preloaded either partially or fully.

Returns
true if ready; otherwise false.
virtual void Celartem::DjVu::Page::mergeSharedAnnotation ( )
pure virtual

Merge shared annotation into page level annotation.

virtual void Celartem::DjVu::Page::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::Page::preload ( ) const
pure virtual

Load all the data to render the image.
You can call this method ahead of render method to make it faster to render the image. This method is designed to called from non GUI thread.

virtual void Celartem::DjVu::Page::reloadChunks ( )
pure virtual

Discards the modifications on this Page instance and reload the real Chunk instance assocaited to it.

virtual void Celartem::DjVu::Page::render ( u8 outDest,
ssize_t  inDestRowStride,
Photometric  inDestPm,
const Rect inRect,
size_t  inRescaledWidth = 0,
size_t  inRescaledHeight = 0,
RenderMode  inRenderMode = Normal,
u32  inFlags = 0 
) const
pure virtual

Render the page image.

Parameters
outDestPointer to a buffer which receives the rendered result.
inDestRowStrideThe row-stride of outDest.
inDestPmThe photometric of the output 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.
inRenderModeRendering mode by one of RenderMode enumeration.
inFlagsAny combination of RenderFlags enumerations.
virtual void Celartem::DjVu::Page::render ( u8 outDest,
ssize_t  inDestRowStride,
Photometric  inDestPm,
const Rect inRect,
size_t  inRescaledWidth,
size_t  inRescaledHeight,
RenderMode  inRenderMode,
Rotation  inRotation,
u32  inFlags = 0 
) const
pure virtual

Render the page image.

Parameters
outDestPointer to a buffer which receives the rendered result.
inDestRowStrideThe row-stride of outDest.
inDestPmThe photometric of the output 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.
inRenderModeRendering mode by one of RenderMode enumeration.
inRotationThe rotation of the page.
With this parameter, you can override the rotation status enforced by the page.
inFlagsAny combination of RenderFlags enumerations.
virtual bool Celartem::DjVu::Page::renderThumbnail ( u8 outDest,
ssize_t  inDestRowStride,
Photometric  inDestPm,
const Rect inRect,
size_t  inRescaledWidth,
size_t  inRescaledHeight,
bool  inForceRenderThumbnail = true,
u32  inFlags = 0 
) const
pure virtual

Render the thumbnail image.
If you want to take more control of the thumbnail (to get the width/height, rendering quality, and so on), you had better use getTH44Chunk method rather than this.

Parameters
outDestPointer to a buffer which receives the rendered result.
inDestRowStrideThe row-stride of outDest.
inDestPmThe photometric of the output 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.
inForceRenderThumbnailWhether this method creates thumbnail image from the page image when no TH44 chunk is found.
inFlagsAny combination of RenderFlags enumerations.
virtual void Celartem::DjVu::Page::save ( Storage inStorage,
const SecurityProvider inSecProv = NULL,
IFF::SerializationCallback  inCallback = NULL,
void *  inContext = NULL,
bool  inForceReflectChanges = true 
) const
pure virtual

Write out the page to the storage in DjVu format.

Parameters
inStorageStorage instance to write on.
inSecProvSecurityProvider instance if needed. It can be NULL.
inCallbackPointer to a function which is called during the serialization process.
inContextPointer to a parameter which is passed to inCallback function.
inForceReflectChangesIf ture, this method internally calls updateChunks before writing out the chunks to the storage; otherwise this method writes out the chunks as it is and the modifications you've done are not reflected to the output result.
virtual void Celartem::DjVu::Page::setDpi ( size_t  inDpi)
pure virtual

Set the resolution of the page in dot-per-inch.
Please note that the modification by this method is not automatically reflected to the original chunk without explicit calls to updateChunks method.

Parameters
inDpiThe page resolution in dot-per-inch.
virtual void Celartem::DjVu::Page::setFormatVersion ( size_t  version)
pure virtual

Set the format version of the DJVU chunk. Please note that you should take much care when changing format version.

Parameters
versionThe DjVu format version.
virtual void Celartem::DjVu::Page::setOnChunkCallback ( Chunk::OnChunkCallback  inOnChunkCallback,
void *  inContext 
)
pure virtual

Sets a callback which is called on every chunk loaded event.

Parameters
inOnChunkCallbackPointer to a callback function which will be called when each chunk is loaded.
inContextA user defined data which is passed to the callback function.
virtual void Celartem::DjVu::Page::setRotation ( Rotation  inRotation)
pure virtual

Set the Rotation of the page.
Please note that the modification by this method is not automatically reflected to the original chunk without explicit calls to updateChunks method.

Parameters
inRotationThe page rotation status.
virtual void Celartem::DjVu::Page::setTH44Chunk ( Chunk inTH44Chunk)
pure virtual

Set a TH44 chunk to the page.

Parameters
inTH44ChunkPointer to a TH44 chunk to set to the page.
virtual void Celartem::DjVu::Page::unload ( ) const
pure virtual

Unload cached data for rendering.
This method clears internal data which are cached for repeated use of render methods. This actually reduces the memory usage of the instance but it may affect the performance of render methods.

virtual void Celartem::DjVu::Page::updateChunks ( )
pure virtual

Reflect the changes of this instance to the original chunks.

virtual void Celartem::DjVu::Page::updateTH44Chunk ( size_t  inSize = 96,
bool  inForceCreateTH44 = false,
IW44Encoder::Params inIW44Params = NULL 
)
pure virtual

Recreate TH44 chunk from the page image.

Parameters
inSizeThe new thumbnail size; the width/height of the newly generated thumbnail is fit into inSize x inSize bounding box.
inForceCreateTH44Whether this method creates a new TH44 chunk or not; if no corresponding TH44 chunk is found.
This method does nothing if inForceCreateTH44 is false and no TH44 chunk is found.
inIW44ParamsAdditional parameter to configure TH44 image quality and size. This can be NULL to use the default settings.

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