ExPng.Image.Drawing (ExPng v1.0.0)
Utility module to hold functions related to drawing on images.
Link to this section Summary
Functions
Returns the pixel at the given {x, y}
coordinates in the image.
Clears the pixel at the given {x, y}
coordinates in the image, coloring it
opaque white.
Colors the pixel at the given {x, y}
coordinates in the image the provided
color.
Erases all content in the image, setting every pixel to opaque white
Draws a line between the given coordinates in the image.
Link to this section Types
coordinate_pair()
Specs
coordinate_pair() :: {pos_integer(), pos_integer()}
Link to this section Functions
at(image, coordinates)
Specs
at(ExPng.Image.t(), coordinate_pair()) :: ExPng.Color.t()
Returns the pixel at the given {x, y}
coordinates in the image.
clear(image, coordinates)
Specs
clear(ExPng.Image.t(), coordinate_pair()) :: ExPng.Image.t()
Clears the pixel at the given {x, y}
coordinates in the image, coloring it
opaque white.
draw(image, coordinates, color \\ Color.black())
Specs
draw(ExPng.Image.t(), coordinate_pair(), ExPng.maybe(ExPng.Color.t())) :: ExPng.Image.t()
Colors the pixel at the given {x, y}
coordinates in the image the provided
color.
erase(image)
Specs
erase(ExPng.Image.t()) :: ExPng.Image.t()
Erases all content in the image, setting every pixel to opaque white
line(image, coordinates0, coordinates1, color \\ Color.black())
Specs
line( ExPng.Image.t(), coordinate_pair(), coordinate_pair(), ExPng.maybe(ExPng.Color.t()) ) :: ExPng.Image.t()
Draws a line between the given coordinates in the image.
Shortcut functions are provided for horizontal lines, vertical lines, and lines with a slope of 1 or -1. For other angles, Xiaolin Wu's algorithm for drawing anti-aliased lines is used.