Expand description
DeckCraft geometry: units, shape transforms and preset shape generators.
The document model keeps positions in points (1/72 inch) as f64. Office Open XML stores EMU
(English Metric Units, 12 700 per point); emu_to_pt and pt_to_emu convert losslessly for
integer EMU values, so files round-trip exactly.
Modules§
- morph
- Morph between two outlines: one shape turns into another (a circle into a star).
- preset
- Preset shape geometry.
- warp
- WordArt text warps (DrawingML
a:bodyPr/a:prstTxWarp).
Structs§
- Affine
- A 2D affine transform.
- BezPath
- A Bézier path.
- Point
- A 2D point.
- Rect
- A rectangle.
- Size
- A 2D size.
- Vec2
- A 2D vector.
- Xfrm
- A shape’s placement on its slide (or in its group’s child space): offset, extent, rotation (degrees clockwise) and flips. Rotation and flips are about the centre.
Enums§
- PathEl
- The element of a Bézier path.
- Unit
- Display units for measurements (inches on US English systems, centimetres elsewhere).
Constants§
- EMU_
PER_ CM - EMU per centimetre.
- EMU_
PER_ IN - EMU per inch.
- EMU_
PER_ PT - EMU per point.
Traits§
- Kurbo
Shape - A generic trait for open and closed shapes.
Functions§
- dist_
to_ segment - Distance from
pto the segmenta–b. - emu_
to_ pt - group_
child_ affine - Maps a group’s child coordinate space (
ch_off,ch_ext) onto the group’s own box. - near_
path - Is
pwithintolof the outline ofpath(flattened)? - preset_
flatten - Flatten a path to move/line/close elements (tolerance 0.2).
- pt_
to_ emu - Points to EMU, rounded. Non-finite input becomes 0; huge values saturate.
- snap
- Snap
vto the nearest multiple ofstep(step <= 0 returnsv).