Skip to main content

Crate blockworx_egui

Crate blockworx_egui 

Source
Expand description

The egui backend: the only crate that knows both vocabularies.

Everything a drawing is made of — the Renderer and Canvas traits, the palette, the theme and its Style adapter, the interaction types, the recorder that turns a frame into DrawOps — lives in [blockworx_paint] over the coordinates in [blockworx_geom]. Here those become egui calls: replay() turns a display list into shapes, View is the widget it is drawn in and the reader of the pointer and the wheel over it, ContextLayout is the text engine a frame is recorded through, convert is the dictionary between the two type families, ImageRegistry and build_fonts feed egui’s loaders, and EpaintLayout hands epaint’s own text layout to a consumer that has no backend of its own.

The dependency goes one way. This crate names the document (for an Asset), the geometry and the paint vocabulary, and nothing above them: a backend knows how to paint, not what a block is. The next backend is this crate rewritten, with everything below it untouched.

Re-exports§

pub use image::ImageRegistry;
pub use replay::replay;
pub use text::ContextLayout;
pub use text::EpaintLayout;
pub use view::Canvas;
pub use view::Diagram;
pub use view::View;
pub use view::tick;

Modules§

convert
The toolkit boundary’s dictionary: geom and paint ↔ egui, one conversion per type.
font 🔒
Installing the bundled UI fonts with egui.
image
The backend’s image table.
replay
A display list, drawn.
text
epaint’s text engine behind [TextLayout], twice over: the context’s own fonts at the display’s resolution, which is what a frame drawn on screen is measured through, and a standalone engine at one pixel per point for a backendless consumer (the exporters), handed the layout glyph for glyph.
view

Structs§

CanvasChrome
The colours the canvas paints its own ground with, under the canvas’s own name for them. The two raw colours a backend paints the ground with. The app resolves these from its theme, so a backend never needs to know about roles.
Vantage
The whole of what a view-kind undo entry restores.

Enums§

Camera
Whether the camera is being worked — a drag pan, or a two-finger pan/pinch in flight.

Functions§

build_fonts
Build the egui FontDefinitions for the active font choice. Every selectable font is registered under its own family name so the preferences menu can preview each entry in its own typeface.