Plushie.Canvas.Path (Plushie v0.7.1)

Copy Markdown View Source

Canvas arbitrary path element built from a list of drawing commands.

Summary

Functions

Converts this widget struct to a ui_node() map.

List of path commands (move_to, line_to, etc.).

Fill color or gradient.

Fill rule: "non_zero" or "even_odd".

Creates a new element without an explicit ID (auto-assigned by parent container).

Creates a new element with the given ID and keyword options.

Opacity from 0.0 to 1.0.

Stroke descriptor.

Returns the element type string for the wire protocol.

Applies keyword options to an existing widget struct.

Types

option()

@type option() ::
  ((({:commands, [term()]} | {:fill, term()})
    | {:stroke,
       %Plushie.Canvas.Stroke{
         cap: term(),
         color: term(),
         dash: term(),
         join: term(),
         width: term()
       }
       | keyword()
       | map()})
   | {:opacity, number()})
  | {:fill_rule, String.t() | atom()}

t()

Functions

build(widget)

@spec build(widget :: t()) :: Plushie.Widget.ui_node()

Converts this widget struct to a ui_node() map.

commands(widget, descriptor)

@spec commands(widget :: t(), value :: [term()] | nil) :: t()

List of path commands (move_to, line_to, etc.).

Accepts [term()].

fill(widget, descriptor)

@spec fill(widget :: t(), value :: term() | nil) :: t()

Fill color or gradient.

Accepts term().

fill_rule(widget, descriptor)

@spec fill_rule(widget :: t(), value :: (String.t() | atom()) | nil) :: t()

Fill rule: "non_zero" or "even_odd".

Accepts String.t() | atom().

new(id)

@spec new(opts :: [option()]) :: t()

Creates a new element without an explicit ID (auto-assigned by parent container).

new(id, opts)

@spec new(id :: String.t(), opts :: [option()]) :: t()

Creates a new element with the given ID and keyword options.

opacity(widget, descriptor)

@spec opacity(widget :: t(), value :: number() | nil) :: t()

Opacity from 0.0 to 1.0.

Accepts number().

stroke(widget, descriptor)

@spec stroke(
  widget :: t(),
  value ::
    (%Plushie.Canvas.Stroke{
       cap: term(),
       color: term(),
       dash: term(),
       join: term(),
       width: term()
     }
     | keyword()
     | map())
    | nil
) :: t()

Stroke descriptor.

Accepts %Plushie.Canvas.Stroke{}.

type_name()

@spec type_name() :: String.t()

Returns the element type string for the wire protocol.

with_options(widget, opts)

@spec with_options(widget :: t(), opts :: [option()]) :: t()

Applies keyword options to an existing widget struct.