Skip to main content

Canvas API Reference

Class: Canvas

namespace EvolveUI.Rendering
public unsafe class Canvas : IDisposable

HTML5-style Canvas API for 2D vector graphics rendering.

Constructor

public Canvas(UIAssetManager assetManager)

Creates a new Canvas instance.

ParameterTypeDescription
assetManagerUIAssetManagerThe asset manager providing font library access

State Management

Save

public void Save()

Saves the current drawing state (transform, colors, styles) onto a stack.

Restore

public void Restore()

Restores the most recently saved drawing state from the stack.

Reset

public void Reset()

Resets the entire canvas state to defaults.

Clear

public void Clear()

Clears all generated geometry data.


Fill Styles

SetFillColor

public void SetFillColor(byte r, byte g, byte b, byte a = 255)
public void SetFillColor(Color32 color)
public void SetFillColor(float r, float g, float b, float a = 1f)
public void SetFillColor(Color color)

Sets the fill color using various formats. All inputs are interpreted as sRGB and converted to linear internally.

ParameterTypeDescription
r, g, b, abyte or floatColor components (0-255 or 0.0-1.0)
colorColor32 or ColorUnity color value

SetLinearGradient

public void SetLinearGradient(float sx, float sy, float ex, float ey, Color32 startColor, Color32 endColor)
public void SetLinearGradient(float sx, float sy, float ex, float ey, ColorStop[] colorStops)

Sets a linear gradient fill.

ParameterTypeDescription
sx, syfloatGradient start point
ex, eyfloatGradient end point
startColorColor32Color at start (t=0)
endColorColor32Color at end (t=1)
colorStopsColorStop[]Array of color stops for multi-stop gradients

SetRadialGradient

public void SetRadialGradient(float cx, float cy, float radius, Color32 innerColor, Color32 outerColor)
public void SetRadialGradient(float x0, float y0, float r0, float x1, float y1, float r1, Color32 innerColor, Color32 outerColor)
public void SetRadialGradient(float x0, float y0, float r0, float x1, float y1, float r1, ColorStop[] colorStops)

Sets a radial gradient fill.

ParameterTypeDescription
cx, cyfloatCenter point (simple form)
radiusfloatGradient radius (simple form)
x0, y0, r0floatInner circle center and radius
x1, y1, r1floatOuter circle center and radius
innerColorColor32Color at center/inner circle
outerColorColor32Color at edge/outer circle
colorStopsColorStop[]Array of color stops

SetConicGradient

public void SetConicGradient(float cx, float cy, float startAngle, Color32 startColor, Color32 endColor)
public void SetConicGradient(float cx, float cy, float startAngle, ColorStop[] colorStops)

Sets a conic (sweep) gradient fill.

ParameterTypeDescription
cx, cyfloatCenter point
startAnglefloatStart angle in radians
startColorColor32Color at start angle
endColorColor32Color at end (360 degrees)
colorStopsColorStop[]Array of color stops

SetFillGradient

public void SetFillGradient(CanvasGradient gradient)

Sets the fill style to use a gradient object.

ParameterTypeDescription
gradientCanvasGradientA pre-configured gradient object

Stroke Styles

SetStrokeColor

public void SetStrokeColor(byte r, byte g, byte b, byte a = 255)
public void SetStrokeColor(Color32 color)
public void SetStrokeColor(Color color)

Sets the stroke color.

SetStrokeGradient

public void SetStrokeGradient(CanvasGradient gradient)

Sets the stroke style to use a gradient object.

SetStrokeLinearGradient

public void SetStrokeLinearGradient(float sx, float sy, float ex, float ey, Color32 startColor, Color32 endColor)

Sets a linear gradient stroke.

SetStrokeRadialGradient

public void SetStrokeRadialGradient(float cx, float cy, float radius, Color32 innerColor, Color32 outerColor)

Sets a radial gradient stroke.

SetStrokeConicGradient

public void SetStrokeConicGradient(float cx, float cy, float startAngle, Color32 startColor, Color32 endColor)

Sets a conic gradient stroke.

SetStrokeWidth

public void SetStrokeWidth(float width)

Sets the stroke width in pixels.

SetStrokeCapType

public void SetStrokeCapType(StrokeCapType capType)

Sets the line cap style.

SetStrokeJoinType

public void SetStrokeJoinType(StrokeJoinType joinType)

Sets the line join style.

SetStrokeMiterLimit

public void SetStrokeMiterLimit(float limit)

Sets the miter limit for line joins.

SetDashPattern

public void SetDashPattern(float[] dashes, float offset = 0f)
public void SetDashPattern(float dash0, float dash1, float dash2 = 0f, float dash3 = 0f)

Sets a dash pattern for strokes. Supports up to 4 dash values.

ParameterTypeDescription
dashesfloat[]Array of dash lengths (max 4)
offsetfloatStarting offset into pattern
dash0-dash3floatIndividual dash values (0 = unused)

Pattern/Texture Styles

SetPatternTexture

public void SetPatternTexture(TextureId textureId, int atlasX = 0, int atlasY = 0, int atlasWidth = 0, int atlasHeight = 0)

Sets a pattern texture for fills and strokes.

ParameterTypeDescription
textureIdTextureIdTexture identifier
atlasX, atlasYintSub-region position (0 = full texture)
atlasWidth, atlasHeightintSub-region size (0 = full texture)

SetPatternMode

public void SetPatternMode(PatternSpace space, PatternSizing sizing, PatternRepeat repeat)

Sets the pattern coordinate space, sizing mode, and repeat behavior.

ParameterTypeDescription
spacePatternSpaceBounds or World
sizingPatternSizingStretch, Contain, Cover, or Tile
repeatPatternRepeatNoRepeat, Repeat, RepeatX, or RepeatY

SetPatternTileSize

public void SetPatternTileSize(float width, float height)

Sets the tile size for PatternSizing.Tile mode.

SetPatternPosition

public void SetPatternPosition(float x, float y)

Sets the pattern origin/anchor offset.

SetPatternTransform

public void SetPatternTransform(EVGTransform transform)

Sets an additional transform for the pattern.

ClearPattern

public void ClearPattern()

Clears the current pattern, reverting to solid color/gradient fills.


Global Alpha

SetGlobalAlpha

public void SetGlobalAlpha(float alpha)

Sets the global alpha multiplier (0.0 to 1.0) for all drawing operations.


Transforms

Translate

public void Translate(float x, float y)

Translates the coordinate system.

Rotate

public void Rotate(float angle)

Rotates the coordinate system by angle (in radians, clockwise).

Scale

public void Scale(float x, float y)

Scales the coordinate system.

SkewX

public void SkewX(float angle)

Skews the X axis by angle (in radians).

SkewY

public void SkewY(float angle)

Skews the Y axis by angle (in radians).

Transform

public void Transform(float a, float b, float c, float d, float e, float f)

Applies a custom transformation matrix.

Matrix format:

| a c e |
| b d f |
| 0 0 1 |

SetTransform

public void SetTransform(float a, float b, float c, float d, float e, float f)

Replaces the current transformation matrix.

ResetTransform

public void ResetTransform()

Resets the transformation matrix to identity.

GetTransform

public EVGTransform GetTransform()

Gets the current transformation matrix.


Path Construction

BeginPath

public void BeginPath()

Begins a new path. Any existing path is cleared.

ClosePath

public void ClosePath()

Closes the current path by drawing a line to the start point.

MoveTo

public void MoveTo(float x, float y)

Moves the current point to (x, y) without drawing.

LineTo

public void LineTo(float x, float y)

Draws a line from the current point to (x, y).

QuadraticCurveTo

public void QuadraticCurveTo(float cx, float cy, float x, float y)

Draws a quadratic Bezier curve.

ParameterTypeDescription
cx, cyfloatControl point
x, yfloatEnd point

BezierCurveTo

public void BezierCurveTo(float c1x, float c1y, float c2x, float c2y, float x, float y)

Draws a cubic Bezier curve.

ParameterTypeDescription
c1x, c1yfloatFirst control point
c2x, c2yfloatSecond control point
x, yfloatEnd point

Arc

public void Arc(float cx, float cy, float r, float a0, float a1, int dir = 1)

Draws an arc.

ParameterTypeDescription
cx, cyfloatCenter point
rfloatRadius
a0floatStart angle (radians)
a1floatEnd angle (radians)
dirintDirection: 1 = counter-clockwise, 2 = clockwise

ArcTo

public void ArcTo(float x1, float y1, float x2, float y2, float radius)

Draws an arc from the current point to (x2, y2) through (x1, y1) with the given radius.


Shape Primitives

Rect

public void Rect(float x, float y, float w, float h)

Adds a rectangle to the current path.

RoundedRect

public void RoundedRect(float x, float y, float w, float h, float r)
public void RoundedRect(float x, float y, float w, float h, float rTopLeft, float rTopRight, float rBottomRight, float rBottomLeft)

Adds a rounded rectangle with uniform or per-corner radii.

BevelledRect

public void BevelledRect(float x, float y, float w, float h, float b)
public void BevelledRect(float x, float y, float w, float h, float bTopLeft, float bTopRight, float bBottomRight, float bBottomLeft)

Adds a bevelled rectangle with uniform or per-corner bevel sizes.

Circle

public void Circle(float cx, float cy, float r)

Adds a circle to the current path.

Ellipse

public void Ellipse(float cx, float cy, float rx, float ry)

Adds an ellipse to the current path.


Drawing Operations

Fill

public void Fill()

Fills the current path with the current fill style using the non-zero winding rule.

FillEvenOdd

public void FillEvenOdd()

Fills the current path using the even-odd winding rule.

Stroke

public void Stroke()

Strokes the current path with the current stroke style.

Clip

public void Clip()

Sets the current path as a clipping region.


Convenience Methods

FillRect

public void FillRect(float x, float y, float w, float h)

Draws a filled rectangle (equivalent to BeginPath + Rect + Fill).

StrokeRect

public void StrokeRect(float x, float y, float w, float h)

Draws a stroked rectangle.

FillCircle

public void FillCircle(float cx, float cy, float r)

Draws a filled circle.

StrokeCircle

public void StrokeCircle(float cx, float cy, float r)

Draws a stroked circle.


Text Rendering

Text

public AxisAlignedBounds2D Text(float x, float y, float width, string text)

Renders text at the specified position.

ParameterTypeDescription
x, yfloatText position
widthfloatMaximum width for wrapping
textstringText content

Returns: AxisAlignedBounds2D - The bounds of the rendered text.

SetFont

public void SetFont(VectorFont font)

Sets the font for text rendering.

SetFontSize

public void SetFontSize(float size)

Sets the font size in pixels.

SetFontWeight

public void SetFontWeight(ushort weight)

Sets the font weight (100-900, 400=normal, 700=bold).

SetFontStyle

public void SetFontStyle(FontStyle style)

Sets the font style (normal, italic, oblique).

SetFontStretch

public void SetFontStretch(float stretch)

Sets the font stretch (1.0 = normal).

SetCharSpacing

public void SetCharSpacing(float spacing)

Sets character spacing (tracking) in em units.

SetTextLineHeight

public void SetTextLineHeight(float height)

Sets line height in em units.

SetTextAlignment

public void SetTextAlignment(TextAlignment alignment)

Sets text alignment (Left, Right, Center).

SetTextBaseline

public void SetTextBaseline(TextBaseline baseline)

Sets the vertical anchor point (Top, Middle, Alphabetic, Bottom).

SetTextScale

public void SetTextScale(float x, float y)

Sets per-glyph scale transform.

SetTextSkew

public void SetTextSkew(float skew)

Sets skew/slant value (positive = slant right).


Text Effects

SetTextEffect

public void SetTextEffect(TextEffect effectFlags)

Sets text effect flags (bitmask).

Flags:

  • TextEffect.None
  • TextEffect.Fill - Render filled glyphs
  • TextEffect.Shadow - Drop shadow
  • TextEffect.Outline - Expanded outline
  • TextEffect.Stroke - Stroked outline

SetTextFillColor

public void SetTextFillColor(Color32 color)

Sets the primary text fill color.

SetTextStrokeColor

public void SetTextStrokeColor(Color32 color)

Sets the text stroke color.

SetTextStrokeWidth

public void SetTextStrokeWidth(float width)

Sets text stroke width in em units.

SetTextStrokeCapType

public void SetTextStrokeCapType(StrokeCapType capType)

SetTextStrokeJoinType

public void SetTextStrokeJoinType(StrokeJoinType joinType)

SetTextStrokeMiterLimit

public void SetTextStrokeMiterLimit(float limit)

SetTextOutlineColor

public void SetTextOutlineColor(Color32 color)

Sets the text outline color.

SetTextOutlineSize

public void SetTextOutlineSize(float size)

Sets outline expansion size in em units.

SetTextOutlineOffset

public void SetTextOutlineOffset(float x, float y)

Sets outline offset in em units.

SetTextOutlineMiterLimit

public void SetTextOutlineMiterLimit(float limit)

SetTextOutlineJoinType

public void SetTextOutlineJoinType(StrokeJoinType joinType)

SetTextShadowColor

public void SetTextShadowColor(Color32 color)

Sets the text shadow color.

SetTextShadowOffset

public void SetTextShadowOffset(float x, float y)

Sets shadow offset in em units.


Text Gradients

SetTextFillGradientSpace

public void SetTextFillGradientSpace(TextGradientSpace space)

Sets gradient coordinate space for text fill.

Spaces:

  • TextGradientSpace.Em - Normalized to font em-square
  • TextGradientSpace.Layout - Normalized to text bounds
  • TextGradientSpace.World - Pixel coordinates

SetTextFillGradient

public void SetTextFillGradient(CanvasGradient gradient)

SetTextFillLinearGradient

public void SetTextFillLinearGradient(float sx, float sy, float ex, float ey, Color32 startColor, Color32 endColor)
public void SetTextFillLinearGradient(float sx, float sy, float ex, float ey, ColorStop[] colorStops)

SetTextFillRadialGradient

public void SetTextFillRadialGradient(float cx, float cy, float radius, Color32 innerColor, Color32 outerColor)
public void SetTextFillRadialGradient(float x0, float y0, float r0, float x1, float y1, float r1, Color32 innerColor, Color32 outerColor)

SetTextFillConicGradient

public void SetTextFillConicGradient(float cx, float cy, float startAngle, Color32 startColor, Color32 endColor)

Similar methods exist for stroke, outline, and shadow:

  • SetTextStrokeGradientSpace, SetTextStrokeGradient, SetTextStrokeLinearGradient, etc.
  • SetTextOutlineGradientSpace, SetTextOutlineGradient, SetTextOutlineLinearGradient, etc.
  • SetTextShadowGradientSpace, SetTextShadowGradient, SetTextShadowLinearGradient, etc.

Text Decorations

SetTextUnderline

public void SetTextUnderline(bool enabled)
public void SetTextUnderline(Color32 color)

Enable/disable underline or enable with specific color.

SetTextStrikethrough

public void SetTextStrikethrough(bool enabled)
public void SetTextStrikethrough(Color32 color)

Enable/disable strikethrough or enable with specific color.

SetTextUnderlineGradientSpace

public void SetTextUnderlineGradientSpace(TextGradientSpace space)

SetTextUnderlineGradient

public void SetTextUnderlineGradient(CanvasGradient gradient)

SetTextStrikethroughGradientSpace

public void SetTextStrikethroughGradientSpace(TextGradientSpace space)

SetTextStrikethroughGradient

public void SetTextStrikethroughGradient(CanvasGradient gradient)

Variable Font Axes

SetAxisVariation

public void SetAxisVariation(string tag, float value)

Sets a variable font axis variation.

ParameterTypeDescription
tagstring4-character axis tag (e.g., "wght", "wdth")
valuefloatAxis value

ClearAxisVariations

public void ClearAxisVariations()

Clears all runtime axis variations.


Path Shadows

SetShadowOffset

public void SetShadowOffset(float x, float y)

Sets the generic path shadow offset in pixels.

SetShadowColor

public void SetShadowColor(Color32 color)

Sets the generic path shadow color.


Class: CanvasGradient

namespace EvolveUI.Rendering
public unsafe class CanvasGradient

Represents a reusable gradient definition.

Static Factory Methods

CreateLinearGradient

public static CanvasGradient CreateLinearGradient(float x0, float y0, float x1, float y1)
public static CanvasGradient CreateLinearGradient(float x0, float y0, float x1, float y1, params ColorStop[] colorStops)

Creates a linear gradient from (x0, y0) to (x1, y1).

CreateRadialGradient

public static CanvasGradient CreateRadialGradient(float x0, float y0, float r0, float x1, float y1, float r1)
public static CanvasGradient CreateRadialGradient(float x0, float y0, float r0, float x1, float y1, float r1, params ColorStop[] colorStops)

Creates a radial gradient between two circles.

CreateConicGradient

public static CanvasGradient CreateConicGradient(float startAngle, float cx, float cy)
public static CanvasGradient CreateConicGradient(float startAngle, float cx, float cy, params ColorStop[] colorStops)

Creates a conic gradient centered at (cx, cy).

Instance Methods

AddColorStop

public void AddColorStop(float position, Color32 color)

Adds a color stop with linear interpolation.

ParameterTypeDescription
positionfloatPosition from 0.0 to 1.0
colorColor32Color at this position (sRGB)

AddColorStopStep

public void AddColorStopStep(float position, Color32 color)

Adds a color stop with step interpolation (hard edge).

AddColorStopLinear

public void AddColorStopLinear(float position, float r, float g, float b, float a = 1f)

Adds a color stop using linear (not sRGB) color values.

AddColorStops

public void AddColorStops(params ColorStop[] colorStops)

Adds multiple color stops at once.

ClearStops

public void ClearStops()

Clears all color stops from the gradient.

StopCount

public int StopCount { get; }

Gets the number of color stops in the gradient.


Struct: ColorStop

namespace EvolveUI.Rendering
public struct ColorStop

A color stop for gradient definitions.

Fields

FieldTypeDescription
positionfloatPosition from 0.0 to 1.0
colorColor32Color at this position
interpolationColorStopInterpolationInterpolation mode to next stop

Constructor

public ColorStop(float position, Color32 color, ColorStopInterpolation interpolation = ColorStopInterpolation.Linear)

Font Loading (UIAssetManager)

The UIAssetManager class provides methods for loading fonts at runtime for use with Canvas text rendering.

LoadVectorFont

public VectorFont LoadVectorFont(string filePath, string fontName = null, float scale = 1.0f, float offset = 0.0f)

Loads a font from a file path and creates a VectorFont instance.

ParameterTypeDescription
filePathstringPath to the font file (.ttf, .otf, etc.)
fontNamestringOptional name for the font. If null, uses the filename.
scalefloatScale factor for the font (default: 1.0)
offsetfloatVertical offset for the font (default: 0.0)

Returns: VectorFont - A font instance for use with Canvas.SetFont().

Throws: ArgumentNullException if filePath is null or empty. FileNotFoundException if file doesn't exist.

LoadVectorFontFromMemory

public VectorFont LoadVectorFontFromMemory(byte[] fontData, string fontName, float scale = 1.0f, float offset = 0.0f)

Loads a font from a byte array in memory.

ParameterTypeDescription
fontDatabyte[]Font file data in memory
fontNamestringName for the font (required)
scalefloatScale factor for the font (default: 1.0)
offsetfloatVertical offset for the font (default: 0.0)

Returns: VectorFont - A font instance for use with Canvas.SetFont().

Throws: ArgumentNullException if fontData or fontName is null/empty.

FindVectorFont

public VectorFont FindVectorFont(string fontName)

Finds a previously loaded vector font by name.

ParameterTypeDescription
fontNamestringName of the font to find

Returns: VectorFont - The font instance if found, or default if not found.

HasVectorFont

public bool HasVectorFont(string fontName)

Checks if a vector font with the given name has been loaded.

ParameterTypeDescription
fontNamestringName of the font to check

Returns: bool - True if the font exists, false otherwise.

SetGlobalFallbackFont

public void SetGlobalFallbackFont(VectorFont font)

Sets the global fallback font used when a character is not found in the primary font. Useful for emoji fonts or special character sets.

ParameterTypeDescription
fontVectorFontThe font to use as fallback, or default to clear

GetGlobalFallbackFont

public VectorFont GetGlobalFallbackFont()

Gets the current global fallback font.

Returns: VectorFont - The global fallback font, or default if none is set.

CreateFontChain

public VectorFont CreateFontChain(string chainName, params VectorFont[] fonts)

Creates a font chain from multiple fonts. When rendering text, if a character is not found in the first font, subsequent fonts in the chain are tried in order.

ParameterTypeDescription
chainNamestringName for the font chain
fontsVectorFont[]Array of fonts to include, in priority order

Returns: VectorFont - A font representing the chain.

Throws: ArgumentNullException if chainName is null/empty. ArgumentException if fonts is empty.

CreateFontFamily

public VectorFont CreateFontFamily(string familyName, params FontFamilyMemberInfo[] members)

Creates a font family from multiple font faces with different weights and styles. The appropriate face is automatically selected based on the current font weight and style settings.

ParameterTypeDescription
familyNamestringName for the font family
membersFontFamilyMemberInfo[]Array of family members with weight/style info

Returns: VectorFont - A font representing the family.

Throws: ArgumentNullException if familyName is null/empty. ArgumentException if members is empty or contains invalid FontInfo.

LoadFontInfo

public FontInfo LoadFontInfo(string filePath, string fontName = null)

Loads font info from a file path. FontInfo is an intermediate representation that can be used to create fonts or font family members.

ParameterTypeDescription
filePathstringPath to the font file (.ttf, .otf, etc.)
fontNamestringOptional name for the font info. If null, uses the filename.

Returns: FontInfo - A font info instance.

Throws: ArgumentNullException if filePath is null/empty. FileNotFoundException if file doesn't exist.

LoadFontInfoFromMemory

public FontInfo LoadFontInfoFromMemory(byte[] fontData, string fontName)

Loads font info from a byte array in memory.

ParameterTypeDescription
fontDatabyte[]Font file data in memory
fontNamestringName for the font info (required)

Returns: FontInfo - A font info instance.

Throws: ArgumentNullException if fontData or fontName is null/empty.


Struct: FontInfo

namespace EvolveUI.Native
public struct FontInfo

Represents loaded font metadata used to create fonts or font family members. Obtained via UIAssetManager.LoadFontInfo() or UIAssetManager.LoadFontInfoFromMemory().


Struct: FontFamilyMemberInfo

namespace EvolveUI
public struct FontFamilyMemberInfo

Information for a single member of a font family (one weight/style combination).

Constructor

public FontFamilyMemberInfo(FontInfo fontInfo, ushort weight, FontStyle style = FontStyle.Normal, float scale = 1.0f, float offset = 0.0f)

Fields

FieldTypeDescription
fontInfoFontInfoThe FontInfo for this family member
weightushortFont weight (100-900). 400=Regular, 700=Bold
styleFontStyleFont style (Normal, Italic, or Oblique)
scalefloatScale factor (default: 1.0)
offsetfloatVertical offset for baseline adjustment (default: 0.0)

Struct: VectorFont

namespace EvolveUI
public struct VectorFont

Represents a loaded vector font for use with Canvas text rendering. Obtained via UIAssetManager.LoadVectorFont() or UIAssetManager.FindVectorFont().

Properties

PropertyTypeDescription
IsValidboolReturns true if this represents a valid loaded font

Enum: ColorStopInterpolation

namespace EvolveUI.Rendering
public enum ColorStopInterpolation
ValueDescription
LinearSmooth blend to next stop (in OkLab color space)
StepHold color until next stop (hard edge)

Enum: StrokeCapType

namespace EvolveUI.Native
public enum StrokeCapType : byte
ValueDescription
NoneNo cap
FlatFlat cap at endpoint
TriangleTriangular cap
SquareSquare cap extending past endpoint
RoundRounded cap

Enum: StrokeJoinType

namespace EvolveUI.Native
public enum StrokeJoinType : byte
ValueDescription
MiterSharp corners (falls back to bevel when exceeding miter limit)
BevelBeveled corners
RoundRounded corners

Enum: PatternSpace

namespace EvolveUI.Native
public enum PatternSpace : byte
ValueDescription
BoundsUVs are [0,1] within shape bounds (CSS-like)
WorldUVs are world/pixel coordinates (Canvas pattern-like)

Enum: PatternSizing

namespace EvolveUI.Native
public enum PatternSizing : byte
ValueDescription
StretchFill bounds, ignore aspect ratio
ContainFit inside bounds, preserve aspect ratio (letterbox)
CoverCover bounds, preserve aspect ratio (may crop)
TileTile at specified size

Enum: PatternRepeat

namespace EvolveUI.Native
public enum PatternRepeat : byte
ValueDescription
NoRepeatClamp to edges
RepeatTile both axes
RepeatXTile X axis, clamp Y
RepeatYTile Y axis, clamp X

Enum: TextAlignment

namespace EvolveUI.Native
public enum TextAlignment : byte
ValueDescription
LeftLeft-aligned text
RightRight-aligned text
CenterCenter-aligned text

Enum: TextBaseline

namespace EvolveUI.Native
public enum TextBaseline : byte
ValueDescription
Topy = top of text block
Middley = middle of first line's em square
Alphabeticy = alphabetic baseline (HTML Canvas default)
Bottomy = bottom of text block

Enum: TextEffect

namespace EvolveUI.Native
[Flags]
public enum TextEffect : byte
ValueDescription
NoneNo effects
FillRender filled glyphs (base text)
ShadowDrop shadow rendered beneath
OutlineExpanded outline rendered beneath
StrokeStroked outline rendered on top

Enum: TextGradientSpace

namespace EvolveUI.Native
public enum TextGradientSpace : byte
ValueDescription
EmNormalized to font em-square (0-1, per-glyph)
LayoutNormalized to text layout bounds (0-1)
WorldPixel coordinates (same as fill/stroke gradients)

Struct: EVGTransform

namespace EvolveUI.Native
public struct EVGTransform

2D transformation matrix.

Fields

FieldTypeDescription
afloatScale X / Rotation
bfloatSkew Y
cfloatSkew X
dfloatScale Y / Rotation
efloatTranslate X
ffloatTranslate Y

Matrix representation:

| a c e |   | x |   | ax + cy + e |
| b d f | * | y | = | bx + dy + f |
| 0 0 1 | | 1 | | 1 |