View Source Scenic.Primitive.RoundedRectangle (Scenic v0.11.2)

Draw a rectangle with rounded corners on the screen.

data

Data

{width, height, radius}

The data for a line is a tuple containing three numbers.

  • width - width of the rectangle
  • height - height of the rectangle
  • radius - radius of the corners

styles

Styles

This primitive recognizes the following styles

  • hidden - show or hide the primitive
  • scissor - "scissor rectangle" that drawing will be clipped to.
  • fill - fill in the area of the primitive
  • stroke - stroke the outline of the primitive. In this case, only the curvy part.

usage

Usage

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

graph
  |> rrect( {100, 50, 4}, stroke: {1, :yellow} )
  |> rounded_rectangle( {100, 50, 4}, stroke: {1, :yellow} )

Note: rrect is a shortcut for rounded_rectangle and they can be used interchangeably.

Link to this section Summary

Functions

Returns a the centroid of the rectangle. This is used as the default pin when applying rotate or scale transforms.

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

@type styles_t() :: [:hidden | :scissor | :fill | :stroke_width | :stroke_fill]
@type t() :: {width :: number(), height :: number(), radius :: number()}

Link to this section Functions

Returns a the centroid of the rectangle. This is used as the default pin when applying rotate or scale transforms.

Link to this function

compile(primitive, styles)

View Source
@spec 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.

@spec valid_styles() :: styles_t()

Returns a list of styles recognized by this primitive.