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

VectorViewport Class

Provides support for viewport definitions within a vector tree.

This class is used to declare a viewport within a vector scene graph. A master viewport is required as the first object in a VectorScene and it must contain all vector graphics content.

The size of the viewport is initially set to (0,0,100%,100%) so as to be all inclusive. Setting the X, Y, Width and Height fields will determine the position and clipping of the displayed content (the 'target area'). The ViewX, ViewY, ViewWidth and ViewHeight fields declare the viewbox ('source area') that will be sampled for the target.

To configure the scaling and alignment method that is applied to the viewport content, set the AspectRatio field.

Structure

The VectorViewport class consists of the following fields:

Access
NameTypeComment
  AbsXINTThe horizontal position of the viewport, relative to (0, 0).

This field will return the left-most boundary of the viewport, relative to point (0, 0) of the scene graph. Transforms are taken into consideration when calculating this value.

  AbsYINTThe vertical position of the viewport, relative to (0, 0).

This field will return the top-most boundary of the viewport, relative to point (0, 0) of the scene graph. Transforms are taken into consideration when calculating this value.

  AspectRatioINTFlags that affect the aspect ratio of vectors within the viewport.

Defining an aspect ratio allows finer control over the position and scale of the viewport's content within its target area.

NameDescription
ARF::MEETAspect ratio is preserved. The entire viewbox will be visible in the viewport. The viewbox is scaled up as much as possible.
ARF::NONEScale the viewbox to match the size of the viewport. Aspect ratio is not preserved.
ARF::SLICEAspect ratio is preserved. The viewbox can extend beyond the viewport's edges on one axis. The viewbox is scaled up as much as possible.
ARF::X_MAXAlign to the right.
ARF::X_MIDAlign to the horizontal center.
ARF::X_MINAlign to the left.
ARF::Y_MAXAlign to the bottom.
ARF::Y_MIDAlign to the vertical center.
ARF::Y_MINAlign to the top.
  BufferOBJECTPTRReturns the bitmap buffer that the viewport is using.
  BufferedINTSet to true if the viewport should buffer its content.

Viewport buffering is enabled by setting this field to true prior to initialisation. A Bitmap buffer will be created at the first drawing operation, and is available for the client to read from the Buffer field.

Potential reasons for enabling viewport buffering include: 1. Allows the client to read the rendered graphics directly from the Buffer; 2. Overall rendering will be faster if the content of the viewport rarely changes; 3. The use of multiple buffers can improve threaded rendering.

Buffering comes at a cost of using extra memory, and rendering may be less efficient if the buffered content changes frequently (e.g. is animated). Buffering also enforces overflow (clipping) restrictions, equivalent to Overflow being permanently set to HIDDEN.

  DimensionsINTDimension flags define whether individual dimension fields contain fixed or scaled values.
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
  DragCallbackFUNCTIONReceiver for drag requests originating from the viewport.

Set the DragCallback field with a callback function to receive drag requests from the viewport's user input. When the user drags the viewport, the callback will receive the user's desired (X, Y) target coordinates. For unimpeded dragging, have the callback set the viewport's X and Y values to match the incoming coordinates, then redraw the scene.

The prototype for the callback function is as follows, where OriginX and OriginY refer to the (X,Y) position of the vector at initiation of the drag.

void function(*VectorViewport, DOUBLE X, DOUBLE Y, DOUBLE OriginX, DOUBLE OriginY)

Setting this field to NULL will turn off the callback.

It is required that the parent VectorScene is associated with a Surface for this feature to work.

  HeightDOUBLEThe height of the viewport's target area.

The height of the viewport's target area is defined here as a fixed or scaled value. The default value is 100% for full coverage.

The fixed value is always returned when retrieving the height.

  OverflowINTClipping options for the viewport's boundary.

Choose an overflow option to enforce or disable clipping of the viewport's content. The default state is VISIBLE. Altering the overflow state affects both the X and Y axis. To set either axis independently, set OverflowX and OverflowY.

If the viewport's AspectRatio is set to SLICE then it will have priority over the overflow setting.

  OverflowXINTClipping options for the viewport's boundary on the x axis.

Choose an overflow option to enforce or disable clipping of the viewport's content. The default state is VISIBLE. If the viewport's AspectRatio is set to SLICE then it will have priority over the overflow setting.

This option controls the x axis only.

  OverflowYINTClipping options for the viewport's boundary on the y axis.

Choose an overflow option to enforce or disable clipping of the viewport's content. The default state is VISIBLE. If the viewport's AspectRatio is set to SLICE then it will have priority over the overflow setting.

This option controls the y axis only.

  ViewHeightDOUBLEThe height of the viewport's source area.

The area defined by (ViewX,ViewY) and (ViewWidth,ViewHeight) declare the source area covered by the viewport. The rendered graphics in the source area will be repositioned and scaled to the area defined by (X,Y) and (Width,Height).

  ViewWidthDOUBLEThe width of the viewport's source area.

The area defined by (ViewX,ViewY) and (ViewWidth,ViewHeight) declare the source area covered by the viewport. The rendered graphics in the source area will be repositioned and scaled to the area defined by (X,Y) and (Width,Height).

  ViewXDOUBLEThe horizontal position of the viewport's source area.

The area defined by (ViewX,ViewY) and (ViewWidth,ViewHeight) declare the source area covered by the viewport. The rendered graphics in the source area will be repositioned and scaled to the area defined by (X,Y) and (Width,Height).

  ViewYDOUBLEThe vertical position of the viewport's source area.

The area defined by (ViewX,ViewY) and (ViewWidth,ViewHeight) declare the source area covered by the viewport. The rendered graphics in the source area will be repositioned and scaled to the area defined by (X,Y) and (Width,Height).

  WidthDOUBLEThe width of the viewport's target area.

The width of the viewport's target area is defined here as a fixed or scaled value. The default value is 100% for full coverage.

  XDOUBLEPositions the viewport on the x-axis.

The display position targeted by the viewport is declared by the (X,Y) field values. Coordinates can be expressed as fixed or scaled pixel units.

If an offset from the edge of the parent is desired, the XOffset field must be defined. If a X and XOffset value are defined together, the width of the viewport is computed on-the-fly and will change in response to the parent's width.

  XOffsetDOUBLEPositions the viewport on the x-axis.

The display position targeted by the viewport is declared by the (X,Y) field values. Coordinates can be expressed as fixed or scaled pixel units.

If an offset from the edge of the parent is desired, the XOffset field must be defined. If the X and XOffset values are defined together, the width of the viewport is computed on-the-fly and will change in response to the parent's width.

  YDOUBLEPositions the viewport on the y-axis.

The display position targeted by the viewport is declared by the (X,Y) field values. Coordinates can be expressed as fixed or scaled pixel units.

If an offset from the edge of the parent is desired, the YOffset must be defined. If the Y and YOffset values are defined together, the height of the viewport is computed on-the-fly and will change in response to the parent's height.

  YOffsetDOUBLEPositions the viewport on the y-axis.

The display position targeted by the viewport is declared by the (X,Y) field values. Coordinates can be expressed as fixed or scaled pixel units.

If an offset from the edge of the parent is desired, the YOffset must be defined. If a Y and YOffset value are defined together, the height of the viewport is computed on-the-fly and will change in response to the parent's height.

Actions

The following actions are currently supported:

ClearFree all child objects contained by the viewport.
MoveMove the position of the viewport by delta X, Y.
ERR acMove(*Object, DOUBLE DeltaX, DOUBLE DeltaY, DOUBLE DeltaZ)
ParameterDescription
DeltaXThe number of units to move along the X axis.
DeltaYThe number of units to move along the Y axis.
DeltaZThe number of units to move along the Z axis.
MoveToPointMove the position of the viewport to a fixed point.
ERR acMoveToPoint(*Object, DOUBLE X, DOUBLE Y, DOUBLE Z, MTF Flags)
ParameterDescription
XThe new X position to move the object to.
YThe new Y position to move the object to.
ZThe new Z position to move the object to.
FlagsSet the relevant MTF flag for each provided parameter.
RedimensionReposition and resize a viewport to a fixed size.
ERR acRedimension(*Object, DOUBLE X, DOUBLE Y, DOUBLE Z, DOUBLE Width, DOUBLE Height, DOUBLE Depth)
ParameterDescription
XThe new X position to apply to the target object.
YThe new Y position to apply to the target object.
ZThe new Z position to apply to the target object.
WidthThe new width of the target object.
HeightThe new height of the target object.
DepthThe new depth of the target object.
ResizeResize a viewport to a fixed size.
ERR acResize(*Object, DOUBLE Width, DOUBLE Height, DOUBLE Depth)
ParameterDescription
WidthThe new width of the object.
HeightThe new height of the object.
DepthThe new depth of the object.
VectorViewport class documentation © Paul Manias © 2010-2025

ARC Type

Options for drawing arcs.

NameDescription
ARC::LARGEThe arc will take the longest available drawing path rather than the shortest.
ARC::SWEEPInverts the default behaviour in generating the arc path (go clockwise).
VectorViewport module documentation © Paul Manias © 2010-2025

ARF Type

Aspect ratios control alignment, scaling and clipping.

NameDescription
ARF::MEETAspect ratio is preserved. The entire viewbox will be visible in the viewport. The viewbox is scaled up as much as possible.
ARF::NONEScale the viewbox to match the size of the viewport. Aspect ratio is not preserved.
ARF::SLICEAspect ratio is preserved. The viewbox can extend beyond the viewport's edges on one axis. The viewbox is scaled up as much as possible.
ARF::X_MAXAlign to the right.
ARF::X_MIDAlign to the horizontal center.
ARF::X_MINAlign to the left.
ARF::Y_MAXAlign to the bottom.
ARF::Y_MIDAlign to the vertical center.
ARF::Y_MINAlign to the top.
VectorViewport module 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
VectorViewport module documentation © Paul Manias © 2010-2025

FontMetrics Structure

Font metrics, measured in pixels relative to the display

FieldTypeDescription
HeightINTCapitalised font height
LineSpacingINTVertical advance from one line to the next
AscentINTHeight from the baseline to the top of the font, including accents.
DescentINTHeight from the baseline to the bottom of the font
VectorViewport class documentation © Paul Manias © 2010-2025

VectorMatrix Structure

Vector transformation matrix.

FieldTypeDescription
Nextstruct VectorMatrix *The next transform in the list.
VectorobjVector *The vector associated with the transform.
ScaleXDOUBLEMatrix value A
ShearYDOUBLEMatrix value B
ShearXDOUBLEMatrix value C
ScaleYDOUBLEMatrix value D
TranslateXDOUBLEMatrix value E
TranslateYDOUBLEMatrix value F
TagINTAn optional tag value defined by the client for matrix identification.
VectorViewport class documentation © Paul Manias © 2010-2025

VectorPainter Structure

Deserialised painter information; compliant with SVG painter definitions.

FieldTypeDescription
PatternobjVectorPattern *A VectorPattern object, suitable for pattern based fills.
ImageobjVectorImage *A VectorImage object, suitable for image fills.
GradientobjVectorGradient *A VectorGradient object, suitable for gradient fills.
Colourstruct FRGBA single RGB colour definition, suitable for block colour fills.
VectorViewport class documentation © Paul Manias © 2010-2025