1 unstable release
0.1.0 | Sep 14, 2022 |
---|
#1330 in Embedded development
31KB
809 lines
Embedded graphics transformations
This crate provides generic implementations of simple transformations - rotate by 90 degree increments, mirroring and transposing.
These are intended to adapt generic graphics code to a particular display dimensions and orientation. It provides fixed transformation types which have no space overhead and minimal time overhead to adjust coordinates and dimensions. It also provides runtime-configurable rotations with minimal additional space and time overheads.
Because this is generic, it cannot take advantage of any hardware support for
image rotation. In particular, DrawTarget::fill_contiguous
will not use any
specialized implementation.
This crate is no-std and has minimal additional dependencies.
lib.rs
:
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.
Dependencies
~485KB