A point symbol of a given area (spec/07 §9), copied from visualize's
Visualize.Shape.Symbol.
type is a symbol type, read by spelling (an atom or its string), or a 1-arity
function of the datum answering one; size is a number in square user units or a
1-arity function answering one. Every path is about the origin.
iex> alias Macaw.Draw.Shape.Symbol
iex> {:ok, square} = Symbol.type(Symbol.new(), "square")
iex> square |> Symbol.size(16) |> Symbol.generate()
"M-2,-2L2,-2L2,2L-2,2Z"Only :circle and :square have area exactly size; the others are sized so their
bounding area is about it. type/2 refuses a name none of types/0 spells as
{[], {:unknown, :symbol, spelling}}; a function type answering an unknown name, and a
size that is not a non-negative number, draw the empty path for that datum.
Summary
Functions
The path data with nil as the datum.
The SVG path data of a datum's symbol.
The Macaw.Draw.IR.Path of a datum's symbol (§9).
A :circle of size 64.
Sets the size, an area in square user units, or a function of the datum.
Sets the type: a name read by spelling, or a function: {:ok, symbol} or {:error, faults}.
As type/2, the symbol itself, raising Macaw.Draw.Error with its faults.
The seven symbol types.
Types
@type error() :: {:error, [Macaw.Base.Fault.t()]}
A refusal: faults with their paths.
@type symbol_type() ::
:circle | :cross | :diamond | :square | :star | :triangle | :wye
Functions
The path data with nil as the datum.
The SVG path data of a datum's symbol.
@spec generate_path(t(), term()) :: Macaw.Draw.IR.Path.t() | error()
The Macaw.Draw.IR.Path of a datum's symbol (§9).
@spec new() :: t()
A :circle of size 64.
Sets the size, an area in square user units, or a function of the datum.
Sets the type: a name read by spelling, or a function: {:ok, symbol} or {:error, faults}.
As type/2, the symbol itself, raising Macaw.Draw.Error with its faults.
@spec types() :: [symbol_type()]
The seven symbol types.