Skip to main content

Module drawing

Module drawing 

Source
Expand description

Helpers for drawing basic shapes on images.

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 an image.
draw_antialiased_line_segment_mut
An in-place version of draw_antialiased_line_segment().
draw_antialiased_polygon
Draws an anti-aliased polygon polygon and its contents on an image.
draw_antialiased_polygon_mut
An in-place version of draw_antialiased_polygon().
draw_cross
Draws a colored cross on an image.
draw_cross_mut
An in-place version of draw_cross().
draw_cubic_bezier_curve
Draws a cubic Bézier curve on an image.
draw_cubic_bezier_curve_mut
An in-place version of draw_cubic_bezier_curve().
draw_filled_circle
Draws a circle and its contents on an image.
draw_filled_circle_mut
An in-place version of draw_filled_circle().
draw_filled_ellipse
Draws an ellipse and its contents on an image.
draw_filled_ellipse_mut
An in-place version of draw_filled_ellipse().
draw_filled_rect
Draws a rectangle and its contents on an image.
draw_filled_rect_mut
An in-place version of draw_filled_rect().
draw_hollow_circle
Draws the outline of a circle on an image.
draw_hollow_circle_mut
An in-place version of draw_hollow_circle().
draw_hollow_ellipse
Draws the outline of an ellipse on an image.
draw_hollow_ellipse_mut
An in-place version of draw_hollow_ellipse().
draw_hollow_polygon
Draws the outline of a polygon on an image in place.
draw_hollow_polygon_mut
An in-place version of draw_hollow_polygon().
draw_hollow_rect
Draws the outline of a rectangle on an image.
draw_hollow_rect_mut
An in-place version of draw_hollow_rect().
draw_line_segment
Draws a line segment on an image.
draw_line_segment_mut
An in-place version of draw_line_segment().
draw_polygon
Draws a polygon and its contents on an image.
draw_polygon_mut
An in-place version of draw_polygon().
draw_text
Draws colored text on an image.
draw_text_mut
An in-place version of draw_text().
flood_fill
Equivalent to bucket tool in MS-PAINT Performs 4-way flood-fill based on this algorithm: https://en.wikipedia.org/wiki/Flood_fill#Span_filling
flood_fill_mut
An in-place version of flood_fill().
text_size
Get the width and height of the given text, rendered with the given font and scale.