Struct pix_engine::shape::Ellipse [−][src]
#[repr(transparent)]pub struct Ellipse<T = i32>(_);
Expand description
An Ellipse
positioned at (x, y)
, with width
and height
. A circle is an Ellipse
where
width
and height
are equal.
Please see the module-level documentation for examples.
Implementations
Returns Ellipse
values as [x, y, width, height]
.
Example
let e = ellipse!(5, 10, 100, 100);
assert_eq!(e.as_array(), [5, 10, 100, 100]);
Returns Ellipse
values as a byte slice &[x, y, width, height]
.
Example
let e = ellipse!(5, 10, 100, 100);
assert_eq!(e.as_bytes(), &[5, 10, 100, 100]);
Returns Ellipse
values as a mutable byte slice &[x, y, width, height]
.
Example
let mut e = ellipse!(5, 10, 100, 100);
for v in e.as_bytes_mut() {
*v += 5;
}
assert_eq!(e.as_bytes(), &[10, 15, 105, 105]);
Sets the height
of the ellipse.
Constructs a circle Ellipse
at position (x, y)
with radius
.
Constructs an Ellipse
at position Point with width
and height
.
Constructs a circle Ellipse
at position Point with radius
.
Constructs an Ellipse
centered at position (x, y)
with width
and height
.
Example
let e = Ellipse::from_center([50, 50], 100, 100);
assert_eq!(e.as_array(), [0, 0, 100, 100]);
Constructs a circle Ellipse
centered at position (x, y)
with radius
.
Example
let c = Ellipse::circle_from_center([50, 50], 100);
assert_eq!(c.as_array(), [0, 0, 200, 200]);
Sets the radius
of the circle.
Offsets an ellipse by shifting coordinates by given amount.
Offsets the x-coordinate
of the ellipse by a given amount.
Offsets the y-coordinate
of the ellipse by a given amount.
Offsets the width
of the ellipse by a given amount.
Offsets the height
of the ellipse by a given amount.
Offsets the radius
of the circle by a given amount.
Returns the bounding Rect of the ellipse.
Set the vertical position of the bottom edge.
Returns the bottom-left position as Point.
Returns the bottom-right position as Point.
Converts Ellipse < T > to Ellipse < U >.
Returns Ellipse < T > with the nearest integers to the numbers. Round half-way cases away from 0.0.
Returns Ellipse < T > with the largest integers less than or equal to the numbers.
Trait Implementations
Returns whether this ellipse contains a given Point.
Returns whether this ellipse completely contains another ellipse.
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Creates a value from an iterator. Read more
Returns the closest intersection point with a given line and distance along the line or
None
if there is no intersection.
Returns whether this circle intersects with another circle.
Auto Trait Implementations
impl<T> RefUnwindSafe for Ellipse<T> where
T: RefUnwindSafe,
impl<T> UnwindSafe for Ellipse<T> where
T: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more