Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Transforms in Mako are classes that perform a specific task on a single object or group of objects.

For example, there are transforms for:

  • Image downsampling (IImageDownsamplerTransform)
  • Color conversion (IColorConverterTransform)
  • Color simplification (IComplexColorSimplifierTransform)
  • Image merging (IImageMergerTransform)
  • Remove non-visible Optional Content (IOptionalContentFixerTransformPtr)

Some of these are complex operarations involving a number of steps. Transforms simplify such operations.

Custom Transform header

A framework to enable development of external, custom transforms is provided as a header, customtransform.h.

However, it's not part of the standard distribution, but can be downloaded from the link shown on the right of this page. Note that there are two versions, one for pre-Mako 4.8 and another for Mako 4.8. Mako 4.8 introduces a mechanism for aborting a transform operation, so the Mako 4.8 header must be used with Mako 4.8.

A custom transform implements call backs

Callback interface that provides methods for actually doing the work.

* Override the cases you are interested in.




IAnnotationAppearance

Annotation appearance

IDOMColor

Color

IDOMColorSpace

Color space

IDOMImage

Base class describing an image

IDOMNodePtr


IDOMFixedPagePtr


IDOMGroupPtr


IDOMCharPathGroupPtr


IDOMTransparencyGroupPtr


IDOMCanvasPtr


IDOMGlyphsPtr


IDOMFontPtr


IDOMPathNodePtr


IDOMVisualRootPtr


IDOMFormPtr


IDOMFormInstancePtr


IDOMBrushPtr


IDOMSolidColorBrushPtr


IDOMGradientBrushPtr


IDOMLinearGradientBrushPtr


IDOMRadialGradientBrushPtr


IDOMVisualBrushPtr


IDOMImageBrushPtr


IDOMTilingPatternBrushPtr


IDOMShadingPatternBrushPtr


IDOMSoftMaskBrushPtr


IDOMMaskedBrushPtr


IDOMNullBrushPtr




Operation

customtransform: IImplementation
class ICustomTransform : public ITransform
    {
      public:
        virtual ~ICustomTransform() {}

        /**
        * @brief  Callback interface that provides methods for actually doing the work.
        *         Override the cases you are interested in.
        */
        class IImplementation
        {
        public:
            virtual ~IImplementation() {}

            virtual void transformAnnotation(IImplementation *genericImplementation, const IAnnotationPtr &annotation)
            {
                genericImplementation->transformAnnotation(NULL, annotation);
            }

            virtual IAnnotationAppearancePtr transformAnnotationAppearance(IImplementation *genericImplementation, const IAnnotationAppearancePtr &appearance, const FRect &annotationRect)
            {
                return genericImplementation->transformAnnotationAppearance(NULL, appearance, annotationRect);
            }

            virtual IDOMColorPtr transformColor(IImplementation *genericImplementation, const IDOMColorPtr &color, const CTransformState &state)
            {
                return genericImplementation->transformColor(NULL, color, state);
            }

            virtual IDOMColorSpacePtr transformColorSpace(IImplementation *genericImplementation, const IDOMColorSpacePtr &colorSpace, const CTransformState &state)
            {
                return genericImplementation->transformColorSpace(NULL, colorSpace, state);
            }

            virtual IDOMImagePtr transformImage(IImplementation *genericImplementation, const IDOMImagePtr &image, const CTransformState &state)
            {
                return genericImplementation->transformImage(NULL, image, state);
            }

            virtual IDOMNodePtr transformNode(IImplementation *genericImplementation, const IDOMNodePtr &node, bool &changed, bool transformChildren, const CTransformState &state)
            {
                return genericImplementation->transformNode(NULL, node, changed, transformChildren, state);
            }

            virtual IDOMNodePtr transformFixedPage(IImplementation *genericImplementation, const IDOMFixedPagePtr &page, bool &changed, bool transformChildren, const CTransformState &state)
            {
                return genericImplementation->transformFixedPage(NULL, page, changed, transformChildren, state);
            }

            virtual IDOMNodePtr transformGroup(IImplementation *genericImplementation, const IDOMGroupPtr &group, bool &changed, bool transformChildren, const CTransformState &state)
            {
                return genericImplementation->transformGroup(NULL, group, changed, transformChildren, state);
            }

            virtual IDOMNodePtr transformCharPathGroup(IImplementation *genericImplementation, const IDOMCharPathGroupPtr &group, bool &changed, bool transformChildren, const CTransformState &state)
            {
                return genericImplementation->transformCharPathGroup(NULL, group, changed, transformChildren, state);
            }

            virtual IDOMNodePtr transformTransparencyGroup(IImplementation *genericImplementation, const IDOMTransparencyGroupPtr &group, bool &changed, bool transformChildren, const CTransformState &state)
            {
                return genericImplementation->transformTransparencyGroup(NULL, group, changed, transformChildren, state);
            }

            virtual IDOMNodePtr transformCanvas(IImplementation *genericImplementation, const IDOMCanvasPtr &canvas, bool &changed, bool transformChildren, const CTransformState &state)
            {
                return genericImplementation->transformCanvas(NULL, canvas, changed, transformChildren, state);
            }

            virtual IDOMNodePtr transformGlyphs(IImplementation *genericImplementation, const IDOMGlyphsPtr &glyphs, bool &changed, const CTransformState &state)
            {
                return genericImplementation->transformGlyphs(NULL, glyphs, changed, state);
            }

            virtual IDOMFontPtr transformFont(IImplementation *genericImplementation, const IDOMFontPtr &font, uint32 &index, const CTransformState &state)
            {
                return genericImplementation->transformFont(NULL, font, index, state);
            }

            virtual IDOMNodePtr transformPath(IImplementation *genericImplementation, const IDOMPathNodePtr &path, bool &changed, const CTransformState &state)
            {
                return genericImplementation->transformPath(NULL, path, changed, state);
            }

            virtual IDOMNodePtr transformVisualRoot(IImplementation *genericImplementation, const IDOMVisualRootPtr &root, bool &changed, bool transformChildren, const CTransformState &state)
            {
                return genericImplementation->transformVisualRoot(NULL, root, changed, transformChildren, state);
            }

            virtual IDOMNodePtr transformForm(IImplementation *genericImplementation, const IDOMFormPtr &form, bool &changed, bool transformChildren, const CTransformState &state)
            {
                return genericImplementation->transformForm(NULL, form, changed, transformChildren, state);
            }

            virtual IDOMNodePtr transformFormInstance(IImplementation *genericImplementation, const IDOMFormInstancePtr &instance, bool &changed, bool transformChildren, const CTransformState &state)
            {
                return genericImplementation->transformFormInstance(NULL, instance, changed, transformChildren, state);
            }

            virtual IDOMBrushPtr transformBrush(IImplementation *genericImplementation, const IDOMBrushPtr &brush, eBrushUsage usage, const CTransformState &state)
            {
                return genericImplementation->transformBrush(NULL, brush, usage, state);
            }

            virtual IDOMBrushPtr transformSolidColorBrush(IImplementation *genericImplementation, const IDOMSolidColorBrushPtr &brush, const CTransformState &state)
            {
                return genericImplementation->transformSolidColorBrush(NULL, brush, state);
            }

            virtual IDOMBrushPtr transformGradientBrush(IImplementation *genericImplementation, const IDOMGradientBrushPtr &gradient, const CTransformState &state)
            {
                return genericImplementation->transformGradientBrush(NULL, gradient, state);
            }

            virtual IDOMBrushPtr transformLinearGradientBrush(IImplementation *genericImplementation, const IDOMLinearGradientBrushPtr &gradient, const CTransformState &state)
            {
                return genericImplementation->transformLinearGradientBrush(NULL, gradient, state);
            }

            virtual IDOMBrushPtr transformRadialGradientBrush(IImplementation *genericImplementation, const IDOMRadialGradientBrushPtr &gradient, const CTransformState &state)
            {
                return genericImplementation->transformRadialGradientBrush(NULL, gradient, state);
            }

            virtual IDOMBrushPtr transformVisualBrush(IImplementation *genericImplementation, const IDOMVisualBrushPtr &brush, const CTransformState &state)
            {
                return genericImplementation->transformVisualBrush(NULL, brush, state);
            }

            virtual IDOMBrushPtr transformImageBrush(IImplementation *genericImplementation, const IDOMImageBrushPtr &brush, const CTransformState &state)
            {
                return genericImplementation->transformImageBrush(NULL, brush, state);
            }

            virtual IDOMBrushPtr transformTilingPatternBrush(IImplementation *genericImplementation, const IDOMTilingPatternBrushPtr &brush, const CTransformState &state)
            {
                return genericImplementation->transformTilingPatternBrush(NULL, brush, state);
            }

            virtual IDOMBrushPtr transformShadingPatternBrush(IImplementation *genericImplementation, const IDOMShadingPatternBrushPtr &brush, const CTransformState &state)
            {
                return genericImplementation->transformShadingPatternBrush(NULL, brush, state);
            }

            virtual IDOMBrushPtr transformSoftMaskBrush(IImplementation *genericImplementation, const IDOMSoftMaskBrushPtr &brush, const CTransformState &state)
            {
                return genericImplementation->transformSoftMaskBrush(NULL, brush, state);
            }

            virtual IDOMBrushPtr transformMaskedBrush(IImplementation *genericImplementation, const IDOMMaskedBrushPtr &brush, const CTransformState &state)
            {
                return genericImplementation->transformMaskedBrush(NULL, brush, state);
            }

            virtual IDOMBrushPtr transformNullBrush(IImplementation *genericImplementation, const IDOMNullBrushPtr &brush, CTransformState &state)
            {
                return genericImplementation->transformNullBrush(NULL, brush, state);
            }

        };

        
        /**
         * @class    JawsMako
         * @ingroup  IDisposable
         * @brief    Interface that must be supported by disposable objects
         */
        class IDisposable
        {
            public:
                /**
                 * @brief   Free the current object 
                 */
                virtual void dispose() = 0; 
        };

        /**
         *  @ingroup JawsMako
         *  @brief   Create an ICustomTransform object whose underlying methods are supported by the implementation object.
         *
         *           If the implementation object also implements the IDisposable interface then this object will take ownership
         *           of the implementation object and will call IDispose::dispose() to destroy the object.
         *           If the implementation object does not support the IDisposable interface then it's lifetime should be managed 
         *           by the caller. 
         */
        static JAWSMAKO_API ICustomTransformPtr create(const IJawsMakoPtr &jawsMako, 
                                                       IImplementation *implementation,
                                                       const IAbortPtr &abort = IAbortPtr (),
                                                       bool dependsOnClipBounds = true,
                                                       bool dependsOnGroupSpace = true,
                                                       bool dependsOnRenderingIntent = true,
                                                       bool dependsOnTransform = true,
                                                       bool dependsOnBrushUsage = true,
                                                       bool dependsOnEdgeMode = true,
                                                       bool dependsOnUncoloredTilingBrush = true);
    };
}





Custom Transform headers

Mako 4.7 or earlierMako 4.8
  • No labels