pub struct RRect {
pub left: f64,
pub top: f64,
pub right: f64,
pub bottom: f64,
pub tl_radius_x: f64,
pub tl_radius_y: f64,
pub tr_radius_x: f64,
pub tr_radius_y: f64,
pub br_radius_x: f64,
pub br_radius_y: f64,
pub bl_radius_x: f64,
pub bl_radius_y: f64,
}Expand description
An immutable rounded rectangle with the custom radii for all four corners.
Fields§
§left: f64The offset of the left edge of this rectangle from the x axis.
top: f64The offset of the top edge of this rectangle from the y axis.
right: f64The offset of the right edge of this rectangle from the x axis.
bottom: f64The offset of the bottom edge of this rectangle from the y axis.
tl_radius_x: f64The top-left horizontal radius.
tl_radius_y: f64The top-left vertical radius.
tr_radius_x: f64The top-right horizontal radius.
tr_radius_y: f64The top-right vertical radius.
br_radius_x: f64The bottom-right horizontal radius.
br_radius_y: f64The bottom-right vertical radius.
bl_radius_x: f64The bottom-left horizontal radius.
bl_radius_y: f64The bottom-left vertical radius.
Implementations§
Source§impl RRect
impl RRect
Sourcepub fn from_ltrbxy(
left: f64,
top: f64,
right: f64,
bottom: f64,
radius_x: f64,
radius_y: f64,
) -> RRect
pub fn from_ltrbxy( left: f64, top: f64, right: f64, bottom: f64, radius_x: f64, radius_y: f64, ) -> RRect
Construct from left, top, right, bottom, and the same radii along the horizontal axis and the vertical axis.
Sourcepub fn from_ltrbr(
left: f64,
top: f64,
right: f64,
bottom: f64,
radius: Radius,
) -> RRect
pub fn from_ltrbr( left: f64, top: f64, right: f64, bottom: f64, radius: Radius, ) -> RRect
Construct from left, top, right, bottom, and the same radius in each corner.
Sourcepub fn from_rect_xy(rect: Rect, radius_x: f64, radius_y: f64) -> RRect
pub fn from_rect_xy(rect: Rect, radius_x: f64, radius_y: f64) -> RRect
Construct from a bounding box and the same radii along each axis.
Sourcepub fn from_rect_and_radius(rect: Rect, radius: Radius) -> RRect
pub fn from_rect_and_radius(rect: Rect, radius: Radius) -> RRect
Construct from a bounding box and a radius that is the same in each corner.
Sourcepub fn from_ltrb_and_corners(
left: f64,
top: f64,
right: f64,
bottom: f64,
top_left: Radius,
top_right: Radius,
bottom_right: Radius,
bottom_left: Radius,
) -> RRect
pub fn from_ltrb_and_corners( left: f64, top: f64, right: f64, bottom: f64, top_left: Radius, top_right: Radius, bottom_right: Radius, bottom_left: Radius, ) -> RRect
Construct from left, top, right, bottom, and per-corner radii.
Sourcepub fn from_rect_and_corners(
rect: Rect,
top_left: Radius,
top_right: Radius,
bottom_right: Radius,
bottom_left: Radius,
) -> RRect
pub fn from_rect_and_corners( rect: Rect, top_left: Radius, top_right: Radius, bottom_right: Radius, bottom_left: Radius, ) -> RRect
Construct from a bounding box and per-corner radii.
Sourcepub fn inflate(self, delta: f64) -> RRect
pub fn inflate(self, delta: f64) -> RRect
Returns a clone with edges and radii moved outwards by delta.
Sourcepub fn deflate(self, delta: f64) -> RRect
pub fn deflate(self, delta: f64) -> RRect
Returns a clone with edges and radii moved inwards by delta.
Sourcepub fn outer_rect(self) -> Rect
pub fn outer_rect(self) -> Rect
The bounding box of this rounded rectangle.
Sourcepub fn safe_inner_rect(self) -> Rect
pub fn safe_inner_rect(self) -> Rect
The non-rounded rectangle constrained by the smaller of the two diagonals through the middle of the curve corners.
Sourcepub fn middle_rect(self) -> Rect
pub fn middle_rect(self) -> Rect
The rectangle formed from the inner-most centers of the corner ellipses.
Sourcepub fn wide_middle_rect(self) -> Rect
pub fn wide_middle_rect(self) -> Rect
The biggest rectangle entirely inside with the full width.
Sourcepub fn tall_middle_rect(self) -> Rect
pub fn tall_middle_rect(self) -> Rect
The biggest rectangle entirely inside with the full height.
Sourcepub fn is_stadium(self) -> bool
pub fn is_stadium(self) -> bool
Whether this rounded rectangle has a side with no straight section.
Sourcepub fn is_ellipse(self) -> bool
pub fn is_ellipse(self) -> bool
Whether this rounded rectangle has no side with a straight section.
Sourcepub fn shortest_side(self) -> f64
pub fn shortest_side(self) -> f64
The lesser of the magnitudes of the width and the height.
Sourcepub fn longest_side(self) -> f64
pub fn longest_side(self) -> f64
The greater of the magnitudes of the width and the height.
Sourcepub fn center(self) -> Offset
pub fn center(self) -> Offset
The offset halfway between the left and right and the top and bottom edges.
Sourcepub fn scale_radii(self) -> RRect
pub fn scale_radii(self) -> RRect
Scales all radii so that on each side their sum will not exceed the width or height.