Scenic.Primitive.Quad (Scenic v0.11.0-beta.0) View Source

Draw a quad on the screen.

Data

{point_a, point_b, point_c, point_d}

The data for a line is a tuple containing four points.

  • point_a - position to start drawing from
  • point_b - position to draw to
  • point_c - position to draw to
  • point_d - position to draw to

Styles

This primitive recognizes the following styles

  • hidden - show or hide the primitive
  • fill - fill in the area of the primitive
  • stroke - stroke the outline of the primitive. In this case, only the curvy part.
  • join - control how segments are joined.
  • miter_limit - control how segments are joined.

Usage

You should add/modify primitives via the helper functions in Scenic.Primitives

graph
  |> quad(
    {{10, 0}, {20, 40}, {17, 50}, 0, 10}},
    stroke: {1, :yellow}
  )

Link to this section Summary

Functions

Compile the data for this primitive into a mini script. This can be combined with others to generate a larger script and is called when a graph is compiled.

Returns a list of styles recognized by this primitive.

Link to this section Types

Specs

styles_t() :: [
  :hidden
  | :scissor
  | :fill
  | :stroke_width
  | :stroke_fill
  | :join
  | :miter_limit
]

Specs

t() ::
  {{x0 :: number(), y0 :: number()}, {x1 :: number(), y1 :: number()},
   {x2 :: number(), y2 :: number()}, {x3 :: number(), y3 :: number()}}

Link to this section Functions

Link to this function

compile(primitive, styles)

View Source

Specs

compile(primitive :: Scenic.Primitive.t(), styles :: Scenic.Primitive.Style.t()) ::
  Scenic.Script.t()

Compile the data for this primitive into a mini script. This can be combined with others to generate a larger script and is called when a graph is compiled.

Specs

valid_styles() :: styles_t()

Returns a list of styles recognized by this primitive.