Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


BuildVectorImage

Builds a sprite asset from a scene tessellation.
Read time 2 minutesLast updated 6 days ago

Definition

BuildVectorImage(IEnumerable<Geometry>, uint)

Builds a sprite asset from a scene tessellation.
public static VectorImage BuildVectorImage(IEnumerable<VectorUtils.Geometry> geoms, uint gradientResolution = 16)

Parameters

The list of tessellated Geometry instances

gradientResolution

The maximum size of the texture holding gradient data

Returns

Type

Description

VectorImageA new VectorImage containing the provided geometry. The VectorImage may have a texture if the geometry has any texture and/or gradients

Remarks

It is the caller's responsibility to destroy the returned VectorImage using Object.Destroy.

BuildVectorImage(SceneInfo)

Builds an antialiased VectorImage from a vector scene definition.
public static VectorImage BuildVectorImage(SVGParser.SceneInfo sceneInfo)

Parameters

sceneInfo

The SVGParser.SceneInfo to build the VectorImage from.

Returns

Type

Description

VectorImageA VectorImage constructed from the vector scene definition.

BuildVectorImage(SceneInfo, Rect)

Builds an antialiased VectorImage from a vector scene definition, preserving the specified viewport.
public static VectorImage BuildVectorImage(SVGParser.SceneInfo sceneInfo, Rect viewport)

Parameters

sceneInfo

The SVGParser.SceneInfo to build the VectorImage from.

viewport

The viewport rectangle to preserve on the resulting VectorImage. The scene contents are positioned relative to the viewport origin, and the resulting _size matches the viewport size. Pass _zero to compute the viewport from the scene contents.

Returns

Type

Description

VectorImageA VectorImage constructed from the vector scene definition.

Remarks

The viewport determines the size and offset of the resulting VectorImage, but does not clip its content: geometry falling outside the viewport is still included in the vertex data. To clip the scene to the viewport, assign a SceneNode.Clipper to SVGParser.SceneInfo.Scene's Scene.Root before calling this method.