Struct gegl::Rectangle

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

GLib type: Inline allocated boxed type with stack copy semantics.

Implementations§

source§

impl Rectangle

source

pub fn x(&self) -> i32

source

pub fn y(&self) -> i32

source

pub fn width(&self) -> i32

source

pub fn height(&self) -> i32

source§

impl Rectangle

source

pub fn as_ptr(&self) -> *mut GeglRectangle

source

pub unsafe fn from_glib_ptr_borrow<'a>(ptr: *const GeglRectangle) -> &'a Self

Borrows the underlying C value.

source

pub unsafe fn from_glib_ptr_borrow_mut<'a>( ptr: *mut GeglRectangle ) -> &'a mut Self

Borrows the underlying C value mutably.

source§

impl Rectangle

source

pub fn new(x: i32, y: i32, width: u32, height: u32) -> Rectangle

Creates a new rectangle set with the values from x, y, width and height.

x

upper left x coordinate

y

upper left y coordinate

width

width in pixels.

height

height in pixels.

source

pub fn align( &mut self, rectangle: &Rectangle, tile: &Rectangle, alignment: RectangleAlignment ) -> bool

Aligns rectangle to a regular tile grid, of which tile is a representative tile, and stores the result in self.

alignment can be one of:

GEGL_RECTANGLE_ALIGNMENT_SUBSET: Calculate the biggest aligned rectangle contained in rectangle.

GEGL_RECTANGLE_ALIGNMENT_SUPERSET: Calculate the smallest aligned rectangle containing rectangle.

GEGL_RECTANGLE_ALIGNMENT_NEAREST: Calculate the nearest aligned rectangle to rectangle.

self may point to the same object as rectangle or tile.

Returns TRUE if the result is not empty.

rectangle

a Rectangle

tile

a Rectangle

alignment

a RectangleAlignment value

source

pub fn align_to_buffer( &mut self, rectangle: &Rectangle, buffer: &Buffer, alignment: RectangleAlignment ) -> bool

Aligns rectangle to the tile grid of buffer, and stores the result in self.

alignment has the same meaning as for align().

self may point to the same object as rectangle.

Returns TRUE if the result is not empty.

rectangle

a Rectangle

buffer

a Buffer

alignment

a RectangleAlignment value

source

pub fn bounding_box(&mut self, source1: &Rectangle, source2: &Rectangle)

Computes the bounding box of the rectangles source1 and source2 and stores the resulting bounding box in self.

self may point to the same object as source1 or source2.

source1

a Rectangle

source2

a Rectangle

source

pub fn contains(&self, child: &Rectangle) -> bool

Checks if the Rectangle child is fully contained within self.

Returns TRUE if the child is fully contained in self.

child

a Rectangle

source

pub fn dump(&self)

For debugging purposes, not stable API.

source

pub fn dup(&self) -> Option<Rectangle>

Create a new copy of self.

Returns

a Rectangle

source

pub fn equal_coords(&self, x: i32, y: i32, width: i32, height: i32) -> bool

Check if a rectangle is equal to a set of parameters.

Returns TRUE if self and x,y width x height are equal.

x

X coordinate

y

Y coordinate

width

width of rectangle

height

height of rectangle

source

pub fn intersect(&mut self, src1: &Rectangle, src2: &Rectangle) -> bool

Calculates the intersection of two rectangles. If the rectangles do not intersect, dest’s width and height are set to 0 and its x and y values are undefined.

self may point to the same object as src1 or src2.

Returns TRUE if the rectangles intersect.

src1

a Rectangle

src2

a Rectangle

source

pub fn is_empty(&self) -> bool

Check if a rectangle has zero area.

Returns TRUE if the width or height of self is 0.

source

pub fn is_infinite_plane(&self) -> bool

Returns TRUE if the GeglRectangle represents an infininte plane, FALSE otherwise.

source

pub fn set(&mut self, x: i32, y: i32, width: u32, height: u32)

Sets the x, y, width and height on self.

x

upper left x coordinate

y

upper left y coordinate

width

width in pixels.

height

height in pixels.

source

pub fn subtract(&mut self, minuend: &Rectangle, subtrahend: &Rectangle) -> i32

Subtracts subtrahend from minuend, and stores the resulting rectangles in self. Between 0 and 4 disjoint rectangles may be produced.

self may contain minuend or subtrahend.

Returns the number of resulting rectangles.

minuend

a Rectangle

subtrahend

a Rectangle

source

pub fn subtract_bounding_box( &mut self, minuend: &Rectangle, subtrahend: &Rectangle ) -> bool

Computes the bounding box of the area formed by subtracting subtrahend from minuend, and stores the result in self.

self may point to the same object as minuend or subtrahend.

Returns TRUE if the result is not empty.

minuend

a Rectangle

subtrahend

a Rectangle

source

pub fn xor(&mut self, source1: &Rectangle, source2: &Rectangle) -> i32

Computes the symmetric difference of the rectangles source1 and source2, and stores the resulting rectangles in self. Between 0 and 4 disjoint rectangles may be produced.

self may contain rectangle1 or rectangle2.

Returns the number of resulting rectangles.

source1

a Rectangle

source2

a Rectangle

Trait Implementations§

source§

impl Clone for Rectangle

source§

fn clone(&self) -> Self

Copies the inline boxed type by value with the type-specific copy function.

1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Rectangle

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl HasParamSpec for Rectangle

§

type ParamSpec = ParamSpecBoxed

§

type SetValue = Rectangle

Preferred value to be used as setter for the associated ParamSpec.
§

type BuilderFn = fn(_: &str) -> ParamSpecBoxedBuilder<'_, Rectangle>

source§

fn param_spec_builder() -> Self::BuilderFn

source§

impl PartialEq<Rectangle> for Rectangle

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl StaticType for Rectangle

source§

fn static_type() -> Type

Returns the type identifier of Self.
source§

impl Copy for Rectangle

source§

impl Eq for Rectangle

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GList> for Twhere T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,

§

unsafe fn from_glib_none_num_as_vec( ptr: *const GList, num: usize ) -> Vec<T, Global>

§

unsafe fn from_glib_container_num_as_vec( _: *const GList, _: usize ) -> Vec<T, Global>

§

unsafe fn from_glib_full_num_as_vec(_: *const GList, _: usize) -> Vec<T, Global>

§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GPtrArray> for Twhere T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,

§

unsafe fn from_glib_none_num_as_vec( ptr: *const GPtrArray, num: usize ) -> Vec<T, Global>

§

unsafe fn from_glib_container_num_as_vec( _: *const GPtrArray, _: usize ) -> Vec<T, Global>

§

unsafe fn from_glib_full_num_as_vec( _: *const GPtrArray, _: usize ) -> Vec<T, Global>

§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GSList> for Twhere T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,

§

unsafe fn from_glib_none_num_as_vec( ptr: *const GSList, num: usize ) -> Vec<T, Global>

§

unsafe fn from_glib_container_num_as_vec( _: *const GSList, _: usize ) -> Vec<T, Global>

§

unsafe fn from_glib_full_num_as_vec( _: *const GSList, _: usize ) -> Vec<T, Global>

§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GList> for Twhere T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,

§

unsafe fn from_glib_none_num_as_vec( ptr: *mut GList, num: usize ) -> Vec<T, Global>

§

unsafe fn from_glib_container_num_as_vec( ptr: *mut GList, num: usize ) -> Vec<T, Global>

§

unsafe fn from_glib_full_num_as_vec( ptr: *mut GList, num: usize ) -> Vec<T, Global>

§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GPtrArray> for Twhere T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,

§

unsafe fn from_glib_none_num_as_vec( ptr: *mut GPtrArray, num: usize ) -> Vec<T, Global>

§

unsafe fn from_glib_container_num_as_vec( ptr: *mut GPtrArray, num: usize ) -> Vec<T, Global>

§

unsafe fn from_glib_full_num_as_vec( ptr: *mut GPtrArray, num: usize ) -> Vec<T, Global>

§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GSList> for Twhere T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,

§

unsafe fn from_glib_none_num_as_vec( ptr: *mut GSList, num: usize ) -> Vec<T, Global>

§

unsafe fn from_glib_container_num_as_vec( ptr: *mut GSList, num: usize ) -> Vec<T, Global>

§

unsafe fn from_glib_full_num_as_vec( ptr: *mut GSList, num: usize ) -> Vec<T, Global>

§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GList> for Twhere T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,

§

unsafe fn from_glib_none_as_vec(ptr: *const GList) -> Vec<T, Global>

§

unsafe fn from_glib_container_as_vec(_: *const GList) -> Vec<T, Global>

§

unsafe fn from_glib_full_as_vec(_: *const GList) -> Vec<T, Global>

§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GPtrArray> for Twhere T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,

§

unsafe fn from_glib_none_as_vec(ptr: *const GPtrArray) -> Vec<T, Global>

§

unsafe fn from_glib_container_as_vec(_: *const GPtrArray) -> Vec<T, Global>

§

unsafe fn from_glib_full_as_vec(_: *const GPtrArray) -> Vec<T, Global>

§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GSList> for Twhere T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,

§

unsafe fn from_glib_none_as_vec(ptr: *const GSList) -> Vec<T, Global>

§

unsafe fn from_glib_container_as_vec(_: *const GSList) -> Vec<T, Global>

§

unsafe fn from_glib_full_as_vec(_: *const GSList) -> Vec<T, Global>

§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GList> for Twhere T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,

§

unsafe fn from_glib_none_as_vec(ptr: *mut GList) -> Vec<T, Global>

§

unsafe fn from_glib_container_as_vec(ptr: *mut GList) -> Vec<T, Global>

§

unsafe fn from_glib_full_as_vec(ptr: *mut GList) -> Vec<T, Global>

§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GPtrArray> for Twhere T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,

§

unsafe fn from_glib_none_as_vec(ptr: *mut GPtrArray) -> Vec<T, Global>

§

unsafe fn from_glib_container_as_vec(ptr: *mut GPtrArray) -> Vec<T, Global>

§

unsafe fn from_glib_full_as_vec(ptr: *mut GPtrArray) -> Vec<T, Global>

§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GSList> for Twhere T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,

§

unsafe fn from_glib_none_as_vec(ptr: *mut GSList) -> Vec<T, Global>

§

unsafe fn from_glib_container_as_vec(ptr: *mut GSList) -> Vec<T, Global>

§

unsafe fn from_glib_full_as_vec(ptr: *mut GSList) -> Vec<T, Global>

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

§

impl<T> IntoClosureReturnValue for Twhere T: Into<Value>,

§

impl<T> Property for Twhere T: HasParamSpec,

§

type Value = T

§

impl<T> PropertyGet for Twhere T: HasParamSpec,

§

type Value = T

§

fn get<R, F>(&self, f: F) -> Rwhere F: Fn(&<T as PropertyGet>::Value) -> R,

§

impl<T> StaticTypeExt for Twhere T: StaticType,

§

fn ensure_type()

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

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T> ToSendValue for Twhere T: Send + ToValue + ?Sized,

§

fn to_send_value(&self) -> SendValue

Returns a SendValue clone of self.
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T> TryFromClosureReturnValue for Twhere T: for<'a> FromValue<'a> + StaticType + 'static,

§

fn try_from_closure_return_value(v: Option<Value>) -> Result<T, BoolError>

source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<'a, T, C, E> FromValueOptional<'a> for Twhere T: FromValue<'a, Checker = C>, C: ValueTypeChecker<Error = ValueTypeMismatchOrNoneError<E>>, E: Error + Send + 'static,