SVGRenderer class

SVGRenderer can be used to render geometric data using SVG. The produced vector graphics are particular useful in the following use cases:

  • Animated logos or icons
  • Interactive 2D/3D diagrams or graphs
  • Interactive maps
  • Complex or animated user interfaces

SVGRenderer has various advantages. It produces crystal-clear and sharp output which is independent of the actual viewport resolution.

SVG elements can be styled via CSS. And they have good accessibility since it's possible to add metadata like title or description (useful for search engines or screen readers).

There are, however, some important limitations:

  • No advanced shading
  • No texture support
  • No shadow support

Constructors

SVGRenderer.new({dynamic quality = SVGQuality.high, required double width, required double height, bool autoClear = false, int? precision, double overdraw = 0.5, bool edgeOnly = false})

Properties

autoClear bool
getter/setter pair
edgeOnly bool
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
height double
getter/setter pair
heightHalf double
getter/setter pair
info SVGRendererInfo
getter/setter pair
lights List<Light>?
getter/setter pair
overdraw double
getter/setter pair
precision int?
getter/setter pair
quality SVGQuality
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
size → Vector2
no setter
sortElements bool
getter/setter pair
sortObjects bool
getter/setter pair
svg SVGDocument
getter/setter pair
width double
getter/setter pair
widthHalf double
getter/setter pair

Methods

addPath(String style, String path) → void
calculateLight(List<Light> lights, Vector3 position, Vector3 normal, Color color) → void
calculateLights(List<Light> lights) → void
clear() → void
Tells the renderer to clear its drawing surface.
convert(num c) String
expand(Vector4 v1, Vector4 v2, double pixels) → void
flushPath() → void
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeChildNodes() → void
render(Scene scene, Camera camera) → void
Renders a scene using a camera.
renderFace3(RenderableVertex v1, RenderableVertex v2, RenderableVertex v3, RenderableFace element, Material material) → void
renderLine(RenderableVertex v1, RenderableVertex v2, Material material) → void
renderSprite(RenderableSprite v1, RenderableSprite element, Material material) → void
setClearColor(Color color) → void
Sets the clearColor and the clearAlpha.
setPixelRatio() → void
setPrecision(int precision) → void
Sets the precision of the data used to create a path.
setQuality(SVGQuality quality) → void
Sets the render quality. Possible values are low and high (default).
setSize(double width, double height) → void
Resizes the renderer to (width, height).
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited