Declarative vector-graphics block element for Rendro documents.
A %Rendro.Path{} is an inert authored value — a list of drawing operations
(ops) with optional fill and stroke styling. It is placed in a document
as a block element (via Rendro.path/2) and rendered through the standard
build → compose → measure → paginate → render pipeline.
Coordinate model
All coordinates are block-relative, author top-left, Y-down — the same
convention used by Rendro.Text, Rendro.Image, and Rendro.Table. The
writer performs the single PDF Y-flip internally. Do not pre-flip coordinates.
Op vocabulary
The ops list accepts the following tagged tuple operations:
{:move, x, y}— Move to(x, y)without drawing (mPDF operator).{:line, x, y}— Draw a straight line to(x, y)(l).{:curve, x1, y1, x2, y2, x3, y3}— Draw a cubic Bézier curve with two control points(x1,y1),(x2,y2)and endpoint(x3,y3)(c).{:rect, x, y, w, h}— Draw a rectangle at(x, y)with dimensionsw × h(re).{:rounded_rect, x, y, w, h, radius}— Draw a rectangle with rounded corners of the givenradius. Decomposed deterministically intomove/line/curveops using the0.5522847498kappa approximation.:close— Close the current subpath (h).
Stroke and fill
stroke and fill each accept:
nil(default) — no stroke / no fill.{r, g, b}tuple (integers, 0–255) — bare color, using PDF default line width1.0, butt caps, miter join, solid dash.A map with any of:
color: {r,g,b},width: float(),dash: nil | [on, off],cap: :butt | :round | :square,join: :miter | :round | :bevel.
Paint-op selection is deterministic: {nil, nil} → n; {nil, fill} → f;
{stroke, nil} → S; {stroke, fill} → B.
Example
Rendro.path([
{:rect, 10, 10, 100, 50}
], stroke: {0, 0, 0}, width: 200, height: 70)
Summary
Types
@type color() :: {non_neg_integer(), non_neg_integer(), non_neg_integer()}
@type t() :: %Rendro.Path{fill: fill_style(), ops: [op()], stroke: stroke_style()}