Module drawing

Source
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§

Blend
A canvas that blends pixels when drawing.
BresenhamLineIter
Iterates over the coordinates in a line segment using Bresenham’s line drawing algorithm.
BresenhamLinePixelIter
Iterates over the image pixels in a line segment using Bresenham’s line drawing algorithm.
BresenhamLinePixelIterMut
Iterates over the image pixels in a line segment using Bresenham’s line drawing algorithm.

Traits§

Canvas
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§

draw_antialiased_line_segment
Draws an antialised line segment on a new copy of an image.
draw_antialiased_line_segment_mut
Draws an antialised line segment on an image in place.
draw_cross
Draws a colored cross on a new copy of an image.
draw_cross_mut
Draws a colored cross on an image in place.
draw_cubic_bezier_curve
Draws a cubic Bézier curve on a new copy of an image.
draw_cubic_bezier_curve_mut
Draws a cubic Bézier curve on an image in place.
draw_filled_circle
Draws a circle and its contents on a new copy of the image.
draw_filled_circle_mut
Draws a circle and its contents on an image in place.
draw_filled_ellipse
Draws an ellipse and its contents on a new copy of the image.
draw_filled_ellipse_mut
Draws an ellipse and its contents on an image in place.
draw_filled_rect
Draws a rectangle and its contents on a new copy of an image.
draw_filled_rect_mut
Draws a rectangle and its contents on an image in place.
draw_hollow_circle
Draws the outline of a circle on a new copy of an image.
draw_hollow_circle_mut
Draws the outline of a circle on an image in place.
draw_hollow_ellipse
Draws the outline of an ellipse on a new copy of an image.
draw_hollow_ellipse_mut
Draws the outline of an ellipse on an image in place.
draw_hollow_rect
Draws the outline of a rectangle on a new copy of an image.
draw_hollow_rect_mut
Draws the outline of a rectangle on an image in place.
draw_line_segment
Draws a line segment on a new copy of an image.
draw_line_segment_mut
Draws a line segment on an image in place.
draw_polygon
Draws a polygon and its contents on a new copy of an image.
draw_polygon_mut
Draws a polygon and its contents on an image in place.
draw_text
Draws colored text on a new copy of an image.
draw_text_mut
Draws colored text on an image in place.
text_size
Get the width and height of the given text, rendered with the given font and scale.