Struct kurbo::RoundedRect [−][src]
pub struct RoundedRect { /* fields omitted */ }
Expand description
A rectangle with equally rounded corners.
By construction the rounded rectangle will have non-negative dimensions and radii clamped to half size of the rect.
The easiest way to create a RoundedRect
is often to create a Rect
,
and then call to_rounded_rect
.
use kurbo::{RoundedRect, RoundedRectRadii};
// Create a rounded rectangle with a single radius for all corners:
RoundedRect::new(0.0, 0.0, 10.0, 10.0, 5.0);
// Or, specify different radii for each corner, clockwise from the top-left:
RoundedRect::new(0.0, 0.0, 10.0, 10.0, (1.0, 2.0, 3.0, 4.0));
Implementations
pub fn new(
x0: f64,
y0: f64,
x1: f64,
y1: f64,
radii: impl Into<RoundedRectRadii>
) -> RoundedRect
pub fn new(
x0: f64,
y0: f64,
x1: f64,
y1: f64,
radii: impl Into<RoundedRectRadii>
) -> RoundedRect
A new rectangle from minimum and maximum coordinates.
The result will have non-negative width, height and radii.
A new rounded rectangle from a rectangle and corner radii.
The result will have non-negative width, height and radii.
See also Rect::to_rounded_rect
, which offers the same utility.
pub fn from_points(
p0: impl Into<Point>,
p1: impl Into<Point>,
radii: impl Into<RoundedRectRadii>
) -> RoundedRect
pub fn from_points(
p0: impl Into<Point>,
p1: impl Into<Point>,
radii: impl Into<RoundedRectRadii>
) -> RoundedRect
A new rectangle from two Point
s.
The result will have non-negative width, height and radius.
pub fn from_origin_size(
origin: impl Into<Point>,
size: impl Into<Size>,
radii: impl Into<RoundedRectRadii>
) -> RoundedRect
pub fn from_origin_size(
origin: impl Into<Point>,
size: impl Into<Size>,
radii: impl Into<RoundedRectRadii>
) -> RoundedRect
A new rectangle from origin and size.
The result will have non-negative width, height and radius.
Radii of the rounded corners.
The origin of the rectangle.
This is the top left corner in a y-down space.
Trait Implementations
type Output = RoundedRect
type Output = RoundedRect
The resulting type after applying the +
operator.
Performs the +
operation. Read more
Returns the “default value” for a type. Read more
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
type Output = RoundedRect
type Output = RoundedRect
The resulting type after applying the *
operator.
Performs the *
operation. Read more
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
type PathElementsIter = RoundedRectPathIter
type PathElementsIter = RoundedRectPathIter
The iterator returned by the path_elements
method. Read more
The smallest rectangle that encloses the shape.
If the shape is a rounded rectangle, make it available.
type Output = RoundedRect
type Output = RoundedRect
The resulting type after applying the -
operator.
Performs the -
operation. Read more
Auto Trait Implementations
impl RefUnwindSafe for RoundedRect
impl Send for RoundedRect
impl Sync for RoundedRect
impl Unpin for RoundedRect
impl UnwindSafe for RoundedRect
Blanket Implementations
Mutably borrows from an owned value. Read more