Skip to main content

Crate astrelis_geometry

Crate astrelis_geometry 

Source
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§

chart
Mathematical charting module.
presets
Shorthand for creating common styles.

Structs§

CubicBezier
A cubic Bezier curve (two control points).
DashPattern
Dash pattern for stroked lines.
Fill
Fill properties for geometry.
FillInstance
Instance data for filled geometry.
FillVertex
Vertex for filled geometry.
GeometryRenderer
GPU-accelerated geometry renderer.
GeometryRendererDescriptor
Configuration for creating a GeometryRenderer.
GradientStop
A color stop in a gradient.
LinearGradient
A linear gradient.
Path
A 2D path consisting of drawing commands.
PathBuilder
Builder for constructing paths.
ProjectionUniform
Uniform data for projection matrix.
QuadraticBezier
A quadratic Bezier curve (one control point).
RadialGradient
A radial gradient.
ScissorRect
A scissor rectangle for clipping.
Stroke
Stroke properties for geometry outlines.
StrokeInstance
Instance data for stroked geometry.
StrokeVertex
Vertex for stroked geometry.
Style
Complete style for geometry rendering.
TessellatedMesh
Output from tessellation: vertices and indices.
Tessellator
Tessellator for converting paths to triangle meshes.
Transform2D
A 2D affine transformation matrix.

Enums§

FillRule
Fill rule for determining interior of a path.
LineCap
Line cap style for stroke endpoints.
LineJoin
Line join style for stroke corners.
Paint
A paint defines how to color geometry.
PathCommand
A command in a path.
Shape
A high-level shape that can be converted to a path.

Traits§

PathCurves
Extension trait for extracting curve segments from paths.