Struct pix::Region

source · []
pub struct Region { /* private fields */ }
Expand description

Location / dimensions of pixels relative to a Raster.

Create directly

use pix::Region;

let r0 = Region::new(80, 20, 120, 280);
let r1 = r0.intersection((50, 40, 360, 240));

Create from Raster

use pix::rgb::SRgb8;
use pix::Raster;

let r = Raster::<SRgb8>::with_clear(100, 100);
let reg = r.region(); // (0, 0, 100, 100)

Implementations

Create a new Region

Get intersection with another Region

Get the left side

Get the top side

Get the width

Get the height

Get right side

Get bottom side

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

Returns the “default value” for a type. Read more

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 !=.

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

Returns the argument unchanged.

Calls U::from(self).

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

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

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.