Skip to content

VectorCanvas

Overview

Similar to an DOM Canvas, but stores a vector representation of the relevant drawing commands.

TODO TODO: This should be done instead in the rational-half-edge space, so we get better exactness on the repeated TODO: CAG. What is causing the issues?

TODO: We really would want to "cache" all of the commands at once, build up a "pending" RenderProgram, and then TODO: handle all the paths at once.

@author Jonathan Olson <jonathan.olson@colorado.edu>

Class VectorCanvas

import { VectorCanvas } from 'scenerystack/alpenglow';

Constructor

new VectorCanvas( width : number, height : number, colorSpace : 'srgb' | 'display-p3', polygonFiltering : PolygonFilterType )

Instance Methods

fillColor( renderPath : RenderPath, color : Vector4 )

Assumes sRGB? We'll do srgb-linear blending to mimic for now?

fillLinearGradient( renderPath : RenderPath, start : Vector2, end : Vector2, stops : { ratio: number; color: Vector4 }[], extend : RenderExtend, accuracy : RenderLinearGradientAccuracy )

fillRadialGradient( renderPath : RenderPath, transform : Matrix3, start : Vector2, startRadius : number, end : Vector2, endRadius : number, stops : { ratio: number; color: Vector4 }[], extend : RenderExtend, accuracy : RenderRadialGradientAccuracy )

copy() : VectorCanvas

updateWidthHeight( width : number, height : number )

getImageData( options? : CombinedRasterOptions ) : ImageData

getCanvas( options? : CombinedRasterOptions ) : HTMLCanvasElement

Instance Properties

renderableFaces : RenderableFace[]

bounds : Bounds2

gridBounds : Bounds2

Source Code

See the source for VectorCanvas.ts in the alpenglow repository.