Skip to main content

Crate clairlune_render

Crate clairlune_render 

Source
Expand description

Rendering for Clairlune: glyph atlas, indexed palette, static bake, frame compositing and PNG export.

Every pixel is a palette index. Colours are looked up, never blended at render time, so a scene has at most 255 colours (index 255 is reserved for GIF transparency) and the still PNG, GIF frames and the live renderer can match exactly (PLAN.md section 4.5).

Re-exports§

pub use art::BuiltinArt;
pub use art::OwnedPixmap;
pub use art::Pixmap;
pub use art::SceneArt;
pub use atlas::GlyphAtlas;
pub use bake::bake_static;
pub use clock::Clock;
pub use encode::encode_png;
pub use encode::save_png;
pub use encode::to_rgba;
pub use frame::hero_time;
pub use frame::hero_time_with_art;
pub use frame::render_frame;
pub use frame::render_frame_clocked;
pub use frame::render_frame_with_art;
pub use gif_export::GifError;
pub use gif_export::GifStats;
pub use gif_export::Smoothness;
pub use gif_export::encode_gif;
pub use gif_export::encode_package_gif;
pub use gif_export::frame_delays;
pub use gif_export::valid_loop_ms;
pub use package::PACKAGE_FORMAT;
pub use package::PackageError;
pub use package::ScenePackage;
pub use palette::IndexedPalette;

Modules§

art
Everything a frame draws besides the background: the activity’s state machine, the character’s frames and the props’ pixel art. Live scenes take them from the built-in catalog and art (BuiltinArt); saved scenes carry their own copy (crate::package), so they play the same after the built-in art or activities change.
atlas
Glyph atlas: every glyph of glyphs::GLYPHS rasterized once into a cell-sized alpha mask.
bake
Static bake: background bands plus every glyph cell, rendered once per scene.
clock
Which moment of the character’s life a frame shows.
encode
PNG export. Scenes have at most 255 colours, so stills are written as indexed (paletted) PNGs, which are much smaller than RGBA.
frame
Frame compositing: the baked background plus animated elements at time t. Particles snap to the cell grid (exact palette, small GIF diffs); sprites use integer nearest-neighbour scaling.
gif_export
Seamless GIF export (PLAN.md section 6.4).
package
Frozen scene packages (PLAN.md section 9c): how saved wallpapers are kept.
palette
The indexed palette of one rendering (at most 255 colours).

Structs§

IndexedImage
An image of palette indices, row-major.
Still
A rendered still frame with everything needed to encode or inspect it.

Functions§

render_still
Renders a recipe to a still frame at t_ms, or at the hero time when None.