Skip to main content

teksilo_canvas/
lib.rs

1// SPDX-License-Identifier: MPL-2.0
2// SPDX-FileCopyrightText: 2026 FernTech
3
4//! The bottom of Teksilo's stack, below teksilo-core and teksilo-render,
5//! with no GPU, window or widget in it. It holds three things.
6//!
7//! - **The paint model.** A widget's `paint()` draws into a [`Canvas`],
8//!   which records a [`RenderFrame`] of [`DrawCommand`]s for a renderer to
9//!   replay. Around it: [`geometry`], [`Path`], [`Paint`], raster and SVG
10//!   icons ([`RasterIcon`], [`SvgIcon`]), and the [`TextBackend`] trait a
11//!   text engine implements.
12//! - **Live pictures.** [`live_image`]: a raster another thread rewrites
13//!   (a VM screen, a video, a camera), the writers a producer commits
14//!   through, and what a frame carries of it. [`image_geometry`] places a
15//!   picture in a widget and maps points to its pixels.
16//! - **The wake layer.** [`wake`]: how any thread wakes one window, shared
17//!   by live pictures and teksilo-core's `RepaintTrigger`.
18//!
19//! The last two are here, not in a crate of their own, because of who needs
20//! them. teksilo-render consumes live pictures and depends on this crate, not
21//! on teksilo-core; a [`RenderFrame`] carries them; and a producer uses them
22//! without the GUI. A crate of their own would sit below this one, and this
23//! one would depend on it.
24
25pub mod animated;
26pub mod canvas;
27pub mod ellipsis;
28pub mod exif;
29pub mod geometry;
30pub mod image_geometry;
31pub mod live_image;
32pub mod paint;
33pub mod path;
34pub mod raster;
35pub mod render_frame;
36pub mod resample;
37pub mod svg;
38#[doc(hidden)]
39pub mod sync;
40pub mod text_backend;
41pub mod wake;
42mod xml;
43
44pub use animated::AnimatedIcon;
45pub use canvas::Canvas;
46#[allow(deprecated)]
47pub use exif::Orientation;
48pub use geometry::{EdgeInsets, Point, Rect, Size, SizeProposal, Transform2D, Vec2};
49pub use image_geometry::{ImageFit, ImageGeometry, ImageOrientation, PixelRect};
50pub use paint::{
51    FillRule, GradientStop, ImageHandle, LineCap, LineJoin, Paint, StrokeSpace, StrokeStyle,
52};
53pub use path::{
54    ArcCubic, Path, PathCommand, Subpath, arc_to_cubics, arc_transform_is_exact,
55    subpaths_contain_point,
56};
57pub use raster::{ImageDecodeError, ImageFormat, RasterIcon};
58pub use render_frame::{
59    AnimParams, AnimatedQuadClass, AnimatedQuadDraw, BlendMode, CosmeticLine, DecorationKind,
60    DecorationRect, DrawCommand, GlyphQuad, ImagePixels, ImageQuad, PaintData, PathEntry,
61    PendingImage, RasterizedQuad, RenderFrame, ShadowQuad, ShapeKind, ShapeQuad,
62};
63pub use svg::{
64    ResolvedGradient, SvgDrawOp, SvgFill, SvgIcon, SvgOp, SvgPaint, SvgParseError, SvgStop,
65    SvgStroke,
66};
67pub use text_backend::{
68    AtlasInfo, CharGeom, EllipsisMode, GlyphValidation, HitTarget, LineEnd, LineTruncation,
69    MockTextBackend, TextBackend, TextDirection, TextGeometry, TextLayout, TextLayoutRequest,
70    TextLayoutSpan, TextLine, TextLineSegment, TextLink, TextOverflow, TextSpanKind,
71    lay_out_ignoring_language, quantize_raster_scale,
72};