ExPng.Image.Drawing (ExPng v0.2.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

Link to this type

coordinate_pair()

Specs

coordinate_pair() :: {pos_integer(), pos_integer()}

Link to this section Functions

Link to this function

at(image, coordinates)

Specs

Returns the pixel at the given {x, y} coordinates in the image.

Link to this function

clear(image, coordinates)

Specs

Clears the pixel at the given {x, y} coordinates in the image, coloring it opaque white.

Link to this function

draw(image, coordinates, color \\ ExPng.Pixel.black())

Specs

Colors the pixel at the given {x, y} coordinates in the image the provided color.

Specs

Erases all content in the image, setting every pixel to opaque white

Link to this function

line(image, coordinates0, coordinates1, color \\ ExPng.Pixel.black())

Specs

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.