Builder for freeform (custom geometry) shapes.
Freeform shapes let you draw custom vector paths using a builder pattern.
Start with new/3, add segments with line_to/3 and move_to/3, and
close contours with close/1. Add the finished shape to a slide with
Podium.add_freeform/3.
Example
freeform =
Podium.Freeform.new({1, :inches}, {1, :inches})
|> Podium.Freeform.line_to({3, :inches}, {1, :inches})
|> Podium.Freeform.line_to({2, :inches}, {3, :inches})
|> Podium.Freeform.close()
slide = Podium.add_freeform(slide, freeform, fill: "4472C4")See the Connectors and Freeform Shapes guide for more examples.
Summary
Functions
Adds multiple line segments from a list of {x, y} vertices.
Computes the bounding box in local coordinates (before scale).
Returns {min_x, min_y, dx, dy}.
Closes the current contour.
Adds a line segment to (x, y).
Starts a new contour at (x, y) without drawing a line.
Creates a new freeform builder starting at (start_x, start_y).
Returns operations with coordinates translated so the bounding box origin is (0, 0). Includes the initial move_to from the start point.
Types
Functions
@spec add_line_segments( t(), [{Podium.dimension() | number(), Podium.dimension() | number()}], keyword() ) :: t()
Adds multiple line segments from a list of {x, y} vertices.
Options
:close- iftrue, closes the contour after the last segment
Computes the bounding box in local coordinates (before scale).
Returns {min_x, min_y, dx, dy}.
Closes the current contour.
@spec line_to(t(), Podium.dimension() | number(), Podium.dimension() | number()) :: t()
Adds a line segment to (x, y).
@spec move_to(t(), Podium.dimension() | number(), Podium.dimension() | number()) :: t()
Starts a new contour at (x, y) without drawing a line.
@spec new(Podium.dimension() | number(), Podium.dimension() | number(), keyword()) :: t()
Creates a new freeform builder starting at (start_x, start_y).
Coordinates can be {value, unit} tuples (converted to EMU) or raw integers.
When raw integers are used with scale: N, coordinates are multiplied by N
to get EMU values.
Options
:scale- scale factor for raw integer coords (default 1.0, meaning EMU):x_scale/:y_scale- per-axis scale factors (override:scale)
Returns operations with coordinates translated so the bounding box origin is (0, 0). Includes the initial move_to from the start point.