Mako 7.5.0 API
Loading...
Searching...
No Matches
JawsMako::IXAMLGenerator Class Referenceabstract

A XAML generator for Mako, allowing simple generation of XAML fragments for individual DOM nodes or entire pages. More...

#include <xamlgenerator.h>

Inheritance diagram for JawsMako::IXAMLGenerator:

Classes

class  CAnnotationXAML
 Class for receiving XAML generated for annotation appearances in a bulk fashion. More...
 
class  CResourceEntry
 Resource entry. More...
 

Public Member Functions

virtual IRAInputStreamPtr generateXAML (const IDOMNodePtr &node, const IDOMCatalogPtr &catalog=IDOMCatalogPtr())=0
 Generate XAML for the given DOM Node, returning the result in a stream.
 
virtual void generateXAML (const IDOMNodePtr &node, const IOutputStreamPtr &outputStream, const IDOMCatalogPtr &catalog=IDOMCatalogPtr())=0
 Alternate form of generateXAML() when an existing stream should be used.
 
virtual IRAInputStreamPtr generateXAMLForPageAndAnnotationAppearances (const IPagePtr &page, CAnnotationXAMLVect &appearanceXAMLs)=0
 Generate XAML for the given IPage and all the annotation appearances present on the page. The XAML for the page will be in the returned stream, and appearanceXAMLs will be populated with the XAML for all annotation appearances. This will usually be faster than using generateXAML() on the page contents and then separately invoking generateXAMLForPageAnnotationAppearances().
 
virtual IRAInputStreamPtr generateXAMLForAppearance (const IAnnotationAppearancePtr &appearance, const IAnnotationPtr &annotation, const IPagePtr &page)=0
 Generate XAML for a given annotation appearance. Provide the annotation and page from which the appearance comes. The page is required as some annotations may need to be composited against the page backdrop. This is slower than invoking generateXAMLForPageAnnotationAppearances() which is in turn slower than using generateXAMLForPageAndAnnotations().
 
virtual void generateXAMLForAppearance (const IAnnotationAppearancePtr &appearance, const IAnnotationPtr &annotation, const IPagePtr &page, const IOutputStreamPtr &outputStream)=0
 Alternate form of generateXAMLForAppearance() where an existing stream should be used. Provide the annotation and page from which the appearance comes. The page is required as some annotations may need to be composited against the page backdrop. This is slower than invoking generateXAMLForPageAnnotationAppearances() which is in turn slower than using generateXAMLForPageAndAnnotations().
 
virtual void generateXAMLForPageAnnotationAppearances (const IPagePtr &page, CAnnotationXAMLVect &appearanceXAMLs)=0
 Generate XAML for all the annotation appearances on the given page. This is generally more efficient than using generateXAMLForAppearance() repeatedly for every page, but not as fast as using generateXAMLForPageAndAnnotations() to generate XAML for the page and the annotations in one bulk operation.
 
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 (CEDLVector< CResourceEntry > &resources)=0
 Get all the resources in a vector.
 
virtual void setSubsetFonts (bool subset)=0
 Set whether fonts should be subset in the output.
 
virtual void setMergeFonts (bool merge)=0
 Set whether or not an attempt will be made to merge disparate subsets of a font into a single font.
 
virtual void setMergeImages (bool merge=true)=0
 Set if the XAML writer should attempt to merge adjacent images. The default is true.
 
virtual void setColorImageMaxResolution (float resolution, float threshold=0.0f, IDOMImageDownsamplerFilter::eDownsamplingMethod method=IDOMImageDownsamplerFilter::eBicubic)=0
 Set the desired maximum resolution, threshold and downsampling method for color images for XAML output.
 
virtual void setGrayImageMaxResolution (float resolution, float threshold=0.0f, IDOMImageDownsamplerFilter::eDownsamplingMethod method=IDOMImageDownsamplerFilter::eBicubic)=0
 Set the desired maximum resolution, threshold and downsampling method for gray images.
 
virtual void setMonoImageMaxResolution (float resolution, float threshold=0.0f, IDOMImageDownsamplerFilter::eDownsamplingMethod method=IDOMImageDownsamplerFilter::eSubsample)=0
 Set the desired maximum resolution, threshold and downsampling method for monochrome images.
 
virtual void setTargetColorSpace (const IDOMColorSpacePtr &targetSpace)=0
 Set the target color space for the output. The default behaviour is to, where possible, leave the color space of objects unchanged.
 
virtual void setTargetProfile (const IDOMICCProfilePtr &profile)=0
 Set the target color space for the output using an ICC profile. The default behaviour is to, where possible, leave the color space of objects unchanged.
 
virtual void applyColorConverterTransform (const IColorConverterTransformPtr &transform)=0
 Apply the given color converter transform to the contents before writing XAML. This supersedes the target color space parameters described above. This allows for more advanced configuration of the color spaces of the output.
 
virtual void setRenderResolution (uint32 resolution)=0
 Set the resolution to use if page content requires rendering in order to be output as XAML. The default is 150dpi. This is affected also by the maximum image resolution parameters.
 
virtual void applyRendererTransform (const IRendererTransformPtr &transform)=0
 Apply the given renderer transform to the contents before writing XAML. This supersedes the target color space parameters described above. This allows for more advanced configuration of rendering.
 
virtual void setPreferredColorImageFormat (IImageEncoderTransform::eEncodeFormat format)=0
 Set the desired image format for color images that need to be reencoded for XAML output. The default is eEFAuto. Note: this is advisory only and may not be honoured in all cases if the image cannot be represented in XAML in the desired form.
 
virtual void setPreferredGrayImageFormat (IImageEncoderTransform::eEncodeFormat format)=0
 Set the desired image format for gray images that need to be reencoded for XAML output. The default is eEFAuto. Note: this is advisory only and may not be honoured in all cases if the image cannot be represented in XPS in the desired form.
 
virtual void setPreferredMonoImageFormat (IImageEncoderTransform::eEncodeFormat format)=0
 Set the desired image format for monochrome images that need to be reencoded for XAML output. The default is eEFAuto. Note: this is advisory only and may not be honoured in all cases if the image cannot be represented in XPS in the desired form.
 
virtual void setJPEGQuality (uint8 quality)=0
 Set the JPEG quality to use when encoding images in JPEG format. Equivalent to calling setParameter() with the parameter name "JPEGQuality" and the value being the required quality.
 
virtual void applyEncoderTransform (const IImageEncoderTransformPtr &transform)=0
 Apply the given image encoder transform to the contents before writing to XAML. This supersedes the image encoding parameters described above. This allows for more advanced configuration of image encoding.
 
- Public Member Functions inherited from IRCObject
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 Public Member Functions

static JAWSMAKO_API IXAMLGeneratorPtr create (const IJawsMakoPtr &jawsMako, const U8String &resourcePrefix=U8String(), const IProgressMonitorPtr &progressMonitor=IProgressMonitorPtr())
 Create a XAML generator instance.
 

Additional Inherited Members

- Protected Member Functions inherited from IRCObject
virtual ~IRCObject ()
 Virtual destructor.
 

Detailed Description

A XAML generator for Mako, allowing simple generation of XAML fragments for individual DOM nodes or entire pages.

The XAML is provided in a stream, with resources used by the XAML presented as streams tracked by instances of this object, which can be requested via getResource(). Resources are reused where possible for multiple XAML fragments.

Member Function Documentation

◆ create()

static JAWSMAKO_API IXAMLGeneratorPtr JawsMako::IXAMLGenerator::create ( const IJawsMakoPtr & jawsMako,
const U8String & resourcePrefix = U8String(),
const IProgressMonitorPtr & progressMonitor = IProgressMonitorPtr() )
static

Create a XAML generator instance.

Parameters
jawsMakoThe JawsMako instance.
resourcePrefixA path fragment to prepend to resource names when generating XAML. Useful for cases where the resources are to be written to disk somewhere else than alongside the XAML fragment.
progressMonitorThe progress monitor which allows aborting an operation or registering a progress callback.
Returns
IXAMLGeneratorPtr The new instance.

◆ generateXAML() [1/2]

virtual IRAInputStreamPtr JawsMako::IXAMLGenerator::generateXAML ( const IDOMNodePtr & node,
const IDOMCatalogPtr & catalog = IDOMCatalogPtr() )
pure virtual

Generate XAML for the given DOM Node, returning the result in a stream.

Parameters
nodeThe DOM node to be represented as XAML.
catalogThe catalog associated with the node. Optional, but required if the names of named elements are to be present in the generated XAML.
Returns
IRAInputStreamPtr The XAML stream.

◆ generateXAML() [2/2]

virtual void JawsMako::IXAMLGenerator::generateXAML ( const IDOMNodePtr & node,
const IOutputStreamPtr & outputStream,
const IDOMCatalogPtr & catalog = IDOMCatalogPtr() )
pure virtual

Alternate form of generateXAML() when an existing stream should be used.

Parameters
nodeThe DOM node to be represented as XAML.
outputStreamThe destination stream for the XAML.
catalogThe catalog associated with the node. Optional, but required if the names of named elements are to be present in the generated XAML.

◆ generateXAMLForAppearance() [1/2]

virtual IRAInputStreamPtr JawsMako::IXAMLGenerator::generateXAMLForAppearance ( const IAnnotationAppearancePtr & appearance,
const IAnnotationPtr & annotation,
const IPagePtr & page )
pure virtual

Generate XAML for a given annotation appearance. Provide the annotation and page from which the appearance comes. The page is required as some annotations may need to be composited against the page backdrop. This is slower than invoking generateXAMLForPageAnnotationAppearances() which is in turn slower than using generateXAMLForPageAndAnnotations().

Parameters
appearanceThe appearance to be presented as XAML.
annotationThe annotation that contains the appearance. Required in order to position the annotation against the page background correctly.
pageThe page the appearance appears on.

◆ generateXAMLForAppearance() [2/2]

virtual void JawsMako::IXAMLGenerator::generateXAMLForAppearance ( const IAnnotationAppearancePtr & appearance,
const IAnnotationPtr & annotation,
const IPagePtr & page,
const IOutputStreamPtr & outputStream )
pure virtual

Alternate form of generateXAMLForAppearance() where an existing stream should be used. Provide the annotation and page from which the appearance comes. The page is required as some annotations may need to be composited against the page backdrop. This is slower than invoking generateXAMLForPageAnnotationAppearances() which is in turn slower than using generateXAMLForPageAndAnnotations().

Parameters
appearanceThe appearance to be presented as XAML.
annotationThe annotation that contains the appearance. Required in order to position the annotation against the page background correctly.
pageThe page the appearance appears on.

◆ generateXAMLForPageAndAnnotationAppearances()

virtual IRAInputStreamPtr JawsMako::IXAMLGenerator::generateXAMLForPageAndAnnotationAppearances ( const IPagePtr & page,
CAnnotationXAMLVect & appearanceXAMLs )
pure virtual

Generate XAML for the given IPage and all the annotation appearances present on the page. The XAML for the page will be in the returned stream, and appearanceXAMLs will be populated with the XAML for all annotation appearances. This will usually be faster than using generateXAML() on the page contents and then separately invoking generateXAMLForPageAnnotationAppearances().

Parameters
pageThe DOM node to be produced as XAML
appearanceXAMLsA vector to receive the XAML for the annotation appearances.
Returns
IRAInputStreamPtr The XAML stream.

◆ generateXAMLForPageAnnotationAppearances()

virtual void JawsMako::IXAMLGenerator::generateXAMLForPageAnnotationAppearances ( const IPagePtr & page,
CAnnotationXAMLVect & appearanceXAMLs )
pure virtual

Generate XAML for all the annotation appearances on the given page. This is generally more efficient than using generateXAMLForAppearance() repeatedly for every page, but not as fast as using generateXAMLForPageAndAnnotations() to generate XAML for the page and the annotations in one bulk operation.

Parameters
pageThe page whose annotations should be represented as XAML.
appearanceXAMLsA vector to receive the XAML for the annotation appearances.

◆ getResource()

virtual IInputStreamPtr JawsMako::IXAMLGenerator::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
nameThe name of the resource.
Returns
IInputStreamPtr The resource stream.

◆ getResources()

virtual void JawsMako::IXAMLGenerator::getResources ( CEDLVector< CResourceEntry > & resources)
pure virtual

Get all the resources in a vector.

Parameters
resourcesA reference to a vector to receive the entries.

◆ setColorImageMaxResolution()

virtual void JawsMako::IXAMLGenerator::setColorImageMaxResolution ( float resolution,
float threshold = 0.0f,
IDOMImageDownsamplerFilter::eDownsamplingMethod method = IDOMImageDownsamplerFilter::eBicubic )
pure virtual

Set the desired maximum resolution, threshold and downsampling method for color images for XAML output.

The default behaviour is leave the image resolution unchanged.

Parameters
resolutionThe desired output resolution, in dpi. Pass 0 to leave images unchanged, which is the default.
thresholdThe threshold above which images will be reduced to the desired resolution. Pass 0 to use the resolution.
methodThe method to use when downsampling. The default is bicubic for color images.

◆ setGrayImageMaxResolution()

virtual void JawsMako::IXAMLGenerator::setGrayImageMaxResolution ( float resolution,
float threshold = 0.0f,
IDOMImageDownsamplerFilter::eDownsamplingMethod method = IDOMImageDownsamplerFilter::eBicubic )
pure virtual

Set the desired maximum resolution, threshold and downsampling method for gray images.

The default behaviour is leave the image resolution unchanged.

Parameters
resolutionThe desired output resolution, in dpi. Pass 0 to leave images unchanged, which is the default.
thresholdThe threshold above which images will be reduced to the desired resolution. Pass 0 to use the resolution.
methodThe method to use when downsampling. The default is bicubic for gray images.

◆ setJPEGQuality()

virtual void JawsMako::IXAMLGenerator::setJPEGQuality ( uint8 quality)
pure virtual

Set the JPEG quality to use when encoding images in JPEG format. Equivalent to calling setParameter() with the parameter name "JPEGQuality" and the value being the required quality.

Parameters
qualityThe desired quality level, with 1 being lowest quality and 5 being highest quality.

◆ setMergeFonts()

virtual void JawsMako::IXAMLGenerator::setMergeFonts ( bool merge)
pure virtual

Set whether or not an attempt will be made to merge disparate subsets of a font into a single font.

The default is false. Equivalent to calling setParameter with "MergeFonts" as the parameter name.

Some formats such as PostScript and XPS tend to include many font subsets and for output it is often avantageous to attempt to merge these fonts into a single font where possible.

Note that it is possible to enable both font subsetting and merging at the same time. In this case merging happens first, followed by subsetting of the merged results.

◆ setMonoImageMaxResolution()

virtual void JawsMako::IXAMLGenerator::setMonoImageMaxResolution ( float resolution,
float threshold = 0.0f,
IDOMImageDownsamplerFilter::eDownsamplingMethod method = IDOMImageDownsamplerFilter::eSubsample )
pure virtual

Set the desired maximum resolution, threshold and downsampling method for monochrome images.

The default behaviour is leave the image resolution unchanged.

Parameters
resolutionThe desired output resolution, in dpi. Pass 0 to leave images unchanged, which is the default.
thresholdThe threshold above which images will be reduced to the desired resolution. Pass 0 to use the resolution.
methodThe method to use when downsampling. The default is subsample for monochrome images; using any other method will result in grayscale output.

◆ setPreferredColorImageFormat()

virtual void JawsMako::IXAMLGenerator::setPreferredColorImageFormat ( IImageEncoderTransform::eEncodeFormat format)
pure virtual

Set the desired image format for color images that need to be reencoded for XAML output. The default is eEFAuto. Note: this is advisory only and may not be honoured in all cases if the image cannot be represented in XAML in the desired form.

Parameters
formatThe desired format.

◆ setPreferredGrayImageFormat()

virtual void JawsMako::IXAMLGenerator::setPreferredGrayImageFormat ( IImageEncoderTransform::eEncodeFormat format)
pure virtual

Set the desired image format for gray images that need to be reencoded for XAML output. The default is eEFAuto. Note: this is advisory only and may not be honoured in all cases if the image cannot be represented in XPS in the desired form.

Parameters
formatThe desired format.

◆ setPreferredMonoImageFormat()

virtual void JawsMako::IXAMLGenerator::setPreferredMonoImageFormat ( IImageEncoderTransform::eEncodeFormat format)
pure virtual

Set the desired image format for monochrome images that need to be reencoded for XAML output. The default is eEFAuto. Note: this is advisory only and may not be honoured in all cases if the image cannot be represented in XPS in the desired form.

Parameters
formatThe desired format.

◆ setRenderResolution()

virtual void JawsMako::IXAMLGenerator::setRenderResolution ( uint32 resolution)
pure virtual

Set the resolution to use if page content requires rendering in order to be output as XAML. The default is 150dpi. This is affected also by the maximum image resolution parameters.

Parameters
resolutionThe desired resolution in dpi.

◆ setSubsetFonts()

virtual void JawsMako::IXAMLGenerator::setSubsetFonts ( bool subset)
pure virtual

Set whether fonts should be subset in the output.

     The default is false. Equivalent to calling setParameter with
     "SubsetFonts" as the parameter name.

     Note that all fonts may not be subsetted; for some subsetting may be
     forbidden, and for others there may be little gain in subsetting.

◆ setTargetColorSpace()

virtual void JawsMako::IXAMLGenerator::setTargetColorSpace ( const IDOMColorSpacePtr & targetSpace)
pure virtual

Set the target color space for the output. The default behaviour is to, where possible, leave the color space of objects unchanged.

Parameters
targetSpaceThe desired color space. Must be a simple or ICC space.

◆ setTargetProfile()

virtual void JawsMako::IXAMLGenerator::setTargetProfile ( const IDOMICCProfilePtr & profile)
pure virtual

Set the target color space for the output using an ICC profile. The default behaviour is to, where possible, leave the color space of objects unchanged.

Parameters
profileThe desired profile.

The documentation for this class was generated from the following file: