#include <djv_page.h>

Public Types | |
| enum | RenderFlags { rfUseFastAlgorithm = 1, rfNoWaitForLoading = 2 } |
| 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 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, IW44::IW44Encoder::Params *inIW44Params=NULL)=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 | prerenderImageCaches (Photometric inPm) const =0 |
| virtual Photometric | getLastCachedImagePhotometric () const =0 |
| virtual void | clearImageCache () 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 IW44::IW44Decoder * | getBg44Decoder (bool noWait=false) const =0 |
| virtual const IW44::IW44Decoder * | getFg44Decoder (bool noWait=false) const =0 |
| virtual const JB2::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 |
Static Public Member Functions | |
| static AutoPtr< Page > | create (Chunk *inChunk) |
| static AutoPtr< Page > | create (Chunk *inChunk, Document *inDoc) |
DJVU chunk based pages. Locker lock(*page->getChunk());
page->render(...);
Definition at line 49 of file djv_page.h.
Flags to specify options for render, renderThumbnail functions.
| 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. |
Definition at line 219 of file djv_page.h.
This enumeration defines rendering modes which is used by render methods.
The value is combination of the following independent components:
Definition at line 408 of file djv_page.h.
Create a new Page instance from the specified chunk.
| inChunk | Pointer to a DJVU chunk. |
Create a new Page instance from the specified 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.
| 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.
| virtual size_t Celartem::DjVu::Page::getOriginalWidth | ( | ) | const [pure virtual] |
Get the original width of the page.
| virtual size_t Celartem::DjVu::Page::getOriginalHeight | ( | ) | const [pure virtual] |
Get the original height of the page.
| virtual size_t Celartem::DjVu::Page::getDpi | ( | ) | const [pure virtual] |
Get the resolution of the page in dot-per-inch.
| 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.
| inDpi | The page resolution in dot-per-inch. |
| virtual size_t Celartem::DjVu::Page::getFormatVersion | ( | ) | const [pure virtual] |
Get the format version of the DJVU chunk.
| 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.
| version | The DjVu format version. |
| virtual Rotation Celartem::DjVu::Page::getRotation | ( | ) | const [pure virtual] |
Get the Rotation of the page.
| 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.
| inRotation | The page rotation status. |
| virtual const Chunk* Celartem::DjVu::Page::getTH44Chunk | ( | ) | const [pure virtual] |
Get the TH44 chunk of the page.
If no TH44 (thumbnail) is associated to the page, this method returns NULL.
TH44 chunk.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.
TH44 chunk. | virtual void Celartem::DjVu::Page::setTH44Chunk | ( | Chunk * | inTH44Chunk | ) | [pure virtual] |
Set a TH44 chunk to the page.
| inTH44Chunk | Pointer to a TH44 chunk to set to the page. |
| virtual void Celartem::DjVu::Page::updateTH44Chunk | ( | size_t | inSize = 96, |
|
| bool | inForceCreateTH44 = false, |
|||
| IW44::IW44Encoder::Params * | inIW44Params = NULL | |||
| ) | [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. |
| 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.
| 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. |
| virtual const PageInfo& Celartem::DjVu::Page::getPageInfo | ( | ) | const [pure virtual] |
| virtual void Celartem::DjVu::Page::updateChunks | ( | ) | [pure virtual] |
Reflect the changes of this instance to the original chunks.
| 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.
| virtual const TextZone* Celartem::DjVu::Page::getText | ( | ) | const [pure virtual] |
Get associated text.
| virtual Annotation* Celartem::DjVu::Page::getAnnotation | ( | ) | [pure virtual] |
Get associated annotation.
| virtual const Annotation* Celartem::DjVu::Page::getAnnotation | ( | ) | const [pure virtual] |
Get associated annotation.
| virtual Annotation* Celartem::DjVu::Page::getSharedAnnotation | ( | ) | [pure virtual] |
Get shared annotation.
Annotation* sharedAnno = page->getSharedAnnotation(); // Insert code to edit the shared annotation here AutoPtr<Chunk> antz = sharedAnno->encodeANTzChunk(); AutoPtr<Chunk> incl = ChunkRedirector::create(antz); for(size_t i = 0; i < doc->getPages().getSize(); i++) { Chunk* pageChunk = doc->getPages()[i]->getChunk(); pageChunk->getChildren().push_back(incl); }
| virtual const Annotation* Celartem::DjVu::Page::getSharedAnnotation | ( | ) | const [pure virtual] |
Get shared annotation.
| 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.
| 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. |
| 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.
| 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.
| 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.
| 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. |
| 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.
| 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. |
| virtual void Celartem::DjVu::Page::prerenderImageCaches | ( | Photometric | inPm | ) | const [pure virtual] |
Pre-render the internal foreground/background images.
You can use this method in the background thread.
| inPm | The photometric of the output image. |
| virtual Photometric Celartem::DjVu::Page::getLastCachedImagePhotometric | ( | ) | const [pure virtual] |
Get the photometric of the last cached image.
| virtual void Celartem::DjVu::Page::clearImageCache | ( | ) | const [pure virtual] |
| virtual const Renderer* Celartem::DjVu::Page::getFgRenderer | ( | bool | noWait = false |
) | const [pure virtual] |
| virtual const Renderer* Celartem::DjVu::Page::getBgRenderer | ( | bool | noWait = false |
) | const [pure virtual] |
| virtual const Renderer* Celartem::DjVu::Page::getMaskRenderer | ( | bool | noWait = false |
) | const [pure virtual] |
| virtual const IW44::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.
| noWait | true to instruct not to acquire lock during getting the instance. The default is false. |
| virtual const IW44::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.
| noWait | true to instruct not to acquire lock during getting the instance. The default is false. |
| virtual const JB2::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.
| noWait | true to instruct not to acquire lock during getting the instance. The default is false. |
| virtual void Celartem::DjVu::Page::reloadChunks | ( | ) | [pure virtual] |
| virtual bool Celartem::DjVu::Page::isLoaded | ( | ) | const [pure virtual] |
Gets loaded flag.
This method is for internal purpose only.
true if the chunk data is loaded; otherwise false. | virtual void Celartem::DjVu::Page::setOnChunkCallback | ( | Chunk::OnChunkCallback | inOnChunkCallback, | |
| void * | inContext | |||
| ) | [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. |