An SVG generator for JawsMako, allowing simple generation of SVG fragments for individual DOM nodes or entire pages.
More...
#include <svggenerator.h>
|
enum | SVGVersion |
| The SVG available versions for which the output is generated.
|
|
|
virtual IRAInputStreamPtr | generateSVG (const IDOMNodePtr &node)=0 |
| Generate SVG for the given DOM Node, returning the result in a stream.
|
|
virtual void | generateSVG (const IDOMNodePtr &node, const IOutputStreamPtr &outputStream)=0 |
| Alternate form of generateSVG() when an existing stream should be used.
|
|
virtual IInputStreamPtr | getResource (const U8String &name)=0 |
| Get the stream for a named resource. An exception will be thrown if the resource cannot be found.
|
|
virtual void | getResources (CSVGResourceVect &resources)=0 |
| Get all the resources in a vector.
|
|
virtual void | setVersion (SVGVersion version)=0 |
| Set the output version of the generated SVG. The default is 1.1.
|
|
virtual void | setResolution (float resolution)=0 |
| Set the target resolution for display. The default is 96dpi.
|
|
virtual void | setEnableImageDownsampling (bool downsample)=0 |
| Enable or disable image downsampling.
|
|
virtual void | setOptionalContent (const IOptionalContentPtr &optionalContent)=0 |
| Set the optional content for the document.
|
|
virtual void | setOptionalContentUsage (eOptionalContentEvent usage)=0 |
| Set the usage of the optional content items that should be retained.
|
|
virtual void | setTargetResolutionCallback (void *priv, UrlCallbackForTarget callback)=0 |
| Set a callback to provide the Url (absolute or relative) of the object where a target may be found. Return either the URL of the containing object, or an empty string if no such target exists.
|
|
virtual void | setPageResolutionCallback (void *priv, UrlCallbackForPage callback)=0 |
| Set a callback to provide the Url (absolute or relative) of the given page number. Return either the URL of the page, or an empty string if the page will not be reachable.
|
|
virtual void | setVisibleZeroWidthLines (bool visible)=0 |
| Sets whether or not to generate visible zero width lines.
|
|
virtual void | addRef () const =0 |
| Increases the reference count of the actual object pointed to. This would take place during an assignment or copying.
|
|
virtual bool | decRef () const =0 |
| Decreases the reference count of the actual object pointed to. When the reference count falls to Zero, it deletes the actual object pointed to.
|
|
virtual int32 | getRefCount () const =0 |
| Retrieve the current reference count of the actual object pointed to.
|
|
|
static JAWSMAKO_API ISVGGeneratorPtr | create (const IJawsMakoPtr &jawsMako, const U8String &resourcePrefix=U8String(), const IProgressMonitorPtr &progressMonitor=IProgressMonitorPtr()) |
| Create a SVG generator instance.
|
|
|
virtual | ~IRCObject () |
| Virtual destructor.
|
|
An SVG generator for JawsMako, allowing simple generation of SVG fragments for individual DOM nodes or entire pages.
The SVG is provided in a stream, with resources used by the SVG presented as streams tracked by instances of this object, which can be requested via getResource(). Resources are reused where possible for multiple SVG fragments.
◆ create()
static JAWSMAKO_API ISVGGeneratorPtr JawsMako::ISVGGenerator::create |
( |
const IJawsMakoPtr & | jawsMako, |
|
|
const U8String & | resourcePrefix = U8String(), |
|
|
const IProgressMonitorPtr & | progressMonitor = IProgressMonitorPtr() ) |
|
static |
Create a SVG generator instance.
- Parameters
-
jawsMako | The JawsMako instance. |
resourcePrefix | A path fragment to prepend to resource names when generating SVG. Useful for cases where the resources are to be written to disk somewhere else than alongside the SVG fragment. |
progressMonitor | The progress monitor which allows aborting an operation or registering a progress callback. |
- Returns
- ISVGGeneratorPtr The new instance.
◆ generateSVG() [1/2]
virtual IRAInputStreamPtr JawsMako::ISVGGenerator::generateSVG |
( |
const IDOMNodePtr & | node | ) |
|
|
pure virtual |
Generate SVG for the given DOM Node, returning the result in a stream.
- Parameters
-
node | The DOM node to be represented as SVG. |
- Returns
- IRAInputStreamPtr The SVG stream.
◆ generateSVG() [2/2]
virtual void JawsMako::ISVGGenerator::generateSVG |
( |
const IDOMNodePtr & | node, |
|
|
const IOutputStreamPtr & | outputStream ) |
|
pure virtual |
Alternate form of generateSVG() when an existing stream should be used.
- Parameters
-
node | The DOM node to be represented as SVG. |
outputStream | The destination stream for the SVG. |
◆ getResource()
virtual IInputStreamPtr JawsMako::ISVGGenerator::getResource |
( |
const U8String & | name | ) |
|
|
pure virtual |
Get the stream for a named resource. An exception will be thrown if the resource cannot be found.
- Parameters
-
name | The name of the resource. |
- Returns
- IInputStreamPtr The resource stream.
◆ getResources()
virtual void JawsMako::ISVGGenerator::getResources |
( |
CSVGResourceVect & | resources | ) |
|
|
pure virtual |
Get all the resources in a vector.
- Parameters
-
resources | A reference to a vector to receive the entries. |
◆ setEnableImageDownsampling()
virtual void JawsMako::ISVGGenerator::setEnableImageDownsampling |
( |
bool | downsample | ) |
|
|
pure virtual |
Enable or disable image downsampling.
If true, images whose resolution is 50% higher than the target resolution (see setResolution()) will be downsampled to the target resolution.
If false, images will not be downsampled.
The default is true.
◆ setOptionalContent()
virtual void JawsMako::ISVGGenerator::setOptionalContent |
( |
const IOptionalContentPtr & | optionalContent | ) |
|
|
pure virtual |
Set the optional content for the document.
If provided, the generator will apply optional content rules to the content during generation. If NULL, all content will be written to the output stream.
◆ setOptionalContentUsage()
Set the usage of the optional content items that should be retained.
Setting the usage to eOCEUnknown will retain all items if no optional content is set with setOptionalContent(), otherwise it will throw an IError of code EDL_ERR_BAD_ARGUMENTS.
The default is eOCEView.
◆ setPageResolutionCallback()
virtual void JawsMako::ISVGGenerator::setPageResolutionCallback |
( |
void * | priv, |
|
|
UrlCallbackForPage | callback ) |
|
pure virtual |
Set a callback to provide the Url (absolute or relative) of the given page number. Return either the URL of the page, or an empty string if the page will not be reachable.
The priv argument will be provided to the callback at each invocation.
See svggenerator.cpp for an example of its use.
◆ setTargetResolutionCallback()
virtual void JawsMako::ISVGGenerator::setTargetResolutionCallback |
( |
void * | priv, |
|
|
UrlCallbackForTarget | callback ) |
|
pure virtual |
Set a callback to provide the Url (absolute or relative) of the object where a target may be found. Return either the URL of the containing object, or an empty string if no such target exists.
The priv argument will be provided to the callback at each invocation.
See svggenerator.cpp for an example of its use.
◆ setVisibleZeroWidthLines()
virtual void JawsMako::ISVGGenerator::setVisibleZeroWidthLines |
( |
bool | visible | ) |
|
|
pure virtual |
Sets whether or not to generate visible zero width lines.
Setting this value to true will convert zero width lines to
visible lines by setting the stroke width to 1 and setting
the vector-effect property to non-scaling-stroke.
The default value is false.
The documentation for this class was generated from the following file: