Expand description
Astrelis Geometry - Customizable 2D geometry rendering
This crate provides:
- Path and shape primitives for 2D vector graphics
- Tessellation (converting paths/shapes to triangle meshes)
- Style system (strokes, fills, gradients)
- GPU-accelerated rendering with instancing
- Mathematical charting (optional “chart” feature)
§Example
ⓘ
use astrelis_geometry::*;
// Create a geometry renderer
let mut renderer = GeometryRenderer::new(context);
// Draw shapes
let style = Style::fill(Paint::solid(Color::RED));
renderer.draw_shape(&Shape::circle(Vec2::new(100.0, 100.0), 50.0), &style);
// Draw custom paths
let path = PathBuilder::new()
.move_to(Vec2::new(0.0, 0.0))
.line_to(Vec2::new(100.0, 0.0))
.quad_to(Vec2::new(150.0, 50.0), Vec2::new(100.0, 100.0))
.close()
.build();
renderer.draw_path(&path, &style);
// Render to a pass
renderer.render(&mut pass, viewport);Modules§
Structs§
- Cubic
Bezier - A cubic Bezier curve (two control points).
- Dash
Pattern - Dash pattern for stroked lines.
- Fill
- Fill properties for geometry.
- Fill
Instance - Instance data for filled geometry.
- Fill
Vertex - Vertex for filled geometry.
- Geometry
Renderer - GPU-accelerated geometry renderer.
- Geometry
Renderer Descriptor - Configuration for creating a
GeometryRenderer. - Gradient
Stop - A color stop in a gradient.
- Linear
Gradient - A linear gradient.
- Path
- A 2D path consisting of drawing commands.
- Path
Builder - Builder for constructing paths.
- Projection
Uniform - Uniform data for projection matrix.
- Quadratic
Bezier - A quadratic Bezier curve (one control point).
- Radial
Gradient - A radial gradient.
- Scissor
Rect - A scissor rectangle for clipping.
- Stroke
- Stroke properties for geometry outlines.
- Stroke
Instance - Instance data for stroked geometry.
- Stroke
Vertex - Vertex for stroked geometry.
- Style
- Complete style for geometry rendering.
- Tessellated
Mesh - Output from tessellation: vertices and indices.
- Tessellator
- Tessellator for converting paths to triangle meshes.
- Transform2D
- A 2D affine transformation matrix.
Enums§
- Fill
Rule - Fill rule for determining interior of a path.
- LineCap
- Line cap style for stroke endpoints.
- Line
Join - Line join style for stroke corners.
- Paint
- A paint defines how to color geometry.
- Path
Command - A command in a path.
- Shape
- A high-level shape that can be converted to a path.
Traits§
- Path
Curves - Extension trait for extracting curve segments from paths.