Struct gdk4::Rectangle

``#[repr(transparent)]pub struct Rectangle { /* private fields */ }``
Expand description

A `Rectangle` data type for representing rectangles.

`Rectangle` is identical to `cairo_rectangle_t`. Together with Cairo’s `cairo::Region` data type, these are the central types for representing sets of pixels.

The intersection of two rectangles can be computed with `intersect()`; to find the union of two rectangles use `union()`.

The `cairo::Region` type provided by Cairo is usually used for managing non-rectangular clipping of graphical operations.

The Graphene library has a number of other data types for regions and volumes in 2D and 3D.

Implementations

Returns `true` if @self contains the point described by @x and @y.

X coordinate

Y coordinate

Returns

`true` if @self contains the point

Calculates the intersection of two rectangles.

It is allowed for @dest to be the same as either @self or @src2. If the rectangles do not intersect, @dest’s width and height is set to 0 and its x and y values are undefined. If you are only interested in whether the rectangles intersect, but not in the intersecting area itself, pass `None` for @dest.

Returns

`true` if the rectangles intersect.

`dest`

return location for the intersection of @self and @src2

Calculates the union of two rectangles.

The union of rectangles @self and @src2 is the smallest rectangle which includes both @self and @src2 within it. It is allowed for @dest to be the same as either @self or @src2.

Note that this function does not ignore ‘empty’ rectangles (ie. with zero width or height).

Returns
`dest`

return location for the union of @self and @src2

Trait Implementations

Converts this type into a shared reference of the (usually inferred) input type.

Returns a copy of the value. Read more

Performs copy-assignment from `source`. Read more

Formats the value using the given formatter. Read more

Converts to this type from the input type.

Note that converting between a `cairo::Rectangle` and `Rectangle` will probably lead to precisison errors. Use cautiously.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

This method tests for `self` and `other` values to be equal, and is used by `==`. Read more

This method tests for `!=`.

Returns the type identifier of `Self`.

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

Returns the argument unchanged.

Calls `U::from(self)`.

That is, this conversion is whatever the implementation of `From<T> for U` chooses to do.

Ensures that the type has been registered with the type system.

The resulting type after obtaining ownership.

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

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

Returns a `SendValue` clone of `self`.

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.