#include <djv_page.h>
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 PageInfo & | getOriginalPageInfo () 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 Chunk * | getTH44Chunk () const =0 |
virtual Chunk * | getTH44Chunk ()=0 |
virtual void | setTH44Chunk (Chunk *inTH44Chunk)=0 |
virtual void | updateTH44Chunk (size_t inSize=96, bool inForceCreateTH44=false, IW44Encoder::Params *inIW44Params=NULL)=0 |
virtual AutoPtr< Chunk > | createTH44Chunk (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 PageInfo & | getPageInfo () const =0 |
virtual void | updateChunks ()=0 |
virtual TextZone * | getText ()=0 |
virtual const TextZone * | getText () const =0 |
virtual Annotation * | getAnnotation ()=0 |
virtual const Annotation * | getAnnotation () const =0 |
virtual Annotation * | getSharedAnnotation ()=0 |
virtual const Annotation * | getSharedAnnotation () 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 Chunk * | getChunk () const =0 |
virtual Chunk * | getChunk ()=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 Renderer * | getFgRenderer (bool noWait=false) const =0 |
virtual const Renderer * | getBgRenderer (bool noWait=false) const =0 |
virtual const Renderer * | getMaskRenderer (bool noWait=false) const =0 |
virtual const IW44Decoder * | getBg44Decoder (bool noWait=false) const =0 |
virtual const IW44Decoder * | getFg44Decoder (bool noWait=false) const =0 |
virtual const JB2Page * | getJB2Page (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< Page > | create (Chunk *inChunk) |
static AutoPtr< Page > | create (Chunk *inChunk, Document *inDoc) |
static AutoPtr< Page > | create (Chunk *inChunk, const Page *inPageToShareDict) |
Static Public Member Functions inherited from Celartem::Referable | |
static void | dumpDbgAllRefCount () |
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:
Flags to specify options for render, renderThumbnail functions.
This enumeration defines rendering modes which is used by render methods.
The value is combination of the following independent components:
Create a new Page instance from the specified chunk.
inChunk | Pointer to a DJVU chunk. |
Create a new Page instance from the specified chunk.
inChunk | Pointer to a DJVU chunk. |
inDoc | Pointer 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 |
Create a new Page instance from the specified chunk.
inChunk | Pointer to a DJVU chunk. |
inPageToShareDict | Pointer 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. |
|
pure virtual |
Create TH44
chunk from the page image.
inSize | The new thumbnail size; the width/height of the newly generated thumbnail is fit into inSize x inSize bounding box. |
inForceCreateTH44 | Whether 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. |
inIW44Params | Additional parameter to configure TH44 image quality and size. This can be NULL to use the default settings. |
|
pure virtual |
Get associated annotation.
|
pure virtual |
Get associated annotation.
|
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.
noWait | true to instruct not to acquire lock during getting the instance. The default is false . |
|
pure virtual |
|
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.
|
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.
|
pure virtual |
Get the resolution of the page in dot-per-inch.
|
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.
noWait | true to instruct not to acquire lock during getting the instance. The default is false . |
|
pure virtual |
|
pure virtual |
Get the format version of the DJVU
chunk.
|
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.
|
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.
noWait | true to instruct not to acquire lock during getting the instance. The default is false . |
|
pure virtual |
|
pure virtual |
Get the original height of the page.
|
pure virtual |
Get the original information of the page.
|
pure virtual |
Get the original width of the page.
|
pure virtual |
Get the information of the page. Reference to a PageInfo instance.
|
pure virtual |
Get the Rotation of the page.
|
pure virtual |
This method is only for backward compatibility, new applications should use \ref Document::getSharedAnnotation methods.Get shared annotation.
|
pure virtual |
This method is only for backward compatibility, new applications should use \ref Document::getSharedAnnotation methods.Get shared annotation.
|
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.
|
pure virtual |
Get associated text.
|
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:
|
pure virtual |
Get the TH44
chunk of the page.
If no TH44
(thumbnail) is associated to the page, this method returns NULL
.
TH44
chunk.
|
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.
|
pure virtual |
Gets loaded flag.
This method is for internal purpose only.
true
if the chunk data is loaded; otherwise false
.
|
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.
true
if ready; otherwise false
.
|
pure virtual |
Merge shared annotation into page level annotation.
|
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 |
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.
|
pure virtual |
|
pure virtual |
Render the page image.
outDest | Pointer to a buffer which receives the rendered result. |
inDestRowStride | The row-stride of outDest. |
inDestPm | The photometric of the output 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. |
inRenderMode | Rendering mode by one of RenderMode enumeration. |
inFlags | Any combination of RenderFlags enumerations. |
|
pure virtual |
Render the page image.
outDest | Pointer to a buffer which receives the rendered result. |
inDestRowStride | The row-stride of outDest. |
inDestPm | The photometric of the output 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. |
inRenderMode | Rendering mode by one of RenderMode enumeration. |
inRotation | The rotation of the page. With this parameter, you can override the rotation status enforced by the page. |
inFlags | Any combination of RenderFlags enumerations. |
|
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.
outDest | Pointer to a buffer which receives the rendered result. |
inDestRowStride | The row-stride of outDest. |
inDestPm | The photometric of the output 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. |
inForceRenderThumbnail | Whether this method creates thumbnail image from the page image when no TH44 chunk is found. |
inFlags | Any combination of RenderFlags enumerations. |
|
pure virtual |
Write out the page to the storage in DjVu format.
inStorage | Storage instance to write on. |
inSecProv | SecurityProvider instance if needed. It can be NULL . |
inCallback | Pointer to a function which is called during the serialization process. |
inContext | Pointer to a parameter which is passed to inCallback function. |
inForceReflectChanges | If 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. |
|
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.
inDpi | The page resolution in dot-per-inch. |
|
pure virtual |
Set the format version of the DJVU
chunk. Please note that you should take much care when changing format version.
version | The DjVu format version. |
|
pure virtual |
Sets a callback which is called on every chunk loaded event.
inOnChunkCallback | Pointer to a callback function which will be called when each chunk is loaded. |
inContext | A user defined data which is passed to the callback function. |
|
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.
inRotation | The page rotation status. |
|
pure virtual |
Set a TH44
chunk to the page.
inTH44Chunk | Pointer to a TH44 chunk to set to the page. |
|
pure virtual |
|
pure virtual |
Reflect the changes of this instance to the original chunks.
|
pure virtual |
Recreate TH44
chunk from the page image.
inSize | The new thumbnail size; the width/height of the newly generated thumbnail is fit into inSize x inSize bounding box. |
inForceCreateTH44 | Whether 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. |
inIW44Params | Additional parameter to configure TH44 image quality and size. This can be NULL to use the default settings. |