Namespace Xui.Core.Canvas
Namespaces
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
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.
- FontMetrics
 Represents font-defined metrics used for vertical alignment and em box sizing. These values are constant for a given font and size.
- FontStretch
 Represents the stretch or width percentage of a font, relative to its normal width (100%).
- FontStyle
 Represents a web-like font style, supporting
normal,italic, andobliquevariations. Global CSS styles likeinherit,unset, andinitialare not supported.Reference: https://developer.mozilla.org/en-US/docs/Web/CSS/font-style
- FontWeight
 Represents the numeric weight of a font, corresponding to CSS font weights (100–900).
- GradientStop
 Represents a single color stop in a gradient, defined by an offset and a color. Used for both linear and radial gradients.
- LineMetrics
 Represents text layout metrics that depend on the specific string being measured. Includes actual bounding box and visual advance width.
- 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.
- TextMetrics
 Composite structure combining string-specific and font-specific text metrics. Used for precise layout, alignment, and rendering across all platforms.
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()andstrokeRect()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()andrestore()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, but returns a full TextMetrics structure for advanced layout.
- 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
lineCapproperty in the HTML5 Canvas API.
- LineJoin
 Specifies how two connected lines are joined when stroking a path. Mirrors the
lineJoinproperty 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
textAlignproperty in the HTML5 Canvas 2D API.
- TextBaseline
 Specifies the vertical alignment of text relative to the drawing position. Mirrors the
textBaselineproperty 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.