Kōtuku
  • Gallery
  • API
  • Wiki
  • GitHub
    • Audio
    • Config
    • Core
    • Display
    • Document
    • Font
    • HTTP
    • Network
    • Regex
    • SVG
    • Tiri
    • Vector
    • XML
    • XQuery
    • XRandR
      • Audio
      • MP3
      • Sound
      • File
      • MetaClass
      • Module
      • StorageDevice
      • Task
      • Thread
      • Time
      • Compression
      • CompressedStream
      • Config
      • LZMAStream
      • Script
      • Tiri
      • XML
      • XQuery
      • Controller
      • BlurFX
      • ColourFX
      • CompositeFX
      • ConvolveFX
      • DisplacementFX
      • FilterEffect
      • FloodFX
      • ImageFX
      • LightingFX
      • MergeFX
      • MorphologyFX
      • OffsetFX
      • RemapFX
      • SourceFX
      • TurbulenceFX
      • WaveFunctionFX
      • Scintilla
      • Bitmap
      • Clipboard
      • Display
      • Document
      • Font
      • Image
      • Pointer
      • Surface
      • SVG
      • ClientSocket
      • HTTP
      • NetClient
      • NetLookup
      • NetServer
      • NetSocket
      • Proxy
      • Gradient
      • GradientConic
      • GradientContour
      • GradientDiamond
      • GradientDiffusion
      • GradientDistal
      • GradientGouraud
      • GradientLinear
      • GradientMesh
      • GradientRadial
      • GradientVoronoi
      • Vector
      • VectorClip
      • VectorColour
      • VectorEllipse
      • VectorFilter
      • VectorGradient
      • VectorGroup
      • VectorImage
      • VectorPath
      • VectorPattern
      • VectorPolygon
      • VectorRectangle
      • VectorScene
      • VectorShape
      • VectorSpiral
      • VectorText
      • VectorTransition
      • VectorViewport
      • VectorWave
      • Linux Builds
      • Windows Builds
      • Customising Your Build
      • Kōtuku Objects
      • Kōtuku In Depth
      • Kōtuku Design Patterns
      • Coding With AI
      • Regex Manual
      • XML Comparisons
      • Tiri Reference Manual
      • Config API
      • Defer Syntax
      • GUI API
      • HTTP Server API
      • I/O API
      • JSON API
      • OAuth API
      • Options API
      • Proxy Server API
      • Tempus API
      • URL API
      • VFX API
      • Widgets
      • RIPL Reference Manual
      • Origo
      • Flute / Unit Testing
      • Tuku
      • Embedded Document Format
      • TDL Reference Manual
      • TDL Tools
      • Action Reference Manual
      • System Error Codes

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.

 AspectRatioARFFlags 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.

 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.

 HeightUNITThe 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.

 OverflowVOFClipping 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.

NameDescription
VOF::HIDDENAll content is clipped to within the viewport's boundary.
VOF::INHERITThe overflow state is inherited from the parent.
VOF::SCROLLAll content is clipped to within the viewport's boundary. A mechanism to scroll the viewport's content may be provided to the user (SVG capability not currently implemented).
VOF::VISIBLEThe content is not clipped to the viewport's boundary. This is the default.
 OverflowXVOFClipping 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.

NameDescription
VOF::HIDDENAll content is clipped to within the viewport's boundary.
VOF::INHERITThe overflow state is inherited from the parent.
VOF::SCROLLAll content is clipped to within the viewport's boundary. A mechanism to scroll the viewport's content may be provided to the user (SVG capability not currently implemented).
VOF::VISIBLEThe content is not clipped to the viewport's boundary. This is the default.
 OverflowYVOFClipping 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.

NameDescription
VOF::HIDDENAll content is clipped to within the viewport's boundary.
VOF::INHERITThe overflow state is inherited from the parent.
VOF::SCROLLAll content is clipped to within the viewport's boundary. A mechanism to scroll the viewport's content may be provided to the user (SVG capability not currently implemented).
VOF::VISIBLEThe content is not clipped to the viewport's boundary. This is the default.
 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).

 WidthUNITThe 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.

 XUNITPositions 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.

 XOffsetUNITPositions 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.

 YUNITPositions 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.

 YOffsetUNITPositions 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-2026

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-2026

VOF Type

Viewport overflow options.

NameDescription
VOF::HIDDENAll content is clipped to within the viewport's boundary.
VOF::INHERITThe overflow state is inherited from the parent.
VOF::SCROLLAll content is clipped to within the viewport's boundary. A mechanism to scroll the viewport's content may be provided to the user (SVG capability not currently implemented).
VOF::VISIBLEThe content is not clipped to the viewport's boundary. This is the default.
VectorViewport module documentation © Paul Manias © 2010-2026