DrawScope
Safe draw-list facade for widget renderers that translates high-level drawing calls into backend-neutral commands, manages transform pivot adjustments, and provides zero-allocation immediate primitives.
Architecture & Command Recording
DrawScope is the primary drawing facade provided to custom widget renderers (WidgetRender#render(Widget, DrawScope)). It bridges immediate-mode procedural rendering with UniGUI's deferred draw-list architecture.
Instead of issuing immediate OpenGL, Vulkan, or Direct3D state mutations, DrawScope translates each method invocation into an immutable DrawCommand appended to the frame's DrawList. This decoupled design enables automatic draw-call batching, multi-threaded rendering, retained display caching, and hardware-neutral compatibility across all supported platforms.
| Drawing Subsystem | Primary Methods | Capabilities & Architecture |
|---|---|---|
| Standard Shapes | rect, roundedRect, circle, line, path |
High-level 2D geometric shapes styled using reusable Paint instances. |
| Garbage-Free Primitives | rectFilled, rectStroke, circleFilled, etc. |
Zero-allocation drawing calls accepting raw ColorView parameters directly without creating temporary objects. |
| Textures & Nine-Slice | texture, textureTinted, nineSlice |
Full-atlas UV mapping, rounded textures, and 9-slice expandable GUI panels. |
| Text & Typography | text, addText |
Plain string and structured RichText typography with subpixel rasterization alignment. |
| Direct Geometry & Meshes | addTriangle, addQuad, addMesh, ribbon |
Vertex-level arbitrary polygons, textured quads, custom indexed meshes, and procedural path ribbons. |
| Vector Paths & Channels | pathLineTo, pathArcTo, pathBezier*, channelsSplit |
Interactive vector path construction and multi-channel draw-order layering. |
| Clipping & Scissor | pushClip, pushTextClip, popClip |
Hardware-accelerated rectangular scissor regions with font-bleed compensation. |
Immediate API, Deferred Execution
Calling drawing methods on DrawScope does not immediately render pixels to the screen. All commands are recorded in the active RenderContext and subsequently replayed, batched, and rendered by the active graphics backend.
Transforms & Pivot Anchoring
When rendering custom widget graphics, child shapes and text must adhere to the widget's global transformations (translation, scale, rotation, skew, and pivot). DrawScope handles this coordination automatically.
Automatic Pivot Adjustment (transformFor)
When a DrawScope is created with widget layout bounds (transformBounds), it calculates the relative offset between the widget's layout origin and each individual command's local coordinates.
// Conceptual adjustment performed internally:
Transform adjusted = transform.copy();
adjusted.pivot().set(
transform.pivot().x() + transformBoundsX - commandX,
transform.pivot().y() + transformBoundsY - commandY);
This guarantees that all elements drawn inside the widget (such as background plates, icons, and text labels) rotate and scale as a unified visual unit around the widget's designated transform pivot, rather than rotating around their individual top-left coordinates.
Nested Sub-Scopes
Use withTransform(Transform) to produce a lightweight child scope sharing the parent render context but applying a different local transformation (e.g. for spinning loading indicators or pulsating icons):
DrawScope iconScope = scope.withTransform(spinningTransform);
iconScope.texture(iconTexture, 0, 0, 16, 16, paint);
Garbage-Free Drawing Primitives
In high-performance Minecraft rendering running at 60 to 144+ FPS, allocating temporary objects during procedural drawing triggers frequent garbage collection pauses.
DrawScope provides two complementary drawing paradigms:
- Standard
Paint-based Overloads (rect,circle, etc.): Convenient when styling parameters (fill, stroke, shader, filter) are encapsulated inside a reusable, cachedPaintinstance. - Garbage-Free Overloads (
rectFilled,rectStroke,circleFilled, etc.): Accept primitive float coordinates andColorViewinstances directly. In standard UI rendering, these methods perform zero heap allocations per frame.
| Operation | Standard (Paint) | Garbage-Free (ColorView) | Allocation Impact |
|---|---|---|---|
| Solid Rectangle | scope.rect(x, y, w, h, paint) |
scope.rectFilled(x, y, w, h, color) |
Zero allocations |
| Rectangle Outline | scope.rect(x, y, w, h, paint) |
scope.rectStroke(x, y, w, h, color, width) |
Zero allocations |
| Rounded Rectangle | scope.roundedRect(..., paint) |
scope.roundedRectFilled(..., color) |
Zero allocations |
| Circle / Ellipse | scope.circle(x, y, w, h, paint) |
scope.circleFilled(x, y, w, h, color) |
Zero allocations |
| Textured Quad | scope.texture(tex, placement, ...) |
scope.addTexturedQuad(tex, x1, y1, ...) |
Zero allocations |
[!TIP] In widget render methods, always prefer the
*Filledand*Strokeoverloads with constant or pre-allocatedColorViewinstances for maximum framerate stability.
Textures & Nine-Slice System
UniGUI features a comprehensive 2D texturing engine built directly into DrawScope.
Nine-Slice Scalable Panels
Nine-slice (9-patch) textures allow rectangular UI panels of arbitrary dimensions to be drawn using a small source texture without distorting corner geometry or borders:
- 4 Fixed Corners: Top-left, top-right, bottom-left, and bottom-right corners are rendered at their native 1:1 pixel scale without stretching.
- 4 Stretched Edges: Top and bottom edges stretch horizontally; left and right edges stretch vertically.
- Center Area: Scaled across both horizontal and vertical axes, or left transparent when
fillCenter = false.
NineSlice borderSlice = NineSlice.of(windowTexture, 8, 8, 8, 8);
// Draws full window panel:
scope.nineSlice(borderSlice, 0, 0, width, height, Paint.NONE, true);
// Draws hollow selection outline:
scope.nineSlice(borderSlice, 0, 0, width, height, Paint.NONE, false);
Proportional Overflow Protection
If the target width or height is smaller than the combined corner margins, DrawScope automatically scales corner borders down proportionally (Math.min(srcLeft, width * 0.5f)). This ensures the panel never clips or inverts its corners on small widget sizes.
Vector Paths, Meshes & Ribbons
For custom procedural visuals, node graphs, map connections, and complex vector art, DrawScope offers rich path and polygon operations.
Procedural Ribbons
The ribbon(...) method generates smooth, continuous textured ribbons along arbitrary polyline paths with automatic miter joints and butt caps:
- Graph Connections: Ideal for wiring, fluid pipes, and node-graph curves.
- Texture Tiling: When using textures with
REPEATwrap mode and specifyingtextureLengthequal to the tile size, the texture repeats seamlessly along the ribbon length without elongation.
Direct Vertex Polygons & Meshes
- Polygons:
addPolyline,addConvexPolyFilled, andaddConcavePolyFilled(using ear-clipping triangulation). - Meshes:
addMesh(DrawMesh, TextureHandle)allows precomputed indexed vertex meshes to be submitted in a single backend call. - Quads & Triangles:
addQuadFilled,addTriangleFilled, andaddRectFilledMultiColorfor smooth 4-corner color gradients.
Clipping & Scissor Hierarchy
Clipping restricts drawing commands to a rectangular screen region, essential for scroll views, overflow containers, and text entry fields.
Standard Scissor vs Text Clip Bleed
// Standard rectangular clipping:
scope.pushClip(x, y, width, height);
// Render clipped content...
scope.popClip();
When rendering font glyphs, standard hardware scissor rectangles can clip subpixel antialiasing fringes or slightly oversized italic accents along line boundaries.
DrawScope#pushTextClip adds specialized micro-bleed margins (bleedX = 1.0f, bleedTop = 1.0f, bleedBottom = 2.0f) to prevent font cutoff while strictly maintaining containment for empty or zero-sized viewports.
Always Balance Push and Pop
Every invocation of pushClip(...) or pushTextClip(...) must be paired with exactly one popClip() call, typically within a try / finally block:
Draw a Styled Card with Background and Nine-Slice Header
@Override
public void render(Widget widget, DrawScope scope) {
RectView b = widget.layoutBounds();
// 1. Draw rounded drop shadow and solid background
scope.roundedRectFilled(b.x() + 2, b.y() + 2, b.width(), b.height(), 6.0f, ColorView.rgba(0, 0, 0, 80));
scope.roundedRectFilled(b.x(), b.y(), b.width(), b.height(), 6.0f, ColorView.rgb(32, 34, 37));
scope.roundedRectStroke(b.x(), b.y(), b.width(), b.height(), 6.0f, ColorView.rgb(55, 58, 64), 1.0f);
// 2. Draw 9-slice header bar
NineSlice headerSlice = NineSlice.of(cardHeaderTex, 4, 4, 4, 4);
scope.nineSlice(headerSlice, b.x() + 1, b.y() + 1, b.width() - 2, 28.0f, Paint.NONE, true);
// 3. Render clipped title text with protective bleed
scope.pushTextClip(b.x() + 10, b.y() + 6, b.width() - 20, 18.0f);
try {
scope.addText("Settings Card", b.x() + 10, b.y() + 6, b.width() - 20, 18.0f, ColorView.WHITE);
} finally {
scope.popClip();
}
}
Draw Procedural Textured Ribbon Between Points
List<DrawPoint> path = List.of(
new DrawPoint(20.0f, 40.0f),
new DrawPoint(80.0f, 40.0f),
new DrawPoint(140.0f, 90.0f),
new DrawPoint(200.0f, 90.0f)
);
// Draw continuous cable/pipe with miter joints
RibbonOptions options = RibbonOptions.defaults()
.closed(false)
.miterLimit(3.0f);
scope.ribbon(cableTexture, path, 6.0f, 32.0f, ColorView.rgb(0, 200, 255), options);
API
Scope & Transforms
| Method | Description |
|---|---|
DrawScope(RenderContext, Transform) |
Creates a drawing scope without anchor bounds for transform pivot. |
DrawScope(RenderContext, Transform, RectView) |
Creates a drawing scope with widget layout bounds used to maintain relative transform pivot anchoring. |
context() |
Returns the underlying render context that receives draw commands. |
transform() |
Returns the current transform applied by this scope to all generated commands. |
withTransform(Transform) |
Creates a nested scope targeting the same render context with a different transform. |
DrawScope(RenderContext, Transform)
Construct Scope
Creates a drawing scope without anchor bounds for transform pivot.
| Parameter | Type | Description |
|---|---|---|
context |
RenderContext |
RenderContext receiving the recorded drawing commands. |
transform |
Transform |
Widget Transform applied to commands recorded within the scope. |
DrawScope(RenderContext, Transform, RectView)
Construct Anchored Scope
Creates a drawing scope with widget layout bounds used to maintain relative transform pivot anchoring.
| Parameter | Type | Description |
|---|---|---|
context |
RenderContext |
RenderContext receiving the recorded drawing commands. |
transform |
Transform |
Widget Transform applied to commands recorded within the scope. |
transformBounds |
RectView |
Initial layout bounds of the widget used to anchor transform pivot. |
DrawScope::context()
Get Render Context
Returns the underlying render context that receives draw commands.
Returns RenderContext: Active render context instance..
DrawScope::transform()
Get Scope Transform
Returns the current transform applied by this scope to all generated commands.
Returns Transform: Active Transform instance, or null if unscaled..
DrawScope::withTransform(Transform)
Create Sub-Scope with Transform
Creates a nested scope targeting the same render context with a different transform.
| Parameter | Type | Description |
|---|---|---|
transform |
Transform |
Widget Transform applied to commands recorded within the scope. |
Returns DrawScope: New DrawScope sharing the parent context with the specified transform..
Basic Shapes & Primitives
| Method | Description |
|---|---|
rect(float, float, float, float, Paint) |
Draws a rectangle styled with the specified Paint instance. |
roundedRect(float, float, float, float, float, Paint) |
Draws a rectangle with rounded corners using corner radius and Paint styling. |
circle(float, float, float, float, Paint) |
Draws an ellipse or circle inscribed inside the specified bounding box. |
line(float, float, float, float, Paint) |
Draws a straight line between two points using Paint styling. |
path(VectorPath, float, float, float, float, Paint) |
Draws a reusable VectorPath fitted within target bounds using Paint styling. |
rectFilled(float, float, float, float, ColorView) |
Draws a solid filled rectangle with zero allocations by passing ColorView directly. |
rectStroke(float, float, float, float, ColorView, float) |
Draws a stroked rectangle outline with zero allocations. |
roundedRectFilled(float, float, float, float, float, ColorView) |
Draws a solid filled rounded rectangle with zero allocations. |
roundedRectStroke(float, float, float, float, float, ColorView, float) |
Draws a stroked rounded rectangle outline with zero allocations. |
circleFilled(float, float, float, float, ColorView) |
Draws a solid filled circle or ellipse with zero allocations. |
circleStroke(float, float, float, float, ColorView, float) |
Draws a stroked circle or ellipse outline with zero allocations. |
DrawScope::rect(float, float, float, float, Paint)
Draw Rectangle
Draws a rectangle styled with the specified Paint instance.
| Parameter | Type | Description |
|---|---|---|
x |
float |
X coordinate of the destination rectangle in local scope space. |
y |
float |
Y coordinate of the destination rectangle in local scope space. |
width |
float |
Width of the bounding area in local pixels. |
height |
float |
Height of the bounding area in local pixels. |
paint |
Paint |
Paint styling parameters controlling fill, stroke, tint, and shader. |
DrawScope::roundedRect(float, float, float, float, float, Paint)
Draw Rounded Rectangle
Draws a rectangle with rounded corners using corner radius and Paint styling.
| Parameter | Type | Description |
|---|---|---|
x |
float |
X coordinate of the destination rectangle in local scope space. |
y |
float |
Y coordinate of the destination rectangle in local scope space. |
width |
float |
Width of the bounding area in local pixels. |
height |
float |
Height of the bounding area in local pixels. |
radius |
float |
Corner radius for rounded geometry in pixels. |
paint |
Paint |
Paint styling parameters controlling fill, stroke, tint, and shader. |
DrawScope::circle(float, float, float, float, Paint)
Draw Circle / Ellipse
Draws an ellipse or circle inscribed inside the specified bounding box.
| Parameter | Type | Description |
|---|---|---|
x |
float |
X coordinate of the destination rectangle in local scope space. |
y |
float |
Y coordinate of the destination rectangle in local scope space. |
width |
float |
Width of the bounding area in local pixels. |
height |
float |
Height of the bounding area in local pixels. |
paint |
Paint |
Paint styling parameters controlling fill, stroke, tint, and shader. |
DrawScope::line(float, float, float, float, Paint)
Draw Line
Draws a straight line between two points using Paint styling.
| Parameter | Type | Description |
|---|---|---|
x1 |
float |
X coordinate of the first point. |
y1 |
float |
Y coordinate of the first point. |
x2 |
float |
X coordinate of the second point. |
y2 |
float |
Y coordinate of the second point. |
paint |
Paint |
Paint styling parameters controlling fill, stroke, tint, and shader. |
DrawScope::path(VectorPath, float, float, float, float, Paint)
Draw Vector Path
Draws a reusable VectorPath fitted within target bounds using Paint styling.
| Parameter | Type | Description |
|---|---|---|
path |
VectorPath |
Reusable vector path instance containing the shape contour. |
x |
float |
X coordinate of the destination rectangle in local scope space. |
y |
float |
Y coordinate of the destination rectangle in local scope space. |
width |
float |
Width of the bounding area in local pixels. |
height |
float |
Height of the bounding area in local pixels. |
paint |
Paint |
Paint styling parameters controlling fill, stroke, tint, and shader. |
DrawScope::rectFilled(float, float, float, float, ColorView)
Draw Filled Rectangle (Garbage-Free)
Draws a solid filled rectangle with zero allocations by passing ColorView directly.
| Parameter | Type | Description |
|---|---|---|
x |
float |
X coordinate of the destination rectangle in local scope space. |
y |
float |
Y coordinate of the destination rectangle in local scope space. |
width |
float |
Width of the bounding area in local pixels. |
height |
float |
Height of the bounding area in local pixels. |
color |
ColorView |
Direct ColorView for solid fill or stroke without allocating Paint. |
DrawScope::rectStroke(float, float, float, float, ColorView, float)
Draw Rectangle Outline (Garbage-Free)
Draws a stroked rectangle outline with zero allocations.
| Parameter | Type | Description |
|---|---|---|
x |
float |
X coordinate of the destination rectangle in local scope space. |
y |
float |
Y coordinate of the destination rectangle in local scope space. |
width |
float |
Width of the bounding area in local pixels. |
height |
float |
Height of the bounding area in local pixels. |
color |
ColorView |
Direct ColorView for solid fill or stroke without allocating Paint. |
strokeWidth |
float |
Thickness of the stroke outline in local pixels. |
DrawScope::roundedRectFilled(float, float, float, float, float, ColorView)
Draw Filled Rounded Rectangle (Garbage-Free)
Draws a solid filled rounded rectangle with zero allocations.
| Parameter | Type | Description |
|---|---|---|
x |
float |
X coordinate of the destination rectangle in local scope space. |
y |
float |
Y coordinate of the destination rectangle in local scope space. |
width |
float |
Width of the bounding area in local pixels. |
height |
float |
Height of the bounding area in local pixels. |
radius |
float |
Corner radius for rounded geometry in pixels. |
color |
ColorView |
Direct ColorView for solid fill or stroke without allocating Paint. |
DrawScope::roundedRectStroke(float, float, float, float, float, ColorView, float)
Draw Rounded Rectangle Outline (Garbage-Free)
Draws a stroked rounded rectangle outline with zero allocations.
| Parameter | Type | Description |
|---|---|---|
x |
float |
X coordinate of the destination rectangle in local scope space. |
y |
float |
Y coordinate of the destination rectangle in local scope space. |
width |
float |
Width of the bounding area in local pixels. |
height |
float |
Height of the bounding area in local pixels. |
radius |
float |
Corner radius for rounded geometry in pixels. |
color |
ColorView |
Direct ColorView for solid fill or stroke without allocating Paint. |
strokeWidth |
float |
Thickness of the stroke outline in local pixels. |
DrawScope::circleFilled(float, float, float, float, ColorView)
Draw Filled Circle (Garbage-Free)
Draws a solid filled circle or ellipse with zero allocations.
| Parameter | Type | Description |
|---|---|---|
x |
float |
X coordinate of the destination rectangle in local scope space. |
y |
float |
Y coordinate of the destination rectangle in local scope space. |
width |
float |
Width of the bounding area in local pixels. |
height |
float |
Height of the bounding area in local pixels. |
color |
ColorView |
Direct ColorView for solid fill or stroke without allocating Paint. |
DrawScope::circleStroke(float, float, float, float, ColorView, float)
Draw Circle Outline (Garbage-Free)
Draws a stroked circle or ellipse outline with zero allocations.
| Parameter | Type | Description |
|---|---|---|
x |
float |
X coordinate of the destination rectangle in local scope space. |
y |
float |
Y coordinate of the destination rectangle in local scope space. |
width |
float |
Width of the bounding area in local pixels. |
height |
float |
Height of the bounding area in local pixels. |
color |
ColorView |
Direct ColorView for solid fill or stroke without allocating Paint. |
strokeWidth |
float |
Thickness of the stroke outline in local pixels. |
Textures, Nine-Slice & Shaders
| Method | Description |
|---|---|
texture(TextureHandle, float, float, float, float, Paint) |
Draws a texture stretched over destination bounds with Paint tint. |
texture(TextureHandle, TexturePlacement, float, Paint) |
Draws a texture using UV placement parameters and optional corner radius. |
nineSlice(NineSlice, float, float, float, float, Paint) |
Draws a scalable 9-slice panel preserving corners and tiling/stretching borders and center. |
nineSlice(NineSlice, float, float, float, float, Paint, boolean) |
Draws a 9-slice panel with an option to omit the central tile, leaving a hollow frame. |
textureTinted(TextureHandle, float, float, float, float, ColorView) |
Draws a textured rectangle tinted with a direct ColorView without allocating Paint. |
textureTinted(TextureHandle, TexturePlacement, float, ColorView) |
Draws a texture with UV placement, corner radius, and direct ColorView tint. |
shader(ShaderHandle, float, float, float, float, ShaderUniforms, ShaderDrawOptions) |
Executes a custom shader pass within the specified bounding rectangle with uniforms. |
DrawScope::texture(TextureHandle, float, float, float, float, Paint)
Draw Texture
Draws a texture stretched over destination bounds with Paint tint.
| Parameter | Type | Description |
|---|---|---|
texture |
TextureHandle |
Handle to the GPU texture resource. |
x |
float |
X coordinate of the destination rectangle in local scope space. |
y |
float |
Y coordinate of the destination rectangle in local scope space. |
width |
float |
Width of the bounding area in local pixels. |
height |
float |
Height of the bounding area in local pixels. |
paint |
Paint |
Paint styling parameters controlling fill, stroke, tint, and shader. |
DrawScope::texture(TextureHandle, TexturePlacement, float, Paint)
Draw Texture with Placement & Radius
Draws a texture using UV placement parameters and optional corner radius.
| Parameter | Type | Description |
|---|---|---|
texture |
TextureHandle |
Handle to the GPU texture resource. |
placement |
TexturePlacement |
TexturePlacement defining destination rectangle and source UV bounds. |
radius |
float |
Corner radius for rounded geometry in pixels. |
paint |
Paint |
Paint styling parameters controlling fill, stroke, tint, and shader. |
DrawScope::nineSlice(NineSlice, float, float, float, float, Paint)
Draw Nine-Slice Panel
Draws a scalable 9-slice panel preserving corners and tiling/stretching borders and center.
| Parameter | Type | Description |
|---|---|---|
slice |
NineSlice |
NineSlice configuration defining texture margins and scale. |
x |
float |
X coordinate of the destination rectangle in local scope space. |
y |
float |
Y coordinate of the destination rectangle in local scope space. |
width |
float |
Width of the bounding area in local pixels. |
height |
float |
Height of the bounding area in local pixels. |
paint |
Paint |
Paint styling parameters controlling fill, stroke, tint, and shader. |
DrawScope::nineSlice(NineSlice, float, float, float, float, Paint, boolean)
Draw Nine-Slice with Hollow Center Option
Draws a 9-slice panel with an option to omit the central tile, leaving a hollow frame.
| Parameter | Type | Description |
|---|---|---|
slice |
NineSlice |
NineSlice configuration defining texture margins and scale. |
x |
float |
X coordinate of the destination rectangle in local scope space. |
y |
float |
Y coordinate of the destination rectangle in local scope space. |
width |
float |
Width of the bounding area in local pixels. |
height |
float |
Height of the bounding area in local pixels. |
paint |
Paint |
Paint styling parameters controlling fill, stroke, tint, and shader. |
fillCenter |
boolean |
Whether to draw the center tile (false leaves a hollow frame). |
DrawScope::textureTinted(TextureHandle, float, float, float, float, ColorView)
Draw Tinted Texture (Garbage-Free)
Draws a textured rectangle tinted with a direct ColorView without allocating Paint.
| Parameter | Type | Description |
|---|---|---|
texture |
TextureHandle |
Handle to the GPU texture resource. |
x |
float |
X coordinate of the destination rectangle in local scope space. |
y |
float |
Y coordinate of the destination rectangle in local scope space. |
width |
float |
Width of the bounding area in local pixels. |
height |
float |
Height of the bounding area in local pixels. |
tint |
ColorView |
ColorView tint multiplied with the texture pixels. |
DrawScope::textureTinted(TextureHandle, TexturePlacement, float, ColorView)
Draw Tinted Texture with Placement (Garbage-Free)
Draws a texture with UV placement, corner radius, and direct ColorView tint.
| Parameter | Type | Description |
|---|---|---|
texture |
TextureHandle |
Handle to the GPU texture resource. |
placement |
TexturePlacement |
TexturePlacement defining destination rectangle and source UV bounds. |
radius |
float |
Corner radius for rounded geometry in pixels. |
tint |
ColorView |
ColorView tint multiplied with the texture pixels. |
DrawScope::shader(ShaderHandle, float, float, float, float, ShaderUniforms, ShaderDrawOptions)
Draw with Custom Shader
Executes a custom shader pass within the specified bounding rectangle with uniforms.
| Parameter | Type | Description |
|---|---|---|
shader |
ShaderHandle |
Handle to the compiled custom shader. |
x |
float |
X coordinate of the destination rectangle in local scope space. |
y |
float |
Y coordinate of the destination rectangle in local scope space. |
width |
float |
Width of the bounding area in local pixels. |
height |
float |
Height of the bounding area in local pixels. |
uniforms |
ShaderUniforms |
Shader uniform parameters passed to the program. |
options |
ShaderDrawOptions |
Shader execution options or ribbon styling settings. |
Text Rendering
| Method | Description |
|---|---|
text(String, float, float, float, float, Paint) |
Renders a plain text string within bounding bounds using Paint styling. |
text(RichText, float, float, float, float, Paint) |
Renders a formatted RichText structure with pixel snapping enabled. |
text(RichText, float, float, float, float, Paint, boolean) |
Renders a formatted RichText structure with configurable glyph pixel snapping. |
addText(String, float, float, float, float, ColorView) |
Records a plain text drawing command with direct ColorView tint and zero Paint allocations. |
addText(RichText, float, float, float, float, ColorView) |
Records a formatted RichText drawing command with direct ColorView tint. |
DrawScope::text(String, float, float, float, float, Paint)
Draw Plain Text
Renders a plain text string within bounding bounds using Paint styling.
| Parameter | Type | Description |
|---|---|---|
text |
String |
Text string or RichText content to render. |
x |
float |
X coordinate of the destination rectangle in local scope space. |
y |
float |
Y coordinate of the destination rectangle in local scope space. |
width |
float |
Width of the bounding area in local pixels. |
height |
float |
Height of the bounding area in local pixels. |
paint |
Paint |
Paint styling parameters controlling fill, stroke, tint, and shader. |
DrawScope::text(RichText, float, float, float, float, Paint)
Draw Rich Text
Renders a formatted RichText structure with pixel snapping enabled.
| Parameter | Type | Description |
|---|---|---|
text |
RichText |
Text string or RichText content to render. |
x |
float |
X coordinate of the destination rectangle in local scope space. |
y |
float |
Y coordinate of the destination rectangle in local scope space. |
width |
float |
Width of the bounding area in local pixels. |
height |
float |
Height of the bounding area in local pixels. |
paint |
Paint |
Paint styling parameters controlling fill, stroke, tint, and shader. |
DrawScope::text(RichText, float, float, float, float, Paint, boolean)
Draw Rich Text with Snapping Option
Renders a formatted RichText structure with configurable glyph pixel snapping.
| Parameter | Type | Description |
|---|---|---|
text |
RichText |
Text string or RichText content to render. |
x |
float |
X coordinate of the destination rectangle in local scope space. |
y |
float |
Y coordinate of the destination rectangle in local scope space. |
width |
float |
Width of the bounding area in local pixels. |
height |
float |
Height of the bounding area in local pixels. |
paint |
Paint |
Paint styling parameters controlling fill, stroke, tint, and shader. |
textPixelSnap |
boolean |
Whether to align glyph positions to integer display pixels. |
DrawScope::addText(String, float, float, float, float, ColorView)
Add Text Command (Garbage-Free)
Records a plain text drawing command with direct ColorView tint and zero Paint allocations.
| Parameter | Type | Description |
|---|---|---|
text |
String |
Text string or RichText content to render. |
x |
float |
X coordinate of the destination rectangle in local scope space. |
y |
float |
Y coordinate of the destination rectangle in local scope space. |
width |
float |
Width of the bounding area in local pixels. |
height |
float |
Height of the bounding area in local pixels. |
color |
ColorView |
Direct ColorView for solid fill or stroke without allocating Paint. |
DrawScope::addText(RichText, float, float, float, float, ColorView)
Add Rich Text Command (Garbage-Free)
Records a formatted RichText drawing command with direct ColorView tint.
| Parameter | Type | Description |
|---|---|---|
text |
RichText |
Text string or RichText content to render. |
x |
float |
X coordinate of the destination rectangle in local scope space. |
y |
float |
Y coordinate of the destination rectangle in local scope space. |
width |
float |
Width of the bounding area in local pixels. |
height |
float |
Height of the bounding area in local pixels. |
color |
ColorView |
Direct ColorView for solid fill or stroke without allocating Paint. |
Direct Geometry & Meshes
| Method | Description |
|---|---|
addDrawCmd(DrawCommand) |
Appends a pre-built DrawCommand, automatically adjusting its transform pivot. |
addCallback(CustomDraw) |
Inserts a custom drawing callback executed during backend command replay. |
addLine(float, float, float, float, ColorView, float) |
Appends a line command between two points with exact color and pixel thickness. |
addRect(float, float, float, float, ColorView, float) |
Appends a stroked rectangular frame with specified border thickness. |
addRect(float, float, float, float, float, ColorView, float) |
Appends a stroked rounded rectangle frame with corner radius and thickness. |
addRectFilled(float, float, float, float, ColorView) |
Appends a solid rectangle fill command with direct ColorView tint. |
addRectFilled(float, float, float, float, float, ColorView) |
Appends a solid rounded rectangle fill command with specified corner radius. |
addRectFilledMultiColor(float, float, float, float, ColorView, ColorView, ColorView, ColorView) |
Renders a rectangle with per-vertex color interpolation at each of the 4 corners. |
addQuad(DrawPoint, DrawPoint, DrawPoint, DrawPoint, ColorView, float) |
Appends a stroked arbitrary four-sided polygon defined by four vertices. |
addQuadFilled(DrawPoint, DrawPoint, DrawPoint, DrawPoint, ColorView) |
Appends a filled arbitrary quadrilateral defined by four vertices. |
addTriangle(DrawPoint, DrawPoint, DrawPoint, ColorView, float) |
Appends a stroked triangle outline defined by three points. |
addTriangleFilled(DrawPoint, DrawPoint, DrawPoint, ColorView) |
Appends a solid filled triangle defined by three points. |
addCircle(float, float, float, ColorView, int, float) |
Appends a stroked circle outline tessellated with the given segment count. |
addCircleFilled(float, float, float, ColorView, int) |
Appends a solid filled circle tessellated with the given segment count. |
addNgon(float, float, float, ColorView, int, float) |
Appends a stroked regular N-gon outline (pentagon, hexagon, octagon, etc.). |
addNgonFilled(float, float, float, ColorView, int) |
Appends a solid filled regular N-sided polygon. |
addEllipse(float, float, float, float, ColorView, int, float) |
Appends a stroked ellipse outline with independent X and Y radii. |
addEllipseFilled(float, float, float, float, ColorView, int) |
Appends a solid filled ellipse with independent X and Y radii. |
addPolyline(List, ColorView, boolean, float) |
Appends a multi-segment line path connecting a sequence of points. |
addConvexPolyFilled(List, ColorView) |
Appends a solid fill command for a convex polygon of arbitrary vertices. |
addConcavePolyFilled(List, ColorView) |
Appends a solid fill command for a complex concave polygon using ear-clipping. |
addImage(TextureHandle, float, float, float, float, ColorView) |
Appends a textured rectangle command with full UV coverage and color tint. |
addImage(TextureHandle, float, float, float, float, DrawPoint, DrawPoint, ColorView) |
Appends a textured rectangle sampled from an atlas using UV min/max coordinates. |
addImageQuad(TextureHandle, DrawPoint, DrawPoint, DrawPoint, DrawPoint, DrawPoint, DrawPoint, DrawPoint, DrawPoint, ColorView) |
Appends an arbitrary quadrilateral with individual per-vertex UV mappings. |
addTexturedQuad(TextureHandle, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, ColorView) |
Appends a textured quad using raw primitive float coordinates without creating DrawPoint instances. |
addImageRounded(TextureHandle, float, float, float, float, DrawPoint, DrawPoint, ColorView, float) |
Appends an image clipped to a rounded rectangle with corner radius. |
addMesh(DrawMesh, TextureHandle) |
Submits a raw vertex/index DrawMesh with an optional bound texture. |
ribbon(TextureHandle, List, float, float, ColorView, RibbonOptions) |
Renders a textured ribbon along a polyline path with miter joints and configurable RibbonOptions. |
ribbon(TextureHandle, List, float, float, ColorView) |
Renders a textured ribbon along a polyline with default options. |
ribbon(TextureHandle, List, float, float, ColorView, boolean) |
Renders a closed textured ribbon loop along a polyline. |
ribbon(TextureHandle, List, float, float, ColorView, boolean, boolean) |
Renders a ribbon with UV axis swapped for vertical strip textures. |
ribbon(TextureHandle, List, float, float, ColorView, boolean, boolean, boolean, boolean) |
Renders a ribbon with full control over UV swapping and flipping. |
DrawScope::addDrawCmd(DrawCommand)
Append Raw Draw Command
Appends a pre-built DrawCommand, automatically adjusting its transform pivot.
| Parameter | Type | Description |
|---|---|---|
command |
DrawCommand |
Pre-built DrawCommand to append directly. |
DrawScope::addCallback(CustomDraw)
Add Custom Draw Callback
Inserts a custom drawing callback executed during backend command replay.
| Parameter | Type | Description |
|---|---|---|
callback |
CustomDraw |
CustomDraw callback executed during backend rendering. |
DrawScope::addLine(float, float, float, float, ColorView, float)
Add Line with Thickness
Appends a line command between two points with exact color and pixel thickness.
| Parameter | Type | Description |
|---|---|---|
x1 |
float |
X coordinate of the first point. |
y1 |
float |
Y coordinate of the first point. |
x2 |
float |
X coordinate of the second point. |
y2 |
float |
Y coordinate of the second point. |
color |
ColorView |
Direct ColorView for solid fill or stroke without allocating Paint. |
thickness |
float |
Line or outline thickness in local pixels. |
DrawScope::addRect(float, float, float, float, ColorView, float)
Add Rectangle Frame
Appends a stroked rectangular frame with specified border thickness.
| Parameter | Type | Description |
|---|---|---|
x |
float |
X coordinate of the destination rectangle in local scope space. |
y |
float |
Y coordinate of the destination rectangle in local scope space. |
width |
float |
Width of the bounding area in local pixels. |
height |
float |
Height of the bounding area in local pixels. |
color |
ColorView |
Direct ColorView for solid fill or stroke without allocating Paint. |
thickness |
float |
Line or outline thickness in local pixels. |
DrawScope::addRect(float, float, float, float, float, ColorView, float)
Add Rounded Rectangle Frame
Appends a stroked rounded rectangle frame with corner radius and thickness.
| Parameter | Type | Description |
|---|---|---|
x |
float |
X coordinate of the destination rectangle in local scope space. |
y |
float |
Y coordinate of the destination rectangle in local scope space. |
width |
float |
Width of the bounding area in local pixels. |
height |
float |
Height of the bounding area in local pixels. |
radius |
float |
Corner radius for rounded geometry in pixels. |
color |
ColorView |
Direct ColorView for solid fill or stroke without allocating Paint. |
thickness |
float |
Line or outline thickness in local pixels. |
DrawScope::addRectFilled(float, float, float, float, ColorView)
Add Solid Filled Rectangle
Appends a solid rectangle fill command with direct ColorView tint.
| Parameter | Type | Description |
|---|---|---|
x |
float |
X coordinate of the destination rectangle in local scope space. |
y |
float |
Y coordinate of the destination rectangle in local scope space. |
width |
float |
Width of the bounding area in local pixels. |
height |
float |
Height of the bounding area in local pixels. |
color |
ColorView |
Direct ColorView for solid fill or stroke without allocating Paint. |
DrawScope::addRectFilled(float, float, float, float, float, ColorView)
Add Solid Filled Rounded Rectangle
Appends a solid rounded rectangle fill command with specified corner radius.
| Parameter | Type | Description |
|---|---|---|
x |
float |
X coordinate of the destination rectangle in local scope space. |
y |
float |
Y coordinate of the destination rectangle in local scope space. |
width |
float |
Width of the bounding area in local pixels. |
height |
float |
Height of the bounding area in local pixels. |
radius |
float |
Corner radius for rounded geometry in pixels. |
color |
ColorView |
Direct ColorView for solid fill or stroke without allocating Paint. |
DrawScope::addRectFilledMultiColor(float, float, float, float, ColorView, ColorView, ColorView, ColorView)
Add 4-Corner Gradient Rectangle
Renders a rectangle with per-vertex color interpolation at each of the 4 corners.
| Parameter | Type | Description |
|---|---|---|
x |
float |
X coordinate of the destination rectangle in local scope space. |
y |
float |
Y coordinate of the destination rectangle in local scope space. |
width |
float |
Width of the bounding area in local pixels. |
height |
float |
Height of the bounding area in local pixels. |
topLeft |
ColorView |
Color applied to the top-left vertex. |
topRight |
ColorView |
Color applied to the top-right vertex. |
bottomRight |
ColorView |
Color applied to the bottom-right vertex. |
bottomLeft |
ColorView |
Color applied to the bottom-left vertex. |
DrawScope::addQuad(DrawPoint, DrawPoint, DrawPoint, DrawPoint, ColorView, float)
Add Quad Outline
Appends a stroked arbitrary four-sided polygon defined by four vertices.
| Parameter | Type | Description |
|---|---|---|
p1 |
DrawPoint |
First point defining the quad or triangle. |
p2 |
DrawPoint |
Second point defining the quad or triangle. |
p3 |
DrawPoint |
Third point defining the quad or triangle. |
p4 |
DrawPoint |
Fourth point defining the quadrilateral. |
color |
ColorView |
Direct ColorView for solid fill or stroke without allocating Paint. |
thickness |
float |
Line or outline thickness in local pixels. |
DrawScope::addQuadFilled(DrawPoint, DrawPoint, DrawPoint, DrawPoint, ColorView)
Add Filled Quad
Appends a filled arbitrary quadrilateral defined by four vertices.
| Parameter | Type | Description |
|---|---|---|
p1 |
DrawPoint |
First point defining the quad or triangle. |
p2 |
DrawPoint |
Second point defining the quad or triangle. |
p3 |
DrawPoint |
Third point defining the quad or triangle. |
p4 |
DrawPoint |
Fourth point defining the quadrilateral. |
color |
ColorView |
Direct ColorView for solid fill or stroke without allocating Paint. |
DrawScope::addTriangle(DrawPoint, DrawPoint, DrawPoint, ColorView, float)
Add Triangle Outline
Appends a stroked triangle outline defined by three points.
| Parameter | Type | Description |
|---|---|---|
p1 |
DrawPoint |
First point defining the quad or triangle. |
p2 |
DrawPoint |
Second point defining the quad or triangle. |
p3 |
DrawPoint |
Third point defining the quad or triangle. |
color |
ColorView |
Direct ColorView for solid fill or stroke without allocating Paint. |
thickness |
float |
Line or outline thickness in local pixels. |
DrawScope::addTriangleFilled(DrawPoint, DrawPoint, DrawPoint, ColorView)
Add Filled Triangle
Appends a solid filled triangle defined by three points.
| Parameter | Type | Description |
|---|---|---|
p1 |
DrawPoint |
First point defining the quad or triangle. |
p2 |
DrawPoint |
Second point defining the quad or triangle. |
p3 |
DrawPoint |
Third point defining the quad or triangle. |
color |
ColorView |
Direct ColorView for solid fill or stroke without allocating Paint. |
DrawScope::addCircle(float, float, float, ColorView, int, float)
Add Circle Outline with Segments
Appends a stroked circle outline tessellated with the given segment count.
| Parameter | Type | Description |
|---|---|---|
centerX |
float |
X coordinate of the circle/polygon center. |
centerY |
float |
Y coordinate of the circle/polygon center. |
radius |
float |
Corner radius for rounded geometry in pixels. |
color |
ColorView |
Direct ColorView for solid fill or stroke without allocating Paint. |
segments |
int |
Number of segments approximating the curve/polygon. |
thickness |
float |
Line or outline thickness in local pixels. |
DrawScope::addCircleFilled(float, float, float, ColorView, int)
Add Filled Circle with Segments
Appends a solid filled circle tessellated with the given segment count.
| Parameter | Type | Description |
|---|---|---|
centerX |
float |
X coordinate of the circle/polygon center. |
centerY |
float |
Y coordinate of the circle/polygon center. |
radius |
float |
Corner radius for rounded geometry in pixels. |
color |
ColorView |
Direct ColorView for solid fill or stroke without allocating Paint. |
segments |
int |
Number of segments approximating the curve/polygon. |
DrawScope::addNgon(float, float, float, ColorView, int, float)
Add Regular Polygon Outline
Appends a stroked regular N-gon outline (pentagon, hexagon, octagon, etc.).
| Parameter | Type | Description |
|---|---|---|
centerX |
float |
X coordinate of the circle/polygon center. |
centerY |
float |
Y coordinate of the circle/polygon center. |
radius |
float |
Corner radius for rounded geometry in pixels. |
color |
ColorView |
Direct ColorView for solid fill or stroke without allocating Paint. |
segments |
int |
Number of segments approximating the curve/polygon. |
thickness |
float |
Line or outline thickness in local pixels. |
DrawScope::addNgonFilled(float, float, float, ColorView, int)
Add Filled Regular Polygon
Appends a solid filled regular N-sided polygon.
| Parameter | Type | Description |
|---|---|---|
centerX |
float |
X coordinate of the circle/polygon center. |
centerY |
float |
Y coordinate of the circle/polygon center. |
radius |
float |
Corner radius for rounded geometry in pixels. |
color |
ColorView |
Direct ColorView for solid fill or stroke without allocating Paint. |
segments |
int |
Number of segments approximating the curve/polygon. |
DrawScope::addEllipse(float, float, float, float, ColorView, int, float)
Add Ellipse Outline
Appends a stroked ellipse outline with independent X and Y radii.
| Parameter | Type | Description |
|---|---|---|
centerX |
float |
X coordinate of the circle/polygon center. |
centerY |
float |
Y coordinate of the circle/polygon center. |
radiusX |
float |
Horizontal radius along the X axis. |
radiusY |
float |
Vertical radius along the Y axis. |
color |
ColorView |
Direct ColorView for solid fill or stroke without allocating Paint. |
segments |
int |
Number of segments approximating the curve/polygon. |
thickness |
float |
Line or outline thickness in local pixels. |
DrawScope::addEllipseFilled(float, float, float, float, ColorView, int)
Add Filled Ellipse
Appends a solid filled ellipse with independent X and Y radii.
| Parameter | Type | Description |
|---|---|---|
centerX |
float |
X coordinate of the circle/polygon center. |
centerY |
float |
Y coordinate of the circle/polygon center. |
radiusX |
float |
Horizontal radius along the X axis. |
radiusY |
float |
Vertical radius along the Y axis. |
color |
ColorView |
Direct ColorView for solid fill or stroke without allocating Paint. |
segments |
int |
Number of segments approximating the curve/polygon. |
DrawScope::addPolyline(List, ColorView, boolean, float)
Add Connected Polyline
Appends a multi-segment line path connecting a sequence of points.
| Parameter | Type | Description |
|---|---|---|
points |
List |
List of 2D vertex points defining the polygon or ribbon. |
color |
ColorView |
Direct ColorView for solid fill or stroke without allocating Paint. |
closed |
boolean |
Whether the polyline or path loop should be closed. |
thickness |
float |
Line or outline thickness in local pixels. |
DrawScope::addConvexPolyFilled(List, ColorView)
Add Filled Convex Polygon
Appends a solid fill command for a convex polygon of arbitrary vertices.
| Parameter | Type | Description |
|---|---|---|
points |
List |
List of 2D vertex points defining the polygon or ribbon. |
color |
ColorView |
Direct ColorView for solid fill or stroke without allocating Paint. |
DrawScope::addConcavePolyFilled(List, ColorView)
Add Filled Concave Polygon
Appends a solid fill command for a complex concave polygon using ear-clipping.
| Parameter | Type | Description |
|---|---|---|
points |
List |
List of 2D vertex points defining the polygon or ribbon. |
color |
ColorView |
Direct ColorView for solid fill or stroke without allocating Paint. |
DrawScope::addImage(TextureHandle, float, float, float, float, ColorView)
Add Image Command
Appends a textured rectangle command with full UV coverage and color tint.
| Parameter | Type | Description |
|---|---|---|
texture |
TextureHandle |
Handle to the GPU texture resource. |
x |
float |
X coordinate of the destination rectangle in local scope space. |
y |
float |
Y coordinate of the destination rectangle in local scope space. |
width |
float |
Width of the bounding area in local pixels. |
height |
float |
Height of the bounding area in local pixels. |
tint |
ColorView |
ColorView tint multiplied with the texture pixels. |
DrawScope::addImage(TextureHandle, float, float, float, float, DrawPoint, DrawPoint, ColorView)
Add Image with Sub-UV Range
Appends a textured rectangle sampled from an atlas using UV min/max coordinates.
| Parameter | Type | Description |
|---|---|---|
texture |
TextureHandle |
Handle to the GPU texture resource. |
x |
float |
X coordinate of the destination rectangle in local scope space. |
y |
float |
Y coordinate of the destination rectangle in local scope space. |
width |
float |
Width of the bounding area in local pixels. |
height |
float |
Height of the bounding area in local pixels. |
uvMin |
DrawPoint |
Top-left UV coordinate in texture space. |
uvMax |
DrawPoint |
Bottom-right UV coordinate in texture space. |
tint |
ColorView |
ColorView tint multiplied with the texture pixels. |
DrawScope::addImageQuad(TextureHandle, DrawPoint, DrawPoint, DrawPoint, DrawPoint, DrawPoint, DrawPoint, DrawPoint, DrawPoint, ColorView)
Add Textured 4-Point Quad
Appends an arbitrary quadrilateral with individual per-vertex UV mappings.
| Parameter | Type | Description |
|---|---|---|
texture |
TextureHandle |
Handle to the GPU texture resource. |
p1 |
DrawPoint |
First point defining the quad or triangle. |
p2 |
DrawPoint |
Second point defining the quad or triangle. |
p3 |
DrawPoint |
Third point defining the quad or triangle. |
p4 |
DrawPoint |
Fourth point defining the quadrilateral. |
uv1 |
DrawPoint |
UV texture coordinate at vertex 1. |
uv2 |
DrawPoint |
UV texture coordinate at vertex 2. |
uv3 |
DrawPoint |
UV texture coordinate at vertex 3. |
uv4 |
DrawPoint |
UV texture coordinate at vertex 4. |
tint |
ColorView |
ColorView tint multiplied with the texture pixels. |
DrawScope::addTexturedQuad(TextureHandle, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, ColorView)
Add Textured Quad (Primitive Floats, Garbage-Free)
Appends a textured quad using raw primitive float coordinates without creating DrawPoint instances.
| Parameter | Type | Description |
|---|---|---|
texture |
TextureHandle |
Handle to the GPU texture resource. |
x1 |
float |
X coordinate of the first point. |
y1 |
float |
Y coordinate of the first point. |
x2 |
float |
X coordinate of the second point. |
y2 |
float |
Y coordinate of the second point. |
x3 |
float |
X coordinate of the third vertex. |
y3 |
float |
Y coordinate of the third vertex. |
x4 |
float |
X coordinate of the fourth vertex. |
y4 |
float |
Y coordinate of the fourth vertex. |
u1 |
float |
Horizontal U texture coordinate for vertex 1. |
v1 |
float |
Vertical V texture coordinate for vertex 1. |
u2 |
float |
Horizontal U texture coordinate for vertex 2. |
v2 |
float |
Vertical V texture coordinate for vertex 2. |
u3 |
float |
Horizontal U texture coordinate for vertex 3. |
v3 |
float |
Vertical V texture coordinate for vertex 3. |
u4 |
float |
Horizontal U texture coordinate for vertex 4. |
v4 |
float |
Vertical V texture coordinate for vertex 4. |
tint |
ColorView |
ColorView tint multiplied with the texture pixels. |
DrawScope::addImageRounded(TextureHandle, float, float, float, float, DrawPoint, DrawPoint, ColorView, float)
Add Rounded Image
Appends an image clipped to a rounded rectangle with corner radius.
| Parameter | Type | Description |
|---|---|---|
texture |
TextureHandle |
Handle to the GPU texture resource. |
x |
float |
X coordinate of the destination rectangle in local scope space. |
y |
float |
Y coordinate of the destination rectangle in local scope space. |
width |
float |
Width of the bounding area in local pixels. |
height |
float |
Height of the bounding area in local pixels. |
uvMin |
DrawPoint |
Top-left UV coordinate in texture space. |
uvMax |
DrawPoint |
Bottom-right UV coordinate in texture space. |
tint |
ColorView |
ColorView tint multiplied with the texture pixels. |
radius |
float |
Corner radius for rounded geometry in pixels. |
DrawScope::addMesh(DrawMesh, TextureHandle)
Add Custom Geometry Mesh
Submits a raw vertex/index DrawMesh with an optional bound texture.
| Parameter | Type | Description |
|---|---|---|
mesh |
DrawMesh |
Precomputed indexed DrawMesh vertex buffer. |
texture |
TextureHandle |
Handle to the GPU texture resource. |
DrawScope::ribbon(TextureHandle, List, float, float, ColorView, RibbonOptions)
Draw Procedural Ribbon with Options
Renders a textured ribbon along a polyline path with miter joints and configurable RibbonOptions.
| Parameter | Type | Description |
|---|---|---|
texture |
TextureHandle |
Handle to the GPU texture resource. |
points |
List |
List of 2D vertex points defining the polygon or ribbon. |
width |
float |
Width of the bounding area in local pixels. |
textureLength |
float |
World-space length of a single repeating texture tile along the path. |
tint |
ColorView |
ColorView tint multiplied with the texture pixels. |
options |
RibbonOptions |
Shader execution options or ribbon styling settings. |
DrawScope::ribbon(TextureHandle, List, float, float, ColorView)
Draw Procedural Ribbon (Deprecated)
Renders a textured ribbon along a polyline with default options.
| Parameter | Type | Description |
|---|---|---|
texture |
TextureHandle |
Handle to the GPU texture resource. |
points |
List |
List of 2D vertex points defining the polygon or ribbon. |
width |
float |
Width of the bounding area in local pixels. |
textureLength |
float |
World-space length of a single repeating texture tile along the path. |
tint |
ColorView |
ColorView tint multiplied with the texture pixels. |
DrawScope::ribbon(TextureHandle, List, float, float, ColorView, boolean)
Draw Procedural Ribbon Closed (Deprecated)
Renders a closed textured ribbon loop along a polyline.
| Parameter | Type | Description |
|---|---|---|
texture |
TextureHandle |
Handle to the GPU texture resource. |
points |
List |
List of 2D vertex points defining the polygon or ribbon. |
width |
float |
Width of the bounding area in local pixels. |
textureLength |
float |
World-space length of a single repeating texture tile along the path. |
tint |
ColorView |
ColorView tint multiplied with the texture pixels. |
closed |
boolean |
Whether the polyline or path loop should be closed. |
DrawScope::ribbon(TextureHandle, List, float, float, ColorView, boolean, boolean)
Draw Ribbon with UV Orientation (Deprecated)
Renders a ribbon with UV axis swapped for vertical strip textures.
| Parameter | Type | Description |
|---|---|---|
texture |
TextureHandle |
Handle to the GPU texture resource. |
points |
List |
List of 2D vertex points defining the polygon or ribbon. |
width |
float |
Width of the bounding area in local pixels. |
textureLength |
float |
World-space length of a single repeating texture tile along the path. |
tint |
ColorView |
ColorView tint multiplied with the texture pixels. |
closed |
boolean |
Whether the polyline or path loop should be closed. |
swapUv |
boolean |
Whether to swap U and V axes for vertical strip textures. |
DrawScope::ribbon(TextureHandle, List, float, float, ColorView, boolean, boolean, boolean, boolean)
Draw Ribbon with Transform Flags (Deprecated)
Renders a ribbon with full control over UV swapping and flipping.
| Parameter | Type | Description |
|---|---|---|
texture |
TextureHandle |
Handle to the GPU texture resource. |
points |
List |
List of 2D vertex points defining the polygon or ribbon. |
width |
float |
Width of the bounding area in local pixels. |
textureLength |
float |
World-space length of a single repeating texture tile along the path. |
tint |
ColorView |
ColorView tint multiplied with the texture pixels. |
closed |
boolean |
Whether the polyline or path loop should be closed. |
swapUv |
boolean |
Whether to swap U and V axes for vertical strip textures. |
flipU |
boolean |
Whether to invert horizontal texture mapping within each tile. |
flipV |
boolean |
Whether to invert vertical texture mapping within each tile. |
Vector Paths & Channels
| Method | Description |
|---|---|
channelsSplit(int) |
Splits the draw command stream into multiple independent visual depth channels. |
channelsMerge() |
Merges previously split channels back in sequential layer order. |
channelsSetCurrent(int) |
Switches the active output target channel index for subsequent drawing commands. |
path() |
Returns the context's internal reusable VectorPath builder. |
pathClear() |
Resets the active vector path, clearing all recorded vertices and segments. |
pathLineTo(DrawPoint) |
Appends a point vertex to the active vector path. |
pathLineTo(float, float) |
Appends coordinate values (x, y) to the active vector path. |
pathLineToMergeDuplicate(DrawPoint) |
Appends a point vertex, ignoring it if it matches the previous vertex within epsilon. |
pathLineToMergeDuplicate(float, float) |
Appends coordinates (x, y), ignoring them if identical to the previous vertex. |
pathFillConvex(ColorView) |
Fills the active convex vector path using the specified ColorView. |
pathStroke(ColorView, boolean, float) |
Strokes the active vector path with specified color and line thickness. |
pathArcTo(float, float, float, float, float, int) |
Appends a circular arc segment to the active path between minimum and maximum angles. |
pathArcToFast(float, float, float, int, int) |
Appends an arc using precomputed 12-sample trigonometric lookup tables. |
pathBezierCubicCurveTo(float, float, float, float, float, float, int) |
Appends a cubic Bezier curve segment defined by two control points and an endpoint. |
pathBezierQuadraticCurveTo(float, float, float, float, int) |
Appends a quadratic Bezier curve segment with one control point and an endpoint. |
pathRect(float, float, float, float) |
Appends the 4 vertices of a rectangle to the active vector path. |
pathRect(float, float, float, float, float) |
Appends corner arc vertices for a rounded rectangle to the active vector path. |
DrawScope::channelsSplit(int)
Split Draw Channels
Splits the draw command stream into multiple independent visual depth channels.
| Parameter | Type | Description |
|---|---|---|
count |
int |
Number of separate drawing channels to allocate. |
DrawScope::channelsMerge()
Merge Draw Channels
Merges previously split channels back in sequential layer order.
DrawScope::channelsSetCurrent(int)
Set Active Channel
Switches the active output target channel index for subsequent drawing commands.
| Parameter | Type | Description |
|---|---|---|
channel |
int |
Target channel index for subsequent draw commands. |
DrawScope::path()
Get Active Vector Path
Returns the context's internal reusable VectorPath builder.
Returns VectorPath: Active VectorPath instance..
DrawScope::pathClear()
Clear Path Points
Resets the active vector path, clearing all recorded vertices and segments.
DrawScope::pathLineTo(DrawPoint)
Add Point to Path
Appends a point vertex to the active vector path.
| Parameter | Type | Description |
|---|---|---|
point |
DrawPoint |
Vertex point coordinates to append. |
DrawScope::pathLineTo(float, float)
Add Coordinates to Path
Appends coordinate values (x, y) to the active vector path.
| Parameter | Type | Description |
|---|---|---|
x |
float |
X coordinate of the destination rectangle in local scope space. |
y |
float |
Y coordinate of the destination rectangle in local scope space. |
DrawScope::pathLineToMergeDuplicate(DrawPoint)
Add Point Merging Duplicates
Appends a point vertex, ignoring it if it matches the previous vertex within epsilon.
| Parameter | Type | Description |
|---|---|---|
point |
DrawPoint |
Vertex point coordinates to append. |
DrawScope::pathLineToMergeDuplicate(float, float)
Add Coordinates Merging Duplicates
Appends coordinates (x, y), ignoring them if identical to the previous vertex.
| Parameter | Type | Description |
|---|---|---|
x |
float |
X coordinate of the destination rectangle in local scope space. |
y |
float |
Y coordinate of the destination rectangle in local scope space. |
DrawScope::pathFillConvex(ColorView)
Fill Convex Path
Fills the active convex vector path using the specified ColorView.
| Parameter | Type | Description |
|---|---|---|
color |
ColorView |
Direct ColorView for solid fill or stroke without allocating Paint. |
DrawScope::pathStroke(ColorView, boolean, float)
Stroke Path Outline
Strokes the active vector path with specified color and line thickness.
| Parameter | Type | Description |
|---|---|---|
color |
ColorView |
Direct ColorView for solid fill or stroke without allocating Paint. |
closed |
boolean |
Whether the polyline or path loop should be closed. |
thickness |
float |
Line or outline thickness in local pixels. |
DrawScope::pathArcTo(float, float, float, float, float, int)
Append Arc to Path
Appends a circular arc segment to the active path between minimum and maximum angles.
| Parameter | Type | Description |
|---|---|---|
centerX |
float |
X coordinate of the circle/polygon center. |
centerY |
float |
Y coordinate of the circle/polygon center. |
radius |
float |
Corner radius for rounded geometry in pixels. |
minAngle |
float |
Starting arc angle in radians. |
maxAngle |
float |
Ending arc angle in radians. |
segments |
int |
Number of segments approximating the curve/polygon. |
DrawScope::pathArcToFast(float, float, float, int, int)
Append Fast Lookup Arc to Path
Appends an arc using precomputed 12-sample trigonometric lookup tables.
| Parameter | Type | Description |
|---|---|---|
centerX |
float |
X coordinate of the circle/polygon center. |
centerY |
float |
Y coordinate of the circle/polygon center. |
radius |
float |
Corner radius for rounded geometry in pixels. |
minSampleOf12 |
int |
Starting index in the 12-sample precomputed circle table. |
maxSampleOf12 |
int |
Ending index in the 12-sample precomputed circle table. |
DrawScope::pathBezierCubicCurveTo(float, float, float, float, float, float, int)
Append Cubic Bezier Curve to Path
Appends a cubic Bezier curve segment defined by two control points and an endpoint.
| Parameter | Type | Description |
|---|---|---|
controlX1 |
float |
X coordinate of the first cubic Bezier control point. |
controlY1 |
float |
Y coordinate of the first cubic Bezier control point. |
controlX2 |
float |
X coordinate of the second cubic Bezier control point. |
controlY2 |
float |
Y coordinate of the second cubic Bezier control point. |
x |
float |
X coordinate of the destination rectangle in local scope space. |
y |
float |
Y coordinate of the destination rectangle in local scope space. |
segments |
int |
Number of segments approximating the curve/polygon. |
DrawScope::pathBezierQuadraticCurveTo(float, float, float, float, int)
Append Quadratic Bezier Curve to Path
Appends a quadratic Bezier curve segment with one control point and an endpoint.
| Parameter | Type | Description |
|---|---|---|
controlX |
float |
X coordinate of the single quadratic Bezier control point. |
controlY |
float |
Y coordinate of the single quadratic Bezier control point. |
x |
float |
X coordinate of the destination rectangle in local scope space. |
y |
float |
Y coordinate of the destination rectangle in local scope space. |
segments |
int |
Number of segments approximating the curve/polygon. |
DrawScope::pathRect(float, float, float, float)
Append Rectangle to Path
Appends the 4 vertices of a rectangle to the active vector path.
| Parameter | Type | Description |
|---|---|---|
x |
float |
X coordinate of the destination rectangle in local scope space. |
y |
float |
Y coordinate of the destination rectangle in local scope space. |
width |
float |
Width of the bounding area in local pixels. |
height |
float |
Height of the bounding area in local pixels. |
DrawScope::pathRect(float, float, float, float, float)
Append Rounded Rectangle to Path
Appends corner arc vertices for a rounded rectangle to the active vector path.
| Parameter | Type | Description |
|---|---|---|
x |
float |
X coordinate of the destination rectangle in local scope space. |
y |
float |
Y coordinate of the destination rectangle in local scope space. |
width |
float |
Width of the bounding area in local pixels. |
height |
float |
Height of the bounding area in local pixels. |
radius |
float |
Corner radius for rounded geometry in pixels. |
Clipping & Scissor
| Method | Description |
|---|---|
pushClip(float, float, float, float) |
Pushes a rectangular clipping region restricting all subsequent rendering calls. |
pushTextClip(float, float, float, float) |
Pushes a clipping region with protective bleed padding to prevent font antialiasing clipping. |
popClip() |
Restores the previous clipping boundary, popping the top clip frame off the stack. |
DrawScope::pushClip(float, float, float, float)
Push Scissor Clip Region
Pushes a rectangular clipping region restricting all subsequent rendering calls.
| Parameter | Type | Description |
|---|---|---|
x |
float |
X coordinate of the destination rectangle in local scope space. |
y |
float |
Y coordinate of the destination rectangle in local scope space. |
width |
float |
Width of the bounding area in local pixels. |
height |
float |
Height of the bounding area in local pixels. |
DrawScope::pushTextClip(float, float, float, float)
Push Text-Safe Clip Region with Bleed
Pushes a clipping region with protective bleed padding to prevent font antialiasing clipping.
| Parameter | Type | Description |
|---|---|---|
x |
float |
X coordinate of the destination rectangle in local scope space. |
y |
float |
Y coordinate of the destination rectangle in local scope space. |
width |
float |
Width of the bounding area in local pixels. |
height |
float |
Height of the bounding area in local pixels. |
DrawScope::popClip()
Pop Clip Region
Restores the previous clipping boundary, popping the top clip frame off the stack.