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§
- Animated
GifOptions - Encoding options for animated GIF output.
- Animated
PngOptions - Encoding options for animated PNG output.
- Animated
Webp Options - Encoding options for animated WebP output.
- Animation
Frame - Represents a single frame of an animated image.
- Bitmap
- A rendered RGBA raster image: the output of
render. - Measured
Node - The result of a layout measurement.
- Measured
Text Run - Information about a text run in an inline layout.
- Quality
- Lossy-encoding quality, clamped to the
0..=100range (higher means better quality and larger output). - Render
Needs - The images a render tree looks up by URL and the pending fonts its text loads.
- Render
Options - Options for rendering a node, built with
RenderOptions::builder. - Sequential
Scene - A single scene in a sequential animation timeline.
Enums§
- Animation
Format - Output format and per-format options for
write_animation. - Dithering
Algorithm - Gradient dithering for static image exports and raw buffers.
- Output
Format - 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
Pngformat.
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_pagespages, each the page areapagesgives it, handing each page’s image topagein order, so a long document holds one page’s pixels and scene at a time. ASize<f32>gives every page the same area, andPageRulesthe area the stylesheet’s@pagerules 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
fpsand streams each frame straight intoformat, holding one raw frame at a time instead of the whole animation. - write_
image - Writes a single rendered image to
destinationusingformat.