Skip to main content

Crate deckcraft_render

Crate deckcraft_render 

Source
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.
ParaState
Animation state of one paragraph, relative to its shape.
PathMorph
A frame shape (see crate::render_blend) whose outline morphs from from into its own geometry.
Placed
PlacedLink
A clickable area: a shape action or a text hyperlink.
PlacedText
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.
RenderOpts
Renderer
ShapeState
Animation state of one shape during a slide show or preview.
TextMorph
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 m within the text rect.
gif_frame
For an animated GIF: the frame showing t seconds into its (looping) play and the seconds until the next frame. None for 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 at scale pixels per point) plus the part of extent (slide space, from slide_extent or what a render drew) that falls within visible, the canvas’s area relative to the slide’s top-left corner. The visible area is rounded out to whole TILEs.
place_slide
Text and links of slide index (master and layout graphics first, as rendered).
render_blend
Render a frame between slides old and new (indices into pres.slides), e.g. of Morph: the backdrop (background, master and layout graphics) of old cross-fading into that of new by mix (0..1), then shapes in order, each resolved against the slide it comes from (true: old). Pairs of shapes in text draw their boxes as usual but their texts morph by words or characters (TextMorph), on top of the later shape of the pair. Shapes listed in paths draw an outline morphing from another geometry into their own (PathMorph). opts.state applies to shapes only.
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 index at opts.scale pixels 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 index draws, 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 tr is drawn, for a shape drawn with m (shape-local → output): m, without mirroring, then the layout’s rotation about the rect’s centre.
text_warp
The WordArt warp of s’s text over its text rectangle tr, if it has one DeckCraft draws.