BuildVectorImage
Builds a sprite asset from a scene tessellation.
Read time 2 minutesLast updated 6 days ago
Definition
- Type: Method
- Namespace: Unity.VectorGraphics
- Assembly: UnityEngine.VectorGraphicsModule
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
The maximum size of the texture holding gradient data
Returns
Type | Description |
|---|---|
| VectorImage | A 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
The SVGParser.SceneInfo to build the VectorImage from.
Returns
Type | Description |
|---|---|
| VectorImage | A 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
The SVGParser.SceneInfo to build the VectorImage from.
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 |
|---|---|
| VectorImage | A 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.