Skip to main content

Crate takumi_raster

Crate takumi_raster 

Source
Expand description

Raster painting backend for takumi, built on tiny-skia.

render paints a node tree into a Bitmap, and write_image encodes it as PNG, JPEG, WebP, or ICO. write_animation encodes animated WebP, APNG, or GIF.

Use it through the takumi crate, which re-exports these functions at its root. The whole crate is takumi::unstable::raster. This crate does not re-export core types; reach them through takumi_core or takumi::unstable::base.

Structs§

AnimatedGifOptions
Encoding options for animated GIF output.
AnimatedPngOptions
Encoding options for animated PNG output.
AnimatedWebpOptions
Encoding options for animated WebP output.
AnimationFrame
Represents a single frame of an animated image.
Bitmap
A rendered RGBA raster image: the output of render.
MeasuredNode
The result of a layout measurement.
MeasuredTextRun
Information about a text run in an inline layout.
Quality
Lossy-encoding quality, clamped to the 0..=100 range (higher means better quality and larger output).
RenderNeeds
The images a render tree looks up by URL and the pending fonts its text loads.
RenderOptions
Options for rendering a node, built with RenderOptions::builder.
SequentialScene
A single scene in a sequential animation timeline.

Enums§

AnimationFormat
Output format and per-format options for write_animation.
DitheringAlgorithm
Gradient dithering for static image exports and raw buffers.
OutputFormat
Output format for rendered images. Format-specific encoding parameters live on the variant that supports them, so e.g. a quality value cannot be supplied for the lossless Png format.

Functions§

measure
Measures the layout of a node.
needs
What a node needs before it renders: the images it looks up by URL and the pending fonts its text loads.
render
Renders a node to an image.
render_animation
Renders all frames for a sequential animation timeline at a fixed frame rate.
render_pages
Renders a node across at most max_pages pages, each the page area pages gives it, handing each page’s image to page in order, so a long document holds one page’s pixels and scene at a time. A Size<f32> gives every page the same area, and PageRules the area the stylesheet’s @page rules give each.
render_scene
Paints a laid-out scene to an image the size of scene.size.
uncovered_characters
The characters of a node’s text that no registered font it can use draws, each once. They render as the font’s missing-glyph box.
write_animated_gif
Encode a sequence of RGBA frames into an animated GIF and write to destination.
write_animated_png
Encode a sequence of RGBA frames into an animated PNG and write to destination.
write_animated_webp
Encode a sequence of RGBA frames into an animated WebP and write to destination. Encodes a sequence of RGBA frames into an animated WebP.
write_animation
Renders a timeline at fps and streams each frame straight into format, holding one raw frame at a time instead of the whole animation.
write_image
Writes a single rendered image to destination using format.