pub struct Arc {
pub top_left: Point,
pub diameter: u32,
pub angle_start: Angle,
pub angle_sweep: Angle,
}
Expand description
Arc primitive
§Examples §Create some arcs with different stylesuse embedded_graphics::{
pixelcolor::Rgb565,
prelude::*,
primitives::{Arc, PrimitiveStyle, PrimitiveStyleBuilder},
};
Arc::new(Point::new(10, 20), 30, 0.0.deg(), 90.0.deg())
.into_styled(PrimitiveStyle::with_stroke(Rgb565::WHITE, 1))
.draw(&mut display)?;
let style = PrimitiveStyleBuilder::new()
.stroke_color(Rgb565::RED)
.stroke_width(3)
.build();
Arc::new(Point::new(15, 25), 20, 180.0.deg(), -90.0.deg())
.into_styled(style)
.draw(&mut display)?;
Top-left point of the bounding-box of the circle supporting the arc
Diameter of the circle supporting the arc
Angle at which the arc starts
Angle defining the arc sweep starting at angle_start
Source§ SourceCreate a new arc delimited with a top-left point with a specific diameter and start and sweep angles
SourceCreate a new arc centered around a given point with a specific diameter and start and sweep angles
SourceCreates an arc based on a circle.
The resulting arc will match the top_left
and diameter
of the base circle.
Returns a circle with the same top_left
and diameter
as this arc.
Return the center point of the arc.
Source§ Source§ Source§ Source§ Source§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 arc from its current position to a new position by (x, y) pixels, returning a new Arc
. For a mutating transform, see translate_mut
.
let arc = Arc::new(Point::new(5, 10), 10, 0.0.deg(), 90.0.deg());
let moved = arc.translate(Point::new(10, 10));
assert_eq!(moved.top_left, Point::new(15, 20));
Source§
Translate the arc from its current position to a new position by (x, y) pixels.
let mut arc = Arc::new(Point::new(5, 10), 10, 0.0.deg(), 90.0.deg());
arc.translate_mut(Point::new(10, 10));
assert_eq!(arc.top_left, Point::new(15, 20));
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