Struct gsk4::RoundedRect[][src]

pub struct RoundedRect(_);
Expand description

A rectangular region with rounded corners.

Application code should normalize rectangles using normalize(); this function will ensure that the bounds of the rectangle are normalized and ensure that the corner values are positive and the corners do not overlap.

All functions taking a RoundedRect as an argument will internally operate on a normalized copy; all functions returning a RoundedRect will always return a normalized one.

The algorithm used for normalizing corner sizes is described in the CSS specification.

Implementations

Initializes the given RoundedRect with the given values.

This function will implicitly normalize the RoundedRect before returning.

bounds

a graphene_rect_t describing the bounds

top_left

the rounding radius of the top left corner

top_right

the rounding radius of the top right corner

bottom_right

the rounding radius of the bottom right corner

bottom_left

the rounding radius of the bottom left corner

Returns

the initialized rectangle

Initializes self to the given bounds and sets the radius of all four corners to radius.

bounds

a graphene_rect_t

radius

the border radius

Returns

the initialized rectangle

Normalizes the passed rectangle.

This function will ensure that the bounds of the rectangle are normalized and ensure that the corner values are positive and the corners do not overlap.

Returns

the normalized rectangle

Offsets the bound’s origin by dx and dy.

The size and corners of the rectangle are unchanged.

dx

the horizontal offset

dy

the vertical offset

Returns

the offset rectangle

Shrinks (or grows) the given rectangle by moving the 4 sides according to the offsets given.

The corner radii will be changed in a way that tries to keep the center of the corner circle intact. This emulates CSS behavior.

This function also works for growing rectangles if you pass negative values for the top, right, bottom or left.

top

How far to move the top side downwards

How far to move the right side to the left

bottom

How far to move the bottom side upwards

left

How far to move the left side to the right

Returns

the resized RoundedRect

Checks if all corners of self are right angles and the rectangle covers all of its bounds.

This information can be used to decide if ClipNode::new() or RoundedClipNode::new() should be called.

Returns

true if the rectangle is rectilinear

Checks if the given point is inside the rounded rectangle.

point

the point to check

Returns

true if the point is inside the rounded rectangle

Checks if the given rect is contained inside the rounded rectangle.

rect

the rectangle to check

Returns

true if the rect is fully contained inside the rounded rectangle

Checks if part of the given rect is contained inside the rounded rectangle.

rect

the rectangle to check

Returns

true if the rect intersects with the rounded rectangle

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.