PrawnEx.Shapes (prawn_ex v0.6.0)

Copy Markdown View Source

Path builders shared by the public API and the chart renderers.

These append path ops only — the caller decides whether to fill, stroke, or fill_stroke the result.

Summary

Functions

Appends a closed polygon path through points (a list of {x, y}). Fewer than two points draws nothing.

Appends a rounded-rectangle path. radius is clamped to half the shorter side, so an over-large radius degrades to a stadium instead of turning inside out. A radius of 0 emits a plain rectangle.

Functions

polygon(doc, points)

@spec polygon(PrawnEx.Document.t(), [{number(), number()}]) :: PrawnEx.Document.t()

Appends a closed polygon path through points (a list of {x, y}). Fewer than two points draws nothing.

Useful for the small marks a document needs but a single-byte font cannot spell — arrows, carets, tick marks — since those glyphs have no WinAnsi codepoint and would otherwise transliterate to ?.

rounded_rect(doc, x, y, w, h, radius)

@spec rounded_rect(
  PrawnEx.Document.t(),
  number(),
  number(),
  number(),
  number(),
  number()
) ::
  PrawnEx.Document.t()

Appends a rounded-rectangle path. radius is clamped to half the shorter side, so an over-large radius degrades to a stadium instead of turning inside out. A radius of 0 emits a plain rectangle.