1 | //! embedded-graphics-core contains the core components of [embedded-graphics] that are required to |
2 | //! add embedded-graphics support to display drivers, image libraries, text renderers and other |
3 | //! third party crates. |
4 | //! |
5 | //! This crate should only be used by crates that extend embedded-graphics. |
6 | //! Applications should instead depend on [embedded-graphics] itself. |
7 | //! |
8 | //! Like any other crate, embedded-graphics-core will change over time, however it will change at a |
9 | //! much slower rate than embedded-graphics itself, and will likely release fewer breaking changes. |
10 | //! This will provide more stability and compatability for the weider embedded-graphics ecosystem, |
11 | //! whilst allowing non-core features of embedded-graphics to evolve at a faster pace. The same |
12 | //! version of embedded-graphics-core may be used for multiple major versions of embedded-graphics. |
13 | //! |
14 | //! ## Core functionality |
15 | //! |
16 | //! * [`DrawTarget`] - By implementing a draw target for a display driver, all embedded-graphics drawables can be drawn to that display. |
17 | //! * [`Drawable`] - This trait can be implemented to make an object drawable to any [`DrawTarget`]. Examples include shapes, text, UI elements, etc. |
18 | //! * [`ImageDrawable`] |
19 | //! * Color types - see below. |
20 | //! * Geometry - [`Point`], [`Size`] and [`Rectangle`] provide ways of defining positions, dimensions and rectangular areas respectively. |
21 | //! |
22 | //! # Colors |
23 | //! |
24 | //! The [`pixelcolor`] module provides various standard color types, from [`BinaryColor`] to |
25 | //! [`Rgb888`]. See the [`pixelcolor`] module documentation for the complete list of color depths |
26 | //! and formats available. |
27 | //! |
28 | //! # Display drivers |
29 | //! |
30 | //! See the [`DrawTarget`] documentation for examples on how to integrate embedded-graphics with a |
31 | //! display driver using the [`DrawTarget`] trait. |
32 | //! |
33 | //! # Images |
34 | //! |
35 | //! The [`ImageDrawable`] trait should be implemented for any image or image-like item, for example |
36 | //! a spritemap. |
37 | //! |
38 | //! <!-- README-LINKS |
39 | //! [`Pixel`]: https://docs.rs/embedded-graphics-core/latest/embedded_graphics_core/drawable/struct.Pixel.html |
40 | //! [`Point`]: https://docs.rs/embedded-graphics-core/latest/embedded_graphics_core/geometry/struct.Point.html |
41 | //! [`Size`]: https://docs.rs/embedded-graphics-core/latest/embedded_graphics_core/geometry/struct.Size.html |
42 | //! [`Drawable`]: https://docs.rs/embedded-graphics-core/latest/embedded_graphics_core/drawable/trait.Drawable.html |
43 | //! [`DrawTarget`]: https://docs.rs/embedded-graphics-core/latest/embedded_graphics_core/draw_target/trait.DrawTarget.html |
44 | //! [`Rectangle`]: https://docs.rs/embedded-graphics-core/latest/embedded_graphics_primitives-core/rectangle/struct.Rectangle.html |
45 | //! [`Dimensions`]: https://docs.rs/embedded-graphics-core/latest/embedded_graphics_core/geometry/trait.Dimensions.html |
46 | //! [`OriginDimensions`]: https://docs.rs/embedded-graphics-core/latest/embedded_graphics_core/geometry/trait.OriginDimensions.html |
47 | //! [`BinaryColor`]: https://docs.rs/embedded-graphics-core/latest/embedded_graphics_core/pixelcolor/enum.BinaryColor.html |
48 | //! [`Rgb888`]: https://docs.rs/embedded-graphics-core/latest/embedded_graphics_core/pixelcolor/struct.Rgb888.html |
49 | //! [`ImageDrawable`]: https://docs.rs/embedded-graphics-core/latest/embedded_graphics_core/image/trait.ImageDrawable.html |
50 | //! [`pixelcolor`]: https://docs.rs/embedded-graphics-core/latest/embedded_graphics_core/pixelcolor/trait.PixelColor.html |
51 | //! README-LINKS --> |
52 | //! |
53 | //! # Features |
54 | //! |
55 | //! - `defmt` - implements `defmt::Format` for all types where this is possible. |
56 | //! |
57 | //! [embedded-graphics]: https://docs.rs/embedded-graphics |
58 | //! [`Pixel`]: drawable::Pixel |
59 | //! [`Point`]: geometry::Point |
60 | //! [`Size`]: geometry::Size |
61 | //! [`Drawable`]: drawable::Drawable |
62 | //! [`DrawTarget`]: draw_target::DrawTarget |
63 | //! [`Rectangle`]: primitives::rectangle::Rectangle |
64 | //! [`Dimensions`]: geometry::Dimensions |
65 | //! [`OriginDimensions`]: geometry::OriginDimensions |
66 | //! [`BinaryColor`]: pixelcolor::BinaryColor |
67 | //! [`Rgb888`]: pixelcolor::Rgb888 |
68 | //! [`ImageDrawable`]: image::ImageDrawable |
69 | |
70 | #![doc ( |
71 | html_logo_url = "https://raw.githubusercontent.com/embedded-graphics/embedded-graphics/b225511f390c0ed9bc065eb67d05125845312148/assets/logo_core.svg?sanitize=true" |
72 | )] |
73 | #![no_std ] |
74 | #![deny (missing_docs)] |
75 | #![deny (missing_debug_implementations)] |
76 | #![deny (missing_copy_implementations)] |
77 | #![deny (trivial_casts)] |
78 | #![deny (trivial_numeric_casts)] |
79 | #![deny (unsafe_code)] |
80 | #![deny (unstable_features)] |
81 | #![deny (unused_import_braces)] |
82 | #![deny (unused_qualifications)] |
83 | #![deny (rustdoc::broken_intra_doc_links)] |
84 | #![deny (rustdoc::private_intra_doc_links)] |
85 | |
86 | pub mod draw_target; |
87 | mod drawable; |
88 | pub mod geometry; |
89 | pub mod image; |
90 | pub mod pixelcolor; |
91 | pub mod prelude; |
92 | pub mod primitives; |
93 | |
94 | pub use drawable::{Drawable, Pixel}; |
95 | |