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

VectorScene Class

Manages the scene graph for a collection of vectors.

The VectorScene class acts as a container and control point for the management of vector definitions. Its main purpose is to draw the scene to a target Bitmap or Surface provided by the client.

Vector scenes are created by initialising multiple Vector objects such as VectorPath and VectorViewport and positioning them within a vector tree. The VectorScene must lie at the root of the tree.

The default mode of operation is for scenes to be manually drawn, for which the client must set the target Bitmap and call the Draw() action as required. Automated drawing can be enabled by setting the target Surface prior to initialisation. In automated mode the PageWidth and PageHeight will reflect the dimensions of the target surface at all times.

Vector definitions can be saved and loaded from permanent storage by using the SVG class.

Structure

The VectorScene class consists of the following fields:

Access
NameTypeComment
 Bitmap*BitmapTarget bitmap for drawing vectors.

The target bitmap to use when drawing the vectors must be specified here.

 FlagsVPFOptional flags.
NameDescription
VPF::BITMAP_SIZEDAutomatically adjust the VectorScene⇒PageWidth and VectorScene⇒PageHeight to match the target Bitmap⇒Width and Bitmap⇒Height.
VPF::OUTLINE_VIEWPORTSDraw a green outline around all viewport paths. Extremely useful for debugging layout issues.
VPF::RENDER_TIMECompute the drawing frame-rate for the RenderTime field.
VPF::RESIZEThe vector will be stretched to fit the VectorScene⇒PageWidth and VectorScene⇒PageHeight values, if defined by the client.
VPF::STABLE_RENDERUse rendering algorithms that are stable across all platforms.
 HostScene*VectorSceneRefers to a top-level VectorScene object, if applicable.

Set HostScene to another VectorScene object if it is intended that this scene is a child of the other. This allows some traits such as vector definitions to be automatically inherited from the host scene.

This feature is useful in circumstances where a hidden group of vectors need to be managed separately, while retaining access to established definitions and vectors in the main.

 PageHeightINTThe height of the page that contains the vector.

This value defines the pixel height of the page that contains the vector scene graph. If the RESIZE Flags option is used then the viewport will be scaled to fit within the page.

 PageWidthINTThe width of the page that contains the vector.

This value defines the pixel width of the page that contains the vector scene graph. If the RESIZE Flags option is used then the viewport will be scaled to fit within the page.

 RenderTimeINT64Returns the rendering time of the last scene.

RenderTime returns the rendering time of the last scene that was drawn, measured in microseconds. This value can also be used to compute frames-per-second with 1000000 / RenderTime.

The RENDER_TIME flag must be set before fetching this value, as it is required to enable the timing feature. If RENDER_TIME is not set, it will be set automatically so that subsequent calls return a correct value.

 SampleMethodVSMThe sampling method to use when interpolating images and patterns.

The SampleMethod controls the sampling algorithm that is used when images and patterns in the vector definition are affected by rotate, skew and scale transforms. The choice of method will have a significant impact on the speed and quality of the images that are displayed in the rendered scene. The recommended default is AUTO, which allows the drawing algorithms to choose the best quality option dynamically.

NameDescription
VSM::AUTOThe default option is chosen by the system. This will typically be BILINEAR, but slow machines may switch to nearest neighbour and high speed machines could use more advanced methods.
VSM::BESSELUses a broad Bessel filter that can preserve detail during resampling, but is slower than the smaller-kernel methods.
VSM::BICUBICProduces a similar result to BILINEAR at a slightly higher CPU cost and a marginally sharper after-effect.
VSM::BILINEARBilinear is a common algorithm that produces a reasonable quality image quickly.
VSM::BLACKMANFive times slower than BILINEAR, the final result will be less sharp than SINC.
VSM::GAUSSIANUses a Gaussian filter that softens the result, reducing aliasing at the cost of sharp edge detail.
VSM::KAISERUses a Kaiser-windowed filter, giving smooth interpolation with low ringing and a cost close to BILINEAR.
VSM::LANCZOSThis well known algorithm may serve as a point of comparison for evaluating the results of other methods. It shares characteristics with SINC and BLACKMAN.
VSM::MITCHELLUses a Mitchell-Netravali filter, balancing sharpness and smoothness at a cost similar to BICUBIC.
VSM::NEIGHBOURNearest neighbour is the fastest sampler at the cost of poor quality.
VSM::QUADRICUses a quadratic filter with a modest kernel, giving smoother results than BILINEAR with limited extra cost.
VSM::SINCFive times slower than BILINEAR, the final result is of very good quality.
VSM::SPLINE16About twice as slow as BILINEAR, this method samples a 4x4 area and produces a considerably better result, and is a good choice for enlarging images without producing artifacts when contrasting colours are present.
 SurfaceOBJECTIDMay refer to a Surface object for enabling automatic rendering.

Setting the Surface field will enable automatic rendering to a display Surface. The use of features such as input event handling and user focus management will also require an associated surface as a pre-requisite.

 Viewport*VectorViewportReferences the first object in the scene, which must be a VectorViewport object.

The first object in the vector scene is referenced here. It must belong to the VectorViewport class, which will be used to define the size and location of the area rendered by the scene.

The Viewport value cannot be set by the client. It will be automatically defined when the first VectorViewport owned by the VectorScene is initialised.

Actions

The following actions are currently supported:

DrawRenders the scene to a bitmap.
ERR acDraw(*Object, DOUBLE X, DOUBLE Y, DOUBLE Width, DOUBLE Height)
ParameterDescription
XThe X position of the region to be drawn.
YThe Y position of the region to be drawn.
WidthThe width of the region to be drawn.
HeightThe height of the region to be drawn.

The Draw action will render the scene to the target Bitmap immediately. If Bitmap is NULL, an error will be returned.

In addition, the RenderTime field will be updated if the RENDER_TIME flag is defined.

Error Codes
OkayOperation successful.
FieldNotSetThe Bitmap field is NULL.
FlushFlush buffered data from an object.
RedimensionRedefines the size of the page.
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.
ResetClears all registered definitions and resets field values. Child vectors are unmodified.
ResizeRedefines the size of the page.
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.

Methods

The following methods are currently supported:

AddDefRegisters a named definition object within a scene graph.
ERR sc::AddDef(OBJECTPTR Object, STRVIEW Name, OBJECTPTR Def)
ParameterDescription
NameThe unique name to associate with the definition.
DefReference to the definition object.

This method will add a new definition object to the root of a vector tree and gives it a name. This feature is provided to support SVG style referencing for features such as gradients, images and patterns. By providing a name with the definition object, the object can then be referenced in URL strings.

For example, if creating a gradient with a name of redGradient it would be possible to reference it with url(#redGradient) in common graphics attributes such as fill and stroke.

At the time of writing, the provided object must belong to one of the following classes to be valid: Vector, VectorScene, Gradient, VectorImage, VectorPath, VectorPattern, VectorFilter, VectorTransition, VectorClip.

Error Codes
OkayOperation successful.
UnsupportedOwnerThe definition is not owned by the scene.
ResourceExistsThe given name is already in use as a definition.
NullArgsFunction call missing argument value(s)
InvalidObjectThe definition is not an accepted object class.
DebugInternal functionality for debugging.
ERR sc::Debug(OBJECTPTR Object)

This internal method prints comprehensive information that describes the scene graph to the log.

Error Codes
OkayOperation successful.
FindDefSearch for a vector definition by name.
ERR sc::FindDef(OBJECTPTR Object, STRVIEW Name, OBJECTPTR * Def)
ParameterDescription
NameThe name of the definition.
DefA pointer to the definition object is returned here if discovered.

Use the FindDef method to search for a vector definition by name. A reference to the definition will be returned if the search is successful.

Definitions are created with the AddDef() method.

Error Codes
OkayOperation successful.
SearchA definition with the given Name was not found.
NullArgsFunction call missing argument value(s)
VectorScene class documentation © Paul Manias © 2010-2026

VPF Type

Optional flags for the VectorScene object.

NameDescription
VPF::BITMAP_SIZEDAutomatically adjust the VectorScene⇒PageWidth and VectorScene⇒PageHeight to match the target Bitmap⇒Width and Bitmap⇒Height.
VPF::OUTLINE_VIEWPORTSDraw a green outline around all viewport paths. Extremely useful for debugging layout issues.
VPF::RENDER_TIMECompute the drawing frame-rate for the RenderTime field.
VPF::RESIZEThe vector will be stretched to fit the VectorScene⇒PageWidth and VectorScene⇒PageHeight values, if defined by the client.
VPF::STABLE_RENDERUse rendering algorithms that are stable across all platforms.
VectorScene module documentation © Paul Manias © 2010-2026

VSM Type

NameDescription
VSM::AUTOThe default option is chosen by the system. This will typically be BILINEAR, but slow machines may switch to nearest neighbour and high speed machines could use more advanced methods.
VSM::BESSELUses a broad Bessel filter that can preserve detail during resampling, but is slower than the smaller-kernel methods.
VSM::BICUBICProduces a similar result to BILINEAR at a slightly higher CPU cost and a marginally sharper after-effect.
VSM::BILINEARBilinear is a common algorithm that produces a reasonable quality image quickly.
VSM::BLACKMANFive times slower than BILINEAR, the final result will be less sharp than SINC.
VSM::GAUSSIANUses a Gaussian filter that softens the result, reducing aliasing at the cost of sharp edge detail.
VSM::KAISERUses a Kaiser-windowed filter, giving smooth interpolation with low ringing and a cost close to BILINEAR.
VSM::LANCZOSThis well known algorithm may serve as a point of comparison for evaluating the results of other methods. It shares characteristics with SINC and BLACKMAN.
VSM::MITCHELLUses a Mitchell-Netravali filter, balancing sharpness and smoothness at a cost similar to BICUBIC.
VSM::NEIGHBOURNearest neighbour is the fastest sampler at the cost of poor quality.
VSM::QUADRICUses a quadratic filter with a modest kernel, giving smoother results than BILINEAR with limited extra cost.
VSM::SINCFive times slower than BILINEAR, the final result is of very good quality.
VSM::SPLINE16About twice as slow as BILINEAR, this method samples a 4x4 area and produces a considerably better result, and is a good choice for enlarging images without producing artifacts when contrasting colours are present.
VectorScene module documentation © Paul Manias © 2010-2026