Parasol Framework
  • Gallery
  • API
  • Wiki
  • GitHub
    • Audio
    • Core
    • Display
    • Fluid
    • Font
    • Network
    • Vector
    • Audio
    • Sound
    • File
    • MetaClass
    • Module
    • StorageDevice
    • Task
    • Thread
    • Time
    • Compression
    • Config
    • Script
    • XML
    • Controller
    • BlurFX
    • ColourFX
    • CompositeFX
    • ConvolveFX
    • DisplacementFX
    • FilterEffect
    • FloodFX
    • ImageFX
    • LightingFX
    • MergeFX
    • MorphologyFX
    • OffsetFX
    • RemapFX
    • SourceFX
    • TurbulenceFX
    • WaveFunctionFX
    • Scintilla
    • ScintillaSearch
    • Bitmap
    • Clipboard
    • Display
    • Document
    • Font
    • Picture
    • Pointer
    • Surface
    • SVG
    • ClientSocket
    • HTTP
    • NetSocket
    • Proxy
    • Vector
    • VectorClip
    • VectorColour
    • VectorEllipse
    • VectorFilter
    • VectorGradient
    • VectorGroup
    • VectorImage
    • VectorPath
    • VectorPattern
    • VectorPolygon
    • VectorRectangle
    • VectorScene
    • VectorShape
    • VectorSpiral
    • VectorText
    • VectorTransition
    • VectorViewport
    • VectorWave

VectorFilter Class

Constructs filter pipelines that alter rendered vector graphics.

The VectorFilter class allows post-effect filters to be applied to vectors as they are being rendered. Filter support is closely modelled around the SVG standard, and effect results are intended to match that of the standard. Once created, a filter can be utilised by vector objects through their Vector⇒Filter field. By way of example in SVG:

<circle cx="160" cy="50" r="40" fill="#f00" filter="url(#EffectPipeline)"/>

Filter pipelines are constructed from effects based on the FilterEffect class, such as CompositeFX and FloodFX. Construct a new pipeline by creating effect objects and placing them under the ownership of the VectorFilter that will be supporting them. The VectorFilter will automatically detect them and they will be processed in the order in which they are added. It is most optimal to create each pipeline in advance, and a new VectorFilter object should be created for each pipeline as necessary.

It is important to note that filter effects are CPU intensive tasks and real-time performance may be disappointing. If this is an issue, consider pre-rendering the filter effects in advance and caching the results in memory or files.

It is a requirement that VectorFilter objects are owned by the VectorScene they are targeting.

Structure

The VectorFilter class consists of the following fields:

Access
NameTypeComment
  AspectRatioVFAAspect ratio to use when scaling X/Y values
NameDescription
VFA::MEETScale X/Y values independently and in relation to the width/height of the parent viewport.
VFA::NONEScale X/Y values on a 1:1 basis, in relation to the diagonal of the parent viewport.
  ColourSpaceVCSThe colour space of the filter graphics (SRGB or linear RGB).

By default, colour filters are processed in SRGB format. This is the same colour space as used by the rest of the graphics system, which means that no special conversion is necessary prior to and post filter processing. However, linear RGB is better suited for producing high quality results at a cost of speed.

Note that if SVG compatibility is required, linear RGB must be used as the default.

NameDescription
VCS::INHERITInherit the colour space option from the parent vector.
VCS::LINEAR_RGBLinear RGB is the default colour space for SVG and produces the best results.
VCS::SRGBThe default colour-space is sRGB, recommended for its speed.
  DimensionsDMFDimension flags define whether individual dimension fields contain fixed or scaled values.

The following dimension flags are supported:

NameDescription
FIXED_XThe X value is a fixed coordinate.
FIXED_YThe Y value is a fixed coordinate.
SCALED_XThe X value is a scaled coordinate.
SCALED_YThe Y value is a scaled coordinate.
FIXED_WIDTHThe Width value is a fixed coordinate.
FIXED_HEIGHTThe Height value is a fixed coordinate.
SCALED_WIDTHThe Width value is a scaled coordinate.
SCALED_HEIGHTThe Height value is a scaled coordinate.
  EffectXMLSTRINGReturns a SVG XML string that defines the filter's effects.

This field value will return a purpose-built string that defines the filter's effects in SVG compliant XML. The string is allocated and must be freed once no longer in use.

  HeightDOUBLEThe height of the filter area. Can be expressed as a fixed or scaled coordinate.

The height of the filter area is expressed here as a fixed or scaled coordinate. The Width and Height effectively restrain the working space for the effect processing, making them an important consideration for efficiency.

The coordinate system for the width and height depends on the value for Units.

The default values for Width and Height is 120%, as per the SVG standard. This provides a buffer space for the filter algorithms to work with, and is usually a sufficient default.

  Inherit*VectorFilterInherit attributes from a VectorFilter referenced here.

Attributes can be inherited from another filter by referencing that gradient in this field. This feature is provided primarily for the purpose of simplifying SVG compatibility and its use may result in an unnecessary performance penalty.

  OpacityDOUBLEThe opacity of the filter.

The opacity of the filter is defined as a value between 0.0 and 1.0, with 1.0 being fully opaque. The default value is 1.0.

  PrimitiveUnitsVUNITAlters the behaviour of some effects that support alternative position calculations.

PrimitiveUnits alters the behaviour of some effects when their dimensions are calculated. The default value is USERSPACE. When set to BOUNDING_BOX, the effect may calculate its dimensions strictly based on the client vector using a scaled coordinate space of (0, 0, 100%, 100%).

NameDescription
VUNIT::BOUNDING_BOXCoordinates are scaled to the object's bounding box.
VUNIT::UNDEFINEDEither the default setting will be applied or the setting will be inherited from a parent object.
VUNIT::USERSPACECoordinates are scaled to the current viewport.
  ResXINTWidth of the intermediate images, measured in pixels.

The combination of ResX and ResY define the available space for rendering of filter effects. It is recommended that the client does not set these values because the default 1:1 pixel ratio is appropriate in the majority of circumstances.

  ResYINTHeight of the intermediate images, measured in pixels.

The combination of ResX and ResY define the available space for rendering of filter effects. It is recommended that the client does not set these values because the default 1:1 pixel ratio is appropriate in the majority of circumstances.

  UnitsVUNITDefines the coordinate system for X, Y, Width and Height.

The default coordinate system is BOUNDING_BOX, which positions the filter within the client vector. The alternative is USERSPACE, which positions the filter relative to the client vector's nearest viewport.

NameDescription
VUNIT::BOUNDING_BOXCoordinates are scaled to the object's bounding box.
VUNIT::UNDEFINEDEither the default setting will be applied or the setting will be inherited from a parent object.
VUNIT::USERSPACECoordinates are scaled to the current viewport.
  WidthDOUBLEThe width of the filter area. Can be expressed as a fixed or scaled coordinate.

The width of the filter area is expressed here as a fixed or scaled coordinate. The Width and Height effectively restrain the working space for the effect processing, making them an important consideration for efficiency.

The coordinate system for the width and height depends on the value for Units.

The default values for Width and Height is 120%, as per the SVG standard. This provides a buffer space for the filter algorithms to work with, and is usually a sufficient default.

  XDOUBLEX coordinate for the filter.

The meaning of the (X, Y) field values depend on the value for Units. In userspace mode, the filter position will be relative to the client vector's parent viewport. In bounding-box mode, the filter position is relative to the vector's position. It is important to note that coordinates are measured before any transforms are applied.

The default values for X and Y is 10%, as per the SVG standard. This provides a buffer space for the filter algorithms to work with, and is usually a sufficient default.

  YDOUBLEY coordinate for the filter.

The meaning of the (X, Y) field values depend on the value for Units. In userspace mode, the filter position will be relative to the client vector's parent viewport. In bounding-box mode, the filter position is relative to the vector's position. It is important to note that coordinates are measured before any transforms are applied.

The default values for X and Y is 10%, as per the SVG standard. This provides a buffer space for the filter algorithms to work with, and is usually a sufficient default.

Actions

The following actions are currently supported:

ClearRemoves all filter effects.
VectorFilter class documentation © Paul Manias © 2010-2025

DMF Type

NameDescription
DMF::FIXED_CENTER_XThe CenterX field is a fixed size.
DMF::FIXED_CENTER_YThe CenterY field is a fixed size.
DMF::FIXED_DEPTHThe Depth field is a fixed size.
DMF::FIXED_HEIGHTThe Height field is a fixed size.
DMF::FIXED_RADIUS_XThe RadiusX field is a fixed size.
DMF::FIXED_RADIUS_YThe RadiusY field is a fixed size.
DMF::FIXED_WIDTHThe Width field is a fixed suze.
DMF::FIXED_XThe X field is a fixed coordinate.
DMF::FIXED_X_OFFSETThe XOffset field is a fixed coordinate.
DMF::FIXED_YThe Y field is a fixed coordinate.
DMF::FIXED_Y_OFFSETThe YOffset field is a fixed coordinate.
DMF::FIXED_ZThe Z field is a fixed coordinate.
DMF::SCALED_CENTER_XThe CenterX field is scaled to this object's parent.
DMF::SCALED_CENTER_YThe CenterY field is scaled to this object's parent.
DMF::SCALED_DEPTHThe Depth field is scaled to this object's parent.
DMF::SCALED_HEIGHTThe Height field is scaled to this object's parent.
DMF::SCALED_RADIUS_XThe RadiusX field is scaled to this object's parent.
DMF::SCALED_RADIUS_YThe RadiusY field is a scaled size to this object's parent.
DMF::SCALED_WIDTHThe Width field is scaled to this object's parent.
DMF::SCALED_XThe X field is scaled to this object's parent.
DMF::SCALED_X_OFFSETThe XOffset field is scaled to this object's parent.
DMF::SCALED_YThe Y field is scaled to this object's parent.
DMF::SCALED_Y_OFFSETThe YOffset field is scaled to this object's parent.
DMF::SCALED_ZThe Z field is a scaled coordinate to this object's parent.
DMF::STATUS_CHANGE_H
DMF::STATUS_CHANGE_V
VectorFilter module documentation © Paul Manias © 2010-2025

VCS Type

Colour space options.

NameDescription
VCS::INHERITInherit the colour space option from the parent vector.
VCS::LINEAR_RGBLinear RGB is the default colour space for SVG and produces the best results.
VCS::SRGBThe default colour-space is sRGB, recommended for its speed.
VectorFilter module documentation © Paul Manias © 2010-2025

VFA Type

Define the aspect ratio for VectorFilter unit scaling.

NameDescription
VFA::MEETScale X/Y values independently and in relation to the width/height of the parent viewport.
VFA::NONEScale X/Y values on a 1:1 basis, in relation to the diagonal of the parent viewport.
VectorFilter module documentation © Paul Manias © 2010-2025

VUNIT Type

NameDescription
VUNIT::BOUNDING_BOXCoordinates are scaled to the object's bounding box.
VUNIT::UNDEFINEDEither the default setting will be applied or the setting will be inherited from a parent object.
VUNIT::USERSPACECoordinates are scaled to the current viewport.
VectorFilter module documentation © Paul Manias © 2010-2025