Crate embedded_graphics_transform

Source
Expand description

Add simple coordinate transforms for embedded graphics displays

This crate adds DrawTarget implementations which apply various simple transformations to coordinates as they’re being written. This allows graphics output to be rotated or mirrored to display correctly on a specific display device.

Specifically, it implements:

  • rotation by 90/180/270 degrees (and 0, for consistency)
  • mirroring
  • transposition

Note that these transformations can be composed if needed.

Because this is a completely generic implementation, it cannot take advantage of any hardware or driver specific specializations. In particular, DrawTarget::fill_contiguous must fall back to a generic implementation using draw_iter. (fill_solid and clear can use specialized implementations, however.)

All the transforms implement AsRef<D>/AsMut<D> to get access to the underlying display object so that its inherent functions can be called.

Structs§

FlipX
Mirror image around X axis.
FlipY
Mirror image around Y axis.
Rotate
Rotate an image with runtime configuration.
Rotate0
No-op (identity) rotation for completeness.
Rotate90
Rotate image 90 degrees to the right.
Rotate180
Rotate image 180 degrees.
Rotate270
Rotate image 90 degrees to the left.
Transpose
Transpose X and Y coordinates.

Enums§

Rotation
Image rotation direction and amount.