Expand description

Helpers for drawing basic shapes on images.

Every draw_ function comes in two variants: one creates a new copy of the input image, one modifies the image in place. The latter is more memory efficient, but you lose the original image.

Structs

A canvas that blends pixels when drawing.

Iterates over the coordinates in a line segment using Bresenham’s line drawing algorithm.

Iterates over the image pixels in a line segment using Bresenham’s line drawing algorithm.

Iterates over the image pixels in a line segment using Bresenham’s line drawing algorithm.

Traits

A surface for drawing on - many drawing functions in this library are generic over a Canvas to allow the user to configure e.g. whether to use blending.

Functions

Draws an antialised line segment on a new copy of an image.

Draws an antialised line segment on an image in place.

Draws a colored cross on a new copy of an image.

Draws a colored cross on an image in place.

Draws a cubic Bézier curve on a new copy of an image.

Draws a cubic Bézier curve on an image in place.

Draws a circle and its contents on a new copy of the image.

Draws a circle and its contents on an image in place.

Draws an ellipse and its contents on a new copy of the image.

Draws an ellipse and its contents on an image in place.

Draws a rectangle and its contents on a new copy of an image.

Draws a rectangle and its contents on an image in place.

Draws the outline of a circle on a new copy of an image.

Draws the outline of a circle on an image in place.

Draws the outline of an ellipse on a new copy of an image.

Draws the outline of an ellipse on an image in place.

Draws the outline of a rectangle on a new copy of an image.

Draws the outline of a rectangle on an image in place.

Draws a line segment on a new copy of an image.

Draws a line segment on an image in place.

Draws a polygon and its contents on a new copy of an image.

Draws a polygon and its contents on an image in place.

Draws colored text on a new copy of an image.

Draws colored text on an image in place.

Get the width and height of the given text, rendered with the given font and scale.