vivid v0.1.0 Vivid.Group

Represents a collection of shapes which can be Rasterized in a single pass.

Summary

Functions

Remove a shape from a Group

Initialize a group either empty or from a list of shapes

Add a shape to a Group

Functions

delete(group, shape)

Remove a shape from a Group

Example

iex> line = Vivid.Line.init(Vivid.Point.init(1,1), Vivid.Point.init(10,10))
...> Vivid.Group.init([line])
...> |> Vivid.Group.delete(line)
%Vivid.Group{shapes: MapSet.new()}
init()

Initialize a group either empty or from a list of shapes.

Examples

iex> circle = Vivid.Circle.init(Vivid.Point.init(5,5), 5)
...> line   = Vivid.Line.init(Vivid.Point.init(1,1), Vivid.Point.init(10,10))
...> Vivid.Group.init([circle, line])
#Vivid.Group<[#Vivid.Line<[origin: #Vivid.Point<{1, 1}>, termination: #Vivid.Point<{10, 10}>]>, #Vivid.Circle<[center: #Vivid.Point<{5, 5}>, radius: 5]>]>

iex> Vivid.Group.init
%Vivid.Group{shapes: MapSet.new()}
init(shapes)
put(group, shape)

Add a shape to a Group

Example

iex> line = Vivid.Line.init(Vivid.Point.init(1,1), Vivid.Point.init(10,10))
...> Vivid.Group.init()
...> |> Vivid.Group.put(line)
%Vivid.Group{shapes: MapSet.new([
  %Vivid.Line{origin: %Vivid.Point{x: 1, y: 1}, termination: %Vivid.Point{x: 10, y: 10}}
])}