pub struct Ellipse {
pub top_left: Point,
pub size: Size,
}
Expand description
Ellipse primitive
§Examples §Create some ellipses with different stylesuse embedded_graphics::{
pixelcolor::Rgb565,
prelude::*,
primitives::{Ellipse, PrimitiveStyle, PrimitiveStyleBuilder},
};
Ellipse::new(Point::new(10, 20), Size::new(30, 40))
.into_styled(PrimitiveStyle::with_stroke(Rgb565::WHITE, 1))
.draw(&mut display)?;
let style = PrimitiveStyleBuilder::new()
.stroke_color(Rgb565::RED)
.stroke_width(3)
.fill_color(Rgb565::GREEN)
.build();
Ellipse::new(Point::new(20, 30), Size::new(40, 30))
.into_styled(style)
.draw(&mut display)?;
Ellipse::new(Point::new(10, 20), Size::new(20, 40))
.translate(Point::new(10, -15))
.into_styled(PrimitiveStyle::with_fill(Rgb565::BLUE))
.draw(&mut display)?;
Top-left point of ellipse’s bounding box
Size of the ellipse
Source§ SourceCreate a new ellipse delimited with a top-left point with a specific size
SourceCreate a new ellipse centered around a given point with a specific size
SourceReturn the center point of the ellipse
Source§ Source§ Source§Returns true
if the given point is inside the shape.
Writes the defmt representation of self
to fmt
.
Tests for self
and other
values to be equal, and is used by ==
.
Tests for !=
. The default implementation is almost always sufficient, and should not be overridden without very good reason.
This method returns an ordering between
self
and
other
values if one exists.
Read more 1.0.0 · Source§Tests less than (for
self
and
other
) and is used by the
<
operator.
Read more 1.0.0 · Source§Tests less than or equal to (for
self
and
other
) and is used by the
<=
operator.
Read more 1.0.0 · Source§Tests greater than (for
self
and
other
) and is used by the
>
operator.
Read more 1.0.0 · Source§Tests greater than or equal to (for
self
and
other
) and is used by the
>=
operator.
Read more Source§ Source§Iterator over all points inside the primitive.
Source§Returns an iterator over all points inside the primitive.
Source§ Source§Converts this primitive into a Styled
.
Returns the bounding box using the given style.
Source§ Source§ Source§Translate the ellipse from its current position to a new position by (x, y) pixels, returning a new Ellipse
. For a mutating transform, see translate_mut
.
let ellipse = Ellipse::new(Point::new(5, 10), Size::new(10, 15));
let moved = ellipse.translate(Point::new(10, 10));
assert_eq!(moved.top_left, Point::new(15, 20));
Source§
Translate the ellipse from its current position to a new position by (x, y) pixels.
let mut ellipse = Ellipse::new(Point::new(5, 10), Size::new(10, 15));
ellipse.translate_mut(Point::new(10, 10));
assert_eq!(ellipse.top_left, Point::new(15, 20));
Source§ Source§ Source§
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4