vivid v0.4.2 Vivid.Rasterize protocol View Source
The Rasterize protocol is responsible for converting shapes into bitmaps.
If you’re defining your own shape then you need to implement this protocol.
Example
iex> use Vivid
...> Box.init(Point.init(1,1), Point.init(4,4))
...> |> Rasterize.rasterize(Bounds.init(0,0,5,5))
#MapSet<[#Vivid.Point<{1, 1}>, #Vivid.Point<{1, 2}>, #Vivid.Point<{1, 3}>, #Vivid.Point<{1, 4}>, #Vivid.Point<{2, 1}>, #Vivid.Point<{2, 4}>, #Vivid.Point<{3, 1}>, #Vivid.Point<{3, 4}>, #Vivid.Point<{4, 1}>, #Vivid.Point<{4, 2}>, #Vivid.Point<{4, 3}>, #Vivid.Point<{4, 4}>]>
Link to this section Summary
Functions
Convert a shape into a bitmap
Link to this section Types
Link to this section Functions
Link to this function
rasterize(shape, bounds)
View Source
rasterize(Vivid.Shape.t, Bounds.t) :: MapSet
Convert a shape into a bitmap.
Takes a shape
and returns a MapSet
of points within bounds
.