Implement full SSD1306 OLED display support: - Splash screen on boot (1.5s) with project name, version, board - Dashboard showing radio state, config, counters, RSSI/SNR - RSSI history sparkline (64-sample ring buffer, 2px-wide bars) - DisplayOn/DisplayOff host commands routed via dedicated channel - Pure render functions against generic DrawTarget (no hardware coupling) - Display on/off control bypasses radio task entirely Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
46 KiB
Changelog
Embedded Graphics is a no_std library for adding graphics features to display drivers. It aims to use the minimum amount of memory for builtin graphics objects by leveraging Rust's iterators to avoid large allocations. It targets embedded environments, but can run anywhere like a Raspberry Pi up to full desktop machines.
Unreleased - ReleaseDate
0.8.2 - 2026-02-15
Fixed
- #806 Fixed build on MSRV by using tighter dependencies.
- #806 Added Cargo.lock for dev-dependencies.
- #806 Fixed some broken documentation links.
0.8.1 - 2023-08-10
Changed
- (technically breaking) #731 Bump MSRV to 1.71.1
- #730 Made the following methods
const:MonoFontStyleBuilder::fontMonoFontStyleBuilder::underlineMonoFontStyleBuilder::strikethroughMonoFontStyleBuilder::reset_text_colorMonoFontStyleBuilder::reset_background_colorMonoFontStyleBuilder::reset_underlineMonoFontStyleBuilder::reset_strikethroughMonoTextStyle::new
0.8.0 - 2023-05-14
Added
- #592 Add support for defmt behind a feature (
defmt). - #612, #699 Added
GetPixeltrait and implementations forImageRawandFramebuffer. - #621 Added
Rgb666andBgr666color type support. - #641 Added
Line::with_deltaconstructor. - #656 Added
Rgb666andBgr666conversions. - #673 Added
Framebuffer. - #709 Added
Image::with_center. - #710 Added
AnchorX,AnchorY,AnchorPoint::x,AnchorPoint::yandAnchorPoint::from_xy. - #710 Added
Rectangle::resized_width,Rectangle::resized_height,Rectangle::anchor_xandRectangle::anchor_y.
Changed
- (breaking) #660 Remove
RawU18color storage type and useRawU24in is place forRgb666andBgr666. - #639 Made the following functions
const: - (breaking) #690 Remove
ImageRaw::new_binaryconsthelper method.ImageRaw::newcan now be used inconstcontexts, so use it instead ofnew_binary. - #639, #690 Made the following functions
const:Point::component_mulPoint::component_divSize::saturating_addSize::saturating_subSize::component_mulSize::component_divBinaryColor::invertBinaryColor::is_onBinaryColor::is_offRectangle::with_centerRectangle::is_zero_sizedRawDataSlice::newMonoTextStyle::newArc::with_centerArc::from_circleArc::to_circleCircle::with_centerEllipse::with_centerSector::with_centerSector::from_circleSector::to_circleStyled::newImageRaw::newImageRaw::data_widthImage::newFancyDisplay::newMockDisplay::get_pixelMonoFont::mimeMonoFont::glyph_mappingMonoTextStyleBuilder::newMonoTextStyleBuilder::text_colorMonoTextStyleBuilder::background_colorMonoTextStyleBuilder::underline_with_colorMonoTextStyleBuilder::strikethrough_with_colorMonoTextStyleBuilder::buildEllipse::newEllipse::containsPrimitiveStyle::newPrimitiveStyle::with_strokePrimitiveStyle::with_fillPrimitiveStyle::is_transparentPrimitiveStyleBuilder::newPrimitiveStyleBuilder::fill_colorPrimitiveStyleBuilder::reset_fill_colorPrimitiveStyleBuilder::stroke_colorPrimitiveStyleBuilder::reset_stroke_colorPrimitiveStyleBuilder::stroke_widthPrimitiveStyleBuilder::stroke_alignmentPrimitiveStyleBuilder::buildDecorationColor::is_noneDecorationColor::is_text_colorDecorationColor::is_custom
- #651, #652 Improved performance of color conversions.
- #653 Don't ignore trailing newlines in
Text. - #662
ImageRaw::newno longer panics ifwidth == 0. - (breaking) #688
MonoFontis nowSend + Sync; implementations ofGlyphMappingmust beSync. - (breaking) #663 Upgraded Cargo dependencies to their latest versions.
- (breaking) #689 Bump Minimum Supported Rust Version (MSRV) to 1.61.
- (breaking) #715 Changed the direction of angles. Positive angles are now clockwise.
Fixed
- #648 Fixed incorrect text bounding box calculation when multi-byte characters are used.
- #713 Fixed possible panic when drawing an invalid
MonoFont.
0.7.1 - 2021-06-15
Changed
- #606 Bump minimum embedded-graphics-core version from
0.3.0to0.3.2
0.7.0 - 2021-06-05
Added
- #602 Implemented
core::fmt::DisplayforPointandSize.
Changed
- (breaking) - #600 Renamed
Mapping::alltoMapping::iter. - (breaking) - #603
MockDisplay::eqwas replaced by aPartialEqimplementation forMockDisplay.
Removed
- (breaking) - #604 Removed incomplete JIS X 0201 fonts.
0.7.0-beta.2 - 2021-05-24
Added
- #587 Added
From<&TextStyle>impl forTextStyleBuilderandFrom<&MonoFont>forMonoFontBuilder. - #589 Implemented
Fromtrait to convert from RGB colors to grayscale colors, between different grayscale colors and from grayscale and RGB colors toBinaryColor.
Changed
- (breaking) - #596 Added more ISO8859 glyph subsets as well as JIS_X0201 for bundled
MonoFonts, supporting more languages. Thelatin1subset was renamed toiso_8859_1.
0.7.0-beta.1 - 2021-04-19
Added
- (breaking) #552 Added the
Outputassociated type toDrawableto allow returning non-()values from drawing operations. - #563 Added
is_none,is_text_colorandis_custommethods toDecorationColor. - #563 Added
is_transparentmethods toPrimitiveStyleandMonoTextStyle. - #569 Added a
line_heightfield toTextStyle. - #571 Added
MockDisplay::set_pixelsto set pixels from an iterator. - #572 Added
ImageRaw::new_binaryto createconstimages with binary image data. - #576 Added reset methods for color settings to
MonoTextStyleBuilderandPrimitiveStyleBuilder. - #582 Added
StyledDrawable,StyledDimensionsandStyledPixelstraits.
Changed
- (breaking) #561 Renamed
HorizontalAlignmentandVerticalAlignmenttoAlignmentandBaseline. - (breaking) #561 Replaced
TextRenderer::vertical_offsetbybaselinearguments for the otherTextRenderermethods. - (breaking) #563 The bounding boxes returned by
Dimensionsimplementations for styled primitives no longer depend on the fill and stroke color. - (breaking) #563 Drawing a primitive with a transparent stroke (
stroke_color == None && stroke_width > 0) will now reduce the filled area. - (breaking) #566 The
Drawable::Outputtype was changed toPointfor styledTextobjects. The returned point can be used to chain texts with different styles. - (breaking) #569 Moved the text rendering API into a separate
text::renderersubmodule. - (breaking) #569 The
non_exhaustiveattribute was added to theTextStylestruct. - (breaking) #571 Added color argument to
MockDisplay::from_pointsto make it usable for all color types. - (breaking) #572 Removed the
heightargument fromImageRaw::new. Theheightis now calculated based on the width and data length. - (breaking) #572 Replaced
pixelcolor::raw::RawDataIterby the types in theiterator::rawmodule. - (breaking) #573 Changed
MonoFontfrom a trait to a struct. - (breaking) #580 Changed
Textto directly contain the styling information without needing aStyledwrapper. - (breaking) #580 Removed
character_stylefromTextStyle. Character and text style can now be set independently in theTextobject. - (breaking) #580 Moved
Styledfrom the crate root to theprimitivesmodule.
Removed
- (breaking) #582 Removed
iterator::IntoPixelstrait. UseStyled::pixelsinstead.
Fixed
- #571
Rectangle::pointsdid return a non empty iterator for rectangles with zero width.
0.7.0-alpha.3 - 2021-02-03
Added
- #508 Added
MockDisplay::assert_eq_with_messageandMockDisplay::assert_pattern_with_message. - #510 Added
vertical_alignmentandhorizontal_alignmenttoMonoTextStyle. - #510 Added
Fromimpl to convert an existingMonoTextStyleinto aMonoTextStyleBuilder. - #523 Added support for underline and strikethrough attributes for
MonoTextStyle.
Changed
- (breaking) #523 The external text renderer API was rewritten and the
TextStyletrait was renamed toTextRenderer. - (breaking) #523 The
fontsmodule was split intotextandmono_fontmodules. - (breaking) #523 The vertical and horizontal alignment of
Textobjects must now be set using the newTextStylestruct. - (breaking) #535 Replaced the builtin fonts with new fonts, that are generated from BDF files.
- (breaking) #538 The types inside the
stylemodule were moved to other locations and the module itself has been removed. - (breaking) #540 Renamed the
iterator::pixel::Translatestruct toTranslatedand thetranslatemethod inPixelIteratorExttotranslated.
Removed
- (breaking) #508
MockDisplayno longer implementsPartialEq, useMockDisplay::assert_eqinstead. - (breaking) #509 Styled text can no longer be converted into a pixel iterator, because
IntoPixelsis no longer implemented forStyled<Text<'_>, S>. - (breaking) #510
MonoTextStyleBuilder::newno longer takes a font as an argument, useMonoTextStyleBuilder::new().font(SomeFont)instead.
Fixed
- #507 Fixed drawing of the join between the radial lines for sectors with a sweep angle close to 360°.
- #525
Triangles andPolylines with thick strokes would overdraw in some cases. - #527 Some cases where the ends of
Polylines would draw unwanted "spurs" are now fixed.
0.7.0-alpha.2 - 2020-11-29
Added
- #386 Added
Line::midpointto get the midpoint of a line. - #386
Polylines can now be drawn with stroke widths greater than 1. - #386 Added the
deltamethod toLineto compute the difference between start and end points. - #450 Added
ColorConvertedandDrawTargetExt::color_convertedto support color conversion for draw targets. - #438 Added majority CSS web colors as associated
consts to the RGB color types. - #470 Added support for external text renderers. External text renderers can be implemented using the new
TextStyletrait. - #475
Triangles can now be drawn with stroke widths greater than 1. - #478 Added
resized,anchor_point,rows,columnsandis_zero_sizedmethods toRectangle. - #493 Added
assert_eq,assert_patternanddiffmethods toMockDisplay. Improved error messages for failing assertions can be enabled by setting theEG_FANCY_PANICenvironment variable to1at compile time. - #498 Added
Size::saturating_addandSize::saturating_sub.
Changed
- (breaking) #466 Upgrade Nalgebra from 0.19.0 to 0.23.0.
- (breaking) #470 Renamed
Font,TextStyleandTextStyleBuildertoMonoFont,MonoTextStyleandMonoTextStyleBuilder. - (breaking) #494 Triangle vertices are now stored in an array of 3 points, under the
verticesfield.
Removed
- (breaking) #470 Support for fonts with variable character width was removed from the internal text renderer.
- (breaking) #470
Font6x6was removed. - (breaking) #494
Triangle::from_pointsis removed. To create a triangle from a slice ofPoints, use the newTriangle::from_slicemethod. - (breaking) #498
Primitive::from_pointsis removed. Thepointsmethod is now available on thePointsItertrait, which must be implemented for allPrimitives.
Fixed
- #477 Drawing a 90°
Arcis now equal to drawing a quarter of a circle.
0.7.0-alpha.1 - 2020-09-19
Added
- #307 Added
Primitive::pointsto get an iterator over all points inside a primitive. - #317 Added
Rectangle::centerto get the center point of a rectangle. - #318 Added
ContainsPointtrait to check if a point is inside a closed shape. - #320 Added the
Ellipseprimitive. - #333 Added
Rectangle::bottom_rightto get the bottom right corner of a rectangle. - #331 Added stroke alignment to
PrimitiveStyle. - #331 Added
Rectangle::with_center. - #331 Added
From<&PrimitiveStyle>forPrimitiveStyleBuilder. - #292 Added the
Polylineprimitive. - #337 Add
Point::x_axis,Point::y_axis,Size::x_axisandSize::y_axis. - #337 Add
Point::new_equalandSize::new_equal. - #336 Add
RoundedRectangleprimitive. - #353 Add
MockDisplay::swap_xymethod. - #357 Add
MockDisplay::mapmethod. - #357 Allow usage of all RGB color types in
MockDisplaypatterns. - #366 Allow usage of all grayscale color types in
MockDisplaypatterns. - #342 Added
Rectangle::intersectionmethod. - #363 Export
primitives::ContainsPointtrait in prelude. - #310 Added the
Arcprimitive. - #310 Added the
Sectorprimitive. - #398 Added
Point::length_squaredandcomponent_min,component_max,component_mulandcomponent_divforPointandSize. - #400 Added
OffsetOutlineandStyledPrimitiveAreastraits. - #409 Added
Clipped,CroppedandTranslateddraw targets. - #409 Added
OriginDimensionstrait for dimensions withtop_left == Point::zero(). - #420 Added support for
SubImages. - #429 Added
ToBytestrait to convert colors into byte arrays. - #431 Added
MockDisplay::affected_areato get the area affected by previous drawing operations. - #439 Added support to render transparent characters with a colored background.
- #494 Add
Triangle::from_sliceto create a triangle from a slice ofPoints.
Changed
- (breaking) #274 The
Circleis now defined by its bounding box top-left corner and its diameter instead of its center and its radius. To convert your code, you can replaceCircle::new(point, radius)byCircle::with_center(point, 2 * radius + 1). - (breaking) #306 The
Rectangleis now defined by its top-left corner and its size instead of the top-left and bottom-right corner. To convert your code, you can replaceRectangle::newbyRectangle::with_corners. - (breaking) #312 The methods in the
Dimensiontrait are replaced by a singlebounding_boxmethod that returns aRectangle. - (breaking) #353 Lines with equal start and end points are now drawn by assuming they are oriented horizontally. This means that they are now drawn as a
stroke_widthhigh and 1px wide rectangle, instead of not being drawn at all. - (breaking) #353
primitives::line::StyledLineIteratorwas renamed toprimitives::line::StyledIterator. - (breaking) #357 Additional checks for overdraw and out of bounds drawing were added to
MockDisplaywhich can cause tests to panic. See themock_displaymodule docs for more information. - (breaking) #342 Refactored the
DrawTargettrait to better support common hardware capabilities. - (breaking) #360 Make the
drawablemodule private.drawable::Drawableanddrawable::Pixelare now exported from the crate root. - (breaking) #390
Triangle.containsnow always returnsfalsefor colinear triangles. - (breaking) #393
DrawTarget::drawnow uses a reference toselfinstead of taking ownership ofself. Because of this changeDrawTargetcan no longer be implemented for pixel iterators (Iterator<Item = C>), which can now be drawn using thedrawmethod provided by thePixelIteratorExtextension trait. - (breaking) #383 Replaced all
IntoIteratorimpls with a customIntoPixelstrait. To get an iterator over pixels in an item, replace calls tointo_iter()withinto_pixels(). - (breaking) #403 Use an associated type to define the color type for
Drawables. - (breaking) #409
DrawTarget::sizewas removed andDrawTargets are now required also implementDimensions. - (breaking) #409 The
DrawTargettrait was moved from the root of the crate to a newdraw_targetmodule. Projects that use thepreludeto importDrawTargetwon't be affected by this change. - (breaking) #420 To add support for additional image formats now
ImageDrawableandOriginDimensionsneeds to be implemented instead ofIntoPixelIteratorandImageDimensions. - (breaking) #420 The color type parameter was removed from the
Imagestruct and is now defined by the associatedColortype of anImageDrawableimplementation.
Fixed
- #317 The bounding box size for
Circles was off by one. - #401 Triangle pixel iterators no longer produce a pixel for each node twice.
- #431 Styled primitive bounding boxes now take the stroke width and alignment into account.
Removed
- (breaking) #351 Removed the
egtext!,text_style!andprimitive_style!macros. Use theText,TextStyleBuilderandPrimitiveStyleBuilderrespectively instead. - (breaking) #351 Removed the
egcircle!,egrectangle!,egline!andegtriangle!macros.
0.6.2 - 2020-04-20
Fixed
- #309 Prevent triangles with off-screen vertices from infinitely looping.
0.6.1 - 2020-04-01
Added
- #285 Add multiplication and division by a scalar for
PointandSize.
Fixed
- #271 Styled
Lines are now drawn using thestroke_withspecified in thePrimitiveStyleand no longer default to 1px width.
0.6.0 - 2020-03-20
Added
- #269 Support for multiline text.
- #267 Added a
6x6hand-drawn variable width font. - #267 Support for variable width fonts.
Fixed
- #267 Fonts with CHARACTER_SPACING now properly render the background color between characters.
- #276 Fixed Chars like '°' and similar for
Font12x16&Font24x32
0.6.0-beta.2 - 2020-03-06
Fixed
- #262
Triangles with a fill color but no stroke color are now rendered instead of not rendered at all. - #262 A triangle with a different stroke and fill color now renders its left-most border with the stroke color, instead of fill color
- #262 Triangles and lines with a stroke width of 0 (and no fill for triangles) are no longer drawn.
Added
- Added
draw_imagetoDrawTargettrait with default implementation.
0.6.0-beta.1 - 2020-02-17
Added
-
#257 added the
.into_storage()method onPixelColors via theIntoStoragetrait to allow for more ergonomic conversion from a color to its raw storage type.// IntoStorage is included in the prelude. // You can also import it with use embedded_graphics::pixelcolor::IntoStorage. + use embedded_graphics::prelude::*; - RawU1::from(color).into_inner() + color.into_storage() -
Added as many
#[derive()]s as possible to all embedded-graphics, tinybmp and tinytga types. -
Added
From<Point> for [i32; 2] -
Added
From<Size> for [u32; 2] -
Added the following fallible conversions to/from
PointTryFrom<Point>for(u32, u32)TryFrom<(u32, u32)>forPointTryFrom<Point>for[u32; 2]TryFrom<[u32; 2]>forPointTryFrom<&[u32; 2]>forPoint
-
#247 Added the
ImageDatatrait. This trait can be implemented in an image format crate to add embedded-graphics support. -
#247 Added
Imagedrawable. TheImagedrawable is used to make an implementation ofImageData, e.g. fromtinytgaortinybmp, drawable to aDrawTarget, like a display.
Changed
-
(breaking) #256 Make
PrimitiveStyleBuilderandTextStyleBuilderconsuming by following the consuming builder pattern. -
(breaking) #247 The raw data
Imagestruct is renamed toImageRaw. TheImagename is reused as a wrapper for other image types that implement theImageDatatrait. -
(breaking) #247
ImageLEandImageBEare renamed toImageRawLEandImageRawBErespectively. -
(breaking) #247
ImageTgaandImageTgaare removed, along with their respective enabling featuresbmpandtga. To use BMP or TGA images, addtinybmportinytgato your dependencies with thegraphicsfeature enabled. This allows usage ofBmpandTgain embedded-graphics contexts. Tinybmp or tinytga usage now looks like this:Cargo.toml:[dependencies] embedded-graphics = "0.6.0" tinybmp = { version = "0.2.0", features = [ "graphics" ]}Your code:
use embedded_graphics::{prelude::*, image::Image}; use tinybmp::Bmp; let image = Bmp::new(include_bytes!("../../../assets/patch.bmp")).unwrap(); let image = Image::new(&image); display.draw(&image); -
(breaking) #243 All methods on
DrawTargetthat handle drawing to/updating the display are now fallible and returnResult<(), Self::Error>to allow for error handling in user code. This also affectsDrawable::draw(), which now propagates any errors that occur while drawing. -
(breaking) #243
DrawTarget::flush()is removed. The display driver itself should provide this method if required. -
Expose
mock_display::MockDisplayfor use in tests, examples, etc in crates that pull embedded-graphics in as a dependency.
0.6.0-alpha.3
Added
- #170 Added a
24x32font based on the existing12x16font.
-
#221 Implemented
DrawableforPixelto draw single pixels. -
#215 Added
PrimitiveStyleBuilder. -
#215 Added
TextStyleBuilder. -
#224 Added
Triangle::from_pointswhich accepts either[Point; 3], or an array of length 3 containing any item that implementsInto<Point>.
Fixed
- #143, #209 Circles with no stroke are now drawn correctly
Changed
-
(breaking) The
Drawabletrait now has a required trait methoddraw(), which describes how the object will be drawn on the screen. See the docs for more details. -
(breaking) The
Drawingtrait has been renamed toDrawTarget. The required trait method to implement has changed fromdraw()todraw_pixel(), and optional trait methods have been added to allow an implementing display driver to specify hardware-accelerated methods for drawing graphics primitives. -
(breaking) #161 The
.fill()and.stroke()style methods are renamed to.fill_color()and.stroke_color()respectively. This is to reduce confusion between names like.stroke()and.stroke_width(). Example:use embedded_graphics::{ prelude::*, primitives::Circle, egcircle }; let circle = Circle::new(Point::new(20, 20), 5) .stroke_width(10) .stroke_color(Some(BinaryColor::On)) .fill_color(Some(BinaryColor::Off));
-
(breaking) The type of
Style::stroke_widthchanged fromu8tou32. -
(breaking) Primitives shapes need to be converted into
Styleds to be drawn. -
(breaking) The primitive macros like
eglinedon't accept astylesetting anymore. Useobject.style = new_styleinstead. -
(breaking) The
Stylestruct was replaced byPrimitiveStyleandTextStyle.
- (breaking) Text rendering is now implemented using
Text,TextStyleandFontobjects instead of usingFont::render_str.
-
(breaking) #224 Embedded Graphics macros now use named instead of positional parameters. Styling is now achieved using the
styleproperty which receives aPrimitiveStylefor primitives, and aTextStyle. There are convenience macros (primitive_style!()andtext_style!()respectively) to make styling objects easier.use embedded_graphics::{egcircle, egline, egrectangle, egtext, egtriangle, text_style}; // OLD egcircle!( (15, 20), 10, stroke = Some(Rgb565::RED), fill = Some(Rgb565::GREEN) ); // NEW egcircle!( center = (15, 20), radius = 10, style = primitive_style!(stroke = Rgb565::RED, fill = Rgb565::GREEN) ); // OLD egrectangle!( (0, 0), (64, 64), stroke = Some(Rgb565::RED), fill = Some(Rgb565::GREEN) ); // NEW egrectangle!( top_left = (0, 0), bottom_right = (64, 64), style = primitive_style!(stroke = Rgb565::RED, fill = Rgb565::GREEN) ); // OLD egtriangle!((32, 0), (0, 64), (64, 64)); // NEW egtriangle!( points = [(32, 0), (0, 64), (64, 64)], style = primitive_style!(stroke = Rgb565::RED, fill = Rgb565::GREEN) ); // OLD egline!((32, 0), (0, 64)); // NEW egline!( start = (32, 0), end = (0, 64), style = primitive_style!(stroke = Rgb565::RED,) ); // OLD egtext!("456", (10, 10), font = Font6x8, stroke = Some(Rgb565::RED)); // NEW egtext!( text = "456", top_left = (10, 10), style = text_style!(font = Font6x8, text_color = Rgb565::RED) );
Removed
- (breaking) The
SizedDrawingtrait is removed.
0.6.0-alpha.2
Changed
-
(breaking)
CoordandUnsignedCoordare replaced byPointandSize. -
(breaking) The
Imagestruct is removed from the prelude. Import it withuse embedded_graphics::image::Imageinstead. -
(breaking) Integration with Nalgebra through the
nalgebra_supportfeature is now achieved by converting Nalgebra types intoPointorSizeinstead of Embedded Graphics aliasingPointandSizetonalgebra::Vector2<i32>andnalgebra::Vector2<u32>respectively. Integration now requires callingPoint::from(my_nalgebra_var)ormy_nalgebra_var.into().The benefit of this change is to allow more integer primitive types in
Vector2. Embedded Graphics should now supportu8,u16andu32conversions toSize, andu8,u16,i8,i16andi32conversions toPoint. It also reduces coupling between Nalgebra and Embedded Graphics. -
(breaking)
Points can no longer be created from(u32, u32),[u32; 2]or&[u32; 2]; these conversions are dangerous as the full range ofu32values cannot be represented by thei32used for storage insidePoint.
-
(breaking)
Pixelnow uses the signedPointtype as the first element. Display drivers need to implement an additional check ifxandyare greater or equal to zero. -
(breaking) The image module has been rewritten to support big- and little-endian image formats.
Image1BPP,Image8BPPandImage16BPPare no longer available, and have been replaced with the singleImagetype. To migrate from the previous image types, useImagewith a specified pixel color, like this:use embedded_graphics::{ image::Image, pixelcolor::{BinaryColor, Gray8, Rgb565} }; // Image1BPP let image: Image<BinaryColor> = Image::new(DATA, 12, 5); // Image8BPP let image: Image<Gray8> = Image::new(DATA, 12, 5); // Image16BPP let image: Image<Rgb565> = Image::new(DATA, 12, 5);There are other pixel color types available. Take a look at the
pixelcolormodule for a full list.If you need to specify an endianness for the image data (like when using multiple bytes per pixel), the
ImageLEandImageBEtype aliases have been added.
Removed
-
(breaking)
Coord::clamp_positiveis removed. -
(breaking) The
icoord!()anducoord!()macros are removed. UsePoint::new()orSize::new()respectively instead.
Fixed
- The code examples
README.mdare now checked in CI during crate compilation. They were woefully outdated and have now been fixed.
0.6.0-alpha.1
Major breaking changes ahead! @rfuest has been hard at work making the colours story in Embedded Graphics much richer and easier to use.
As this is an alpha version, please give it a test and report back any issues you find!
Changed
- (breaking) Added many colour types
0.5.2
Small doc fixes and other minor changes.
Added
- Added low-effort Embedded Graphics logo for https://docs.rs/embedded-graphics
Fixed
- Wrap
Coordcode example in backticks so it's rendered as code by Rustdoc
0.5.1
A couple of breaking changes around naming, mostly polish around public APIs
Added
Changed
- (breaking) Primitives macros have been renamed. This is primarily to fix conflicts with
std'sline!()macro, but I thought I'd take the opportunity to make the names a bit better/more consistent at the same time:line->eglinetriangle->egtrianglerect->egrectanglecircle->egcircle
- (breaking) The
Rectprimitive is now renamed toRectangleto fit with the other non-truncated primitive names.
0.5.0
A big release, focussed on ergonomics. There are new macros to make drawing and positioning primitives and text much less noisy, as well as changes to the Drawing trait to remove the explicit .into_iter() call when passing objects to it.
Added
-
Add
SizedDrawingtrait. This is useful for displays that support partial screen updates. If the passed object has known dimensions (via theDimensions) trait, a smaller draw area can be specified, reducing the number of bytes sent over the wire. This also opens up the possibility of bufferless display drivers! -
Macros for primitives, text,
UnsignedCoordandCoord! This should make graphics-heavy code much quicker to write, and much cleaner to read. For example, to create a line and a circle:Code that looked like this:
display.draw( Circle::new(Coord::new(10, 10), 10 as u32) .with_stroke(Some(0u8)) .with_fill(Some(1u8)) .into_iter(), ); display.draw( Circle::new(Coord::new(10, 10), 10 as u32) .translate(Coord::new(10, 10)) .with_stroke(Some(0u8)) .with_fill(Some(0u8)) .into_iter(), ); display.draw( Rect::new(Coord::new(0, 0), Coord::new(64, 64)) .translate(Coord::new(96 + 32, 32)) .with_stroke(Some(0u8)) .with_fill(Some(0u8)) .into_iter(), ); display.draw( Triangle::new(Coord::new(32, 0), Coord::new(0, 64), Coord::new(64, 64)) .translate(Coord::new(96 * 2 + 16, 16)) .with_stroke(Some(0u8)) .with_fill(Some(1u8)) .into_iter(), );Now looks like this:
display.draw(circle!((10, 10), 10 as u32, stroke = Some(0u8), fill = Some(1u8))); display.draw( circle!((10, 10), 10 as u32, stroke = Some(0u8), fill = Some(0u8)) .translate(icoord!(10, 10)), ); display.draw( rect!((0, 0), (64, 64), stroke = Some(0u8), fill = Some(1u8)) .translate(icoord!(96 + 16, 16)), ); display.draw( triangle!( (32, 0), (0, 64), (64, 64), stroke = Some(0u8), fill = Some(1u8) ) .translate(icoord!(96 * 2 + 16, 16)), ); -
Added
pixelcolor::RGB565to make working with displays and images in the common RGB565 pixel format.
Changed
-
Drawing#drawnow acceptsIntoIteratorinstead ofIter.This is a breaking change for driver implementors. Client code should still be fine, as
.into_iter()can still be called.This allows passing of embedded_graphics objects without having to explicitly call
.into_iter:// Before (still works) display.draw( Circle::new(Coord::new(10, 10), 10 as u32) .into_iter() ); // After display.draw( Circle::new(Coord::new(10, 10), 10 as u32) );This also means that objects can be passed by reference too:
let circle = Circle::new(Coord::new(10, 10), 10 as u32); display.draw(&circle); // Reuse `circle` here -
(breaking) All
with_<prop>()style methods are replaced by their unprefixed<prop>()counterparts - #106with_style()->style()with_stroke()->stroke()with_stroke_width()->stroke_width()with_fill()->fill()
-
(breaking)
ImageBMPandImageTGAare now disabled by default behind Cargo features- Get
ImageBMPby adding thebmpfeature to yourCargo.toml - Get
ImageTGAby adding thetgafeature to yourCargo.toml
- Get
-
(breaking) fonts now render with a transparent background by default. To get the old behaviour back, add a
filllike this:// Without macros Font6x8::render_str("Hello Rust!").fill(Some(1u8.into())); // With macros text_6x8!("Hello Rust!", fill = Some(1u8.into())); -
Added a bunch of examples and docs. I hope it makes the crate easier to use! Please open an issue if anything is missing or hard to understand.
-
Fromis implemented for a few more types forCoordandUnsignedCoord. Among other things, they can now be converted to tuples by calling.into().
Removed
- (breaking)
PixelColorU*types. Use vanillau8,u16oru32instead.PixelColorU8->u8PixelColorU16->u16PixelColorU32->u32
- (breaking) The deprecated
.dimensions()method for fonts is replaced by the.size()method from theWithStyletrait. This makes fonts consistent with other embedded-graphics objects
Fixed
-
Circles with no stroke but
Some(...)fill are now rendered instead of skipped. -
Embedded graphics objects can now be returned from functions, chained or not. For example:
fn multi() -> impl Iterator<Item = Pixel<u8>> { let line = Line::new(Coord::new(0, 1), Coord::new(2, 3)) .stroke(Some(1u8.into())); let circle = Circle::new(Coord::new(5, 5), 3) .stroke(Some(1u8.into())); line.into_iter().chain(circle) }