Table of Contents

Namespace Xui.Core.Canvas

Namespaces

Xui.Core.Canvas.SVG

Classes

Colors

Provides web standard named color constants in 32-bit RGBA format (0xRRGGBBAA). These match the named colors from the CSS color specification: https://developer.mozilla.org/en-US/docs/Web/CSS/named-color

Path2D

Structs

Color

Represents a color using red, green, blue, and alpha components, all normalized to the range [0, 1].

CornerRadius

Represents the radius of each corner of a rectangle, allowing for uniform or non-uniform rounding.

Font

Describes a font used for text layout and rendering, similar to the CSS font model.

FontStyle

Represents a web-like font style, supporting normal, italic, and oblique variations. Global CSS styles like inherit, unset, and initial are not supported.

Reference: https://developer.mozilla.org/en-US/docs/Web/CSS/font-style

GradientStop

Represents a single color stop in a gradient, defined by an offset and a color. Used for both linear and radial gradients.

LinearGradient

Represents a linear gradient brush that transitions between colors along a straight line, following the same behavior as the HTML5 Canvas createLinearGradient().

RadialGradient

Represents a radial gradient brush that transitions colors outward from one circle to another, similar to createRadialGradient() in the HTML5 Canvas API.

Interfaces

IContext

Represents a 2D drawing context for the Xui Canvas, modeled after the HTML5 Canvas 2D context API. This interface aggregates all sub-contexts responsible for different aspects of 2D rendering, including state, drawing primitives, text, images, transformations, and resource management.

IGlyphPathBuilder

A lightweight interface for constructing TrueType glyph paths using move, line, curve, and close commands.

IImageDrawingContext

Defines methods for drawing image-like content onto the canvas, such as bitmaps, video frames, or decoded image buffers.

Mirrors the image drawing APIs from the HTML5 Canvas 2D context. https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/drawImage

IMeasureContext

Defines a measurement context that provides access to platform-specific text metrics, supports subpixel snapping for layout precision, and enables accurate text size calculations using the underlying rendering engine's font rasterization and shaping systems.

IPathBuilder

Defines methods for constructing paths, following the HTML5 Canvas path API model.

Reference: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D#paths

IPathClipping

Defines methods for clipping using a path, following the HTML5 Canvas path API model.

Reference: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D#paths

IPathDrawing

Defines methods for drawing a constructed path, following the HTML5 Canvas path API model.

Reference: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D#paths

IPathDrawingContext

Defines methods for constructing and rendering 2D paths, following the HTML5 Canvas path API model.

Reference: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D#paths

IPenContext

Defines properties and methods for controlling stroke and fill styles in a 2D drawing context, including line caps, joins, width, dashes, and brush settings for fill and stroke.

IRectDrawingContext

Provides convenience methods for drawing filled and stroked rectangles, similar to the fillRect() and strokeRect() functions in the HTML5 Canvas API.

IStateContext

Provides methods to save and restore the current drawing state, including styles, transforms, and clipping paths. Mirrors the behavior of the HTML5 Canvas save() and restore() methods.

ITextDrawingContext

Defines methods for drawing text onto the canvas, including alignment and baseline options. Mirrors the HTML5 Canvas 2D text API for fillText(). Also provides access to text measurement via ITextMeasureContext.

ITextMeasureContext

Provides functionality for measuring text and setting font properties. Mirrors the measurement behavior of the HTML5 Canvas 2D context.

ITransformContext

Provides methods for manipulating the current transformation matrix of the drawing context. This includes translation, scaling, rotation, and applying affine transformations. Mirrors the transformation API of the HTML5 Canvas 2D context.

Enums

FillRule

Specifies the algorithm used to determine the "insideness" of a point in a path, controlling how filled shapes are rendered.

LineCap

Specifies the shape used at the ends of lines when stroking paths. Mirrors the lineCap property in the HTML5 Canvas API.

LineJoin

Specifies how two connected lines are joined when stroking a path. Mirrors the lineJoin property in the HTML5 Canvas API.

PaintStyle

Specifies the type of brush or fill style used for painting shapes or strokes. Helps distinguish between solid colors and gradient fills.

TextAlign

Specifies the horizontal alignment of text relative to the drawing position. Mirrors the textAlign property in the HTML5 Canvas 2D API.

TextBaseline

Specifies the vertical alignment of text relative to the drawing position. Mirrors the textBaseline property in the HTML5 Canvas 2D API.

Winding

Specifies the direction in which arcs or elliptical curves are drawn, affecting fill and stroke behavior in path-based rendering.