stipple_render/lib.rs
1//! The Stipple rendering seam.
2//!
3//! `stipple-render` is the one crate that knows about `oxideav`. It turns a
4//! [`Scene`] (a list of logical-pixel draw primitives) into an `oxideav-core`
5//! scene graph, rasterizes it on the CPU with `oxideav-raster`, and hands the
6//! result to a [`Surface`] for display.
7//!
8//! ```
9//! use stipple_geometry::{Rect, ScaleFactor, Size};
10//! use stipple_render::{Color, Scene, SoftwareRenderer};
11//!
12//! let mut scene = Scene::new(Size::new(64.0, 64.0));
13//! scene.fill_round_rect(Rect::from_xywh(8.0, 8.0, 48.0, 48.0), 12.0, Color::rgb(80, 140, 255));
14//!
15//! let pixmap = SoftwareRenderer::new().render(scene, ScaleFactor::IDENTITY);
16//! assert_eq!(pixmap.size().width, 64);
17//! ```
18//!
19//! The [`Surface`] trait is the GPU-readiness boundary: today the
20//! [`SoftwareRenderer`] produces a [`Pixmap`] that the platform layer blits;
21//! a future raw-GPU backend (Metal / Vulkan / D3D12 / WebGPU) can implement
22//! the same trait without changing any caller. See `ROADMAP.md` ยง2 / Phase 6.
23
24#![forbid(unsafe_code)]
25
26mod color;
27mod convert;
28mod scene;
29mod software;
30mod surface;
31mod text;
32
33pub use color::Color;
34pub use scene::{DrawCmd, Scene};
35pub use software::SoftwareRenderer;
36pub use surface::{Pixmap, Surface};
37pub use text::{Font, FontError};
38
39/// Low-level conversions to `oxideav-core` coordinate types. Exposed for
40/// crates that build scene-graph nodes directly (e.g. the future text-run
41/// shaping bridge) and need to share Stipple's geometry conventions.
42pub mod oxideav_bridge {
43 pub use crate::convert::{to_ox_point, to_transform2d};
44}