Expand description
The DeckCraft renderer: draws slides, layouts and masters with vello_cpu.
One code path serves the editor canvas, thumbnails, image/PDF-raster export and the slide show:
render_slide draws the background, the master and layout graphics, then the slide’s shapes
(fills with theme shading, gradients, pictures, outlines with dashes and arrowheads, shadows,
glow and soft edges, text, tables, charts, groups), optionally with per-shape animation state.
Structs§
- Image
- A rendered image: premultiplied RGBA8.
- Para
State - Animation state of one paragraph, relative to its shape.
- Path
Morph - A frame shape (see
crate::render_blend) whose outline morphs fromfrominto its own geometry. - Placed
- Placed
Link - A clickable area: a shape action or a text hyperlink.
- Placed
Text - One shape’s text as drawn on the slide.
- Region
- A rectangle of pixels on the editor canvas, relative to the slide’s top-left corner.
- Render
Opts - Renderer
- Shape
State - Animation state of one shape during a slide show or preview.
- Text
Morph - The texts of two frame shapes (see
crate::render_blend) morphed by words or characters.
Constants§
- MAX_
SIDE - Largest pixmap side we render (vello_cpu uses u16 sizes).
- TILE
- The visible area is rounded out to tiles of this many pixels, so scrolling over a pasteboard that is wider than the window re-renders only when a new tile comes into view.
Functions§
- crop_
dest - The rectangle a picture’s image occupies given its crop (fractions; negative = padding).
- decode_
image - Decode encoded bytes (PNG, JPEG, GIF, WebP, BMP, TIFF; WMF and EMF drawn at
[
crate::metafile::DEFAULT_SIDE]) to straight RGBA. - draw_
layout - Draw an already laid-out text block.
- draw_
layout_ with - Draw a laid-out text block with per-paragraph animation states.
- draw_
text - Draw a text body into shape space
mwithin the text rect. - gif_
frame - For an animated GIF: the frame showing
tseconds into its (looping) play and the seconds until the next frame.Nonefor anything else. - layout_
extent - What a layout (or the master,
layout: None) draws in Slide Master view, in slide space. - needs_
filters - Does anything on this slide (or its layout/master graphics) use blur-based effects?
- parse_
path - Parse our custom path syntax (
M x y L x y C … Q … Z). - pasteboard_
region - The pixels the editor renders: the slide (
slide_px, its size in pixels atscalepixels per point) plus the part ofextent(slide space, fromslide_extentor what a render drew) that falls withinvisible, the canvas’s area relative to the slide’s top-left corner. The visible area is rounded out to wholeTILEs. - place_
slide - Text and links of slide
index(master and layout graphics first, as rendered). - render_
blend - Render a frame between slides
oldandnew(indices intopres.slides), e.g. of Morph: the backdrop (background, master and layout graphics) ofoldcross-fading into that ofnewbymix(0..1), thenshapesin order, each resolved against the slide it comes from (true:old). Pairs of shapes intextdraw their boxes as usual but their texts morph by words or characters (TextMorph), on top of the later shape of the pair. Shapes listed inpathsdraw an outline morphing from another geometry into their own (PathMorph).opts.stateapplies toshapesonly. - render_
layout - Render a layout (Slide Master view thumbnail and canvas).
- render_
shape - Render one shape alone onto a transparent canvas (drag previews, copy as picture).
- render_
slide - Render slide
indexatopts.scalepixels per point. A panic inside the renderer becomes a blank image (logged), never a crash. - render_
slide_ drawn render_slide, also returning how far the drawing reached, in slide space (at least the slide; off it, what the shapes, their effects and their text drew, the parts outside the output included). The editor grows its pasteboard to it (pasteboard_region).- shape_
geometry - Geometry of a shape at its size.
- slide_
extent - What slide
indexdraws, in slide space: at least the slide, grown by every shape (and master and layout graphic) that reaches off it. Estimated from the shapes’ boxes, outlines and effects; text spilling out of its box is found while rendering (crate::render_slide_drawn). - table_
row_ heights - Heights the rows are drawn at. A stored row height (
a:tr/@h) is a minimum: the row grows so the text of each of its cells fits, as in PowerPoint. Files from pandoc or python-pptx store 0. Cells spanning several rows and vertical text keep the stored height. - text_
transform - Where text laid out in text rect
tris drawn, for a shape drawn withm(shape-local → output):m, without mirroring, then the layout’srotationabout the rect’s centre. - text_
warp - The WordArt warp of
s’s text over its text rectangletr, if it has one DeckCraft draws.