PdfElixide.Document.Path (pdf_elixide v0.7.0)

Copy Markdown View Source

A vector graphics path — a line, curve, rectangle, or filled shape — extracted from a PDF page, with its zero-based page index and bounding box.

The :operations field holds the path's drawing commands as a list of flat tagged tuples, in stream order:

  • {:move_to, x, y} — start a new subpath at (x, y)
  • {:line_to, x, y} — straight line to (x, y)
  • {:curve_to, c1x, c1y, c2x, c2y, ex, ey} — cubic Bézier curve (the two control points and the endpoint)
  • {:rectangle, x, y, width, height} — a complete rectangle subpath
  • :close_path — close the current subpath

A path may be stroked, filled, or both: :stroke_color and :fill_color are each a PdfElixide.Color or nil. All colors are resolved to DeviceRGB.

Summary

Types

A single drawing command in a path's :operations list.

t()

Types

operation()

@type operation() ::
  {:move_to, float(), float()}
  | {:line_to, float(), float()}
  | {:curve_to, float(), float(), float(), float(), float(), float()}
  | {:rectangle, float(), float(), float(), float()}
  | :close_path

A single drawing command in a path's :operations list.

t()

@type t() :: %PdfElixide.Document.Path{
  bbox: PdfElixide.Geometry.Rect.t(),
  dash_pattern: {[float()], float()} | nil,
  fill_color: PdfElixide.Color.t() | nil,
  layer: String.t() | nil,
  line_cap: :butt | :round | :square,
  line_join: :miter | :round | :bevel,
  operations: [operation()],
  page: non_neg_integer(),
  stroke_color: PdfElixide.Color.t() | nil,
  stroke_width: float()
}