Expand description
Higher-level drawing API inspired by GPUI’s rendering model.
This module provides ergonomic types and an immediate-mode Canvas facade
that wraps the low-level canvas_* functions. Guest apps can choose between
the raw functions (maximum control) and these helpers (less boilerplate).
§Example
ⓘ
use oxide_sdk::draw::*;
let c = Canvas::new();
c.clear(Color::rgb(30, 30, 46));
c.fill_rect(Rect::new(10.0, 10.0, 200.0, 100.0), Color::rgb(80, 120, 200));
c.fill_circle(Point2D::new(300.0, 200.0), 50.0, Color::rgba(200, 100, 150, 200));
c.text("Hello!", Point2D::new(20.0, 30.0), 24.0, Color::WHITE);
c.line(Point2D::new(0.0, 0.0), Point2D::new(400.0, 300.0), 2.0, Color::YELLOW);Structs§
- Canvas
- Immediate-mode canvas facade that wraps the low-level drawing functions.
- Color
- sRGB color with alpha.
- Gradient
Stop - A gradient color stop at a position along the gradient axis.
- Point2D
- A 2D point in canvas coordinates.
- Rect
- An axis-aligned rectangle in canvas coordinates.