Struct CGRect
#[repr(C)]pub struct CGRect {
pub origin: CGPoint,
pub size: CGSize,
}Expand description
CGRect representation
Represents a rectangle with an origin point and size dimensions.
§Examples
use apple_cf::cg::CGRect;
let rect = CGRect::new(10.0, 20.0, 100.0, 200.0);
assert_eq!(rect.origin.x, 10.0);
assert_eq!(rect.size.width, 100.0);
assert_eq!(rect.max_x(), 110.0);Fields§
§origin: CGPoint§size: CGSizeImplementations§
§impl CGRect
impl CGRect
pub const fn new(x: f64, y: f64, width: f64, height: f64) -> CGRect
pub const fn new(x: f64, y: f64, width: f64, height: f64) -> CGRect
Create a new rectangle
§Examples
use apple_cf::cg::CGRect;
let rect = CGRect::new(0.0, 0.0, 1920.0, 1080.0);
assert_eq!(rect.size.width, 1920.0);pub const fn zero() -> CGRect
pub const fn zero() -> CGRect
Create a zero-sized rectangle at origin
§Examples
use apple_cf::cg::CGRect;
let rect = CGRect::zero();
assert!(rect.is_null());pub const fn from_origin_size(origin: CGPoint, size: CGSize) -> CGRect
pub const fn from_origin_size(origin: CGPoint, size: CGSize) -> CGRect
Create a rect with origin and size.
pub const fn with_origin_and_size(origin: CGPoint, size: CGSize) -> CGRect
pub const fn with_origin_and_size(origin: CGPoint, size: CGSize) -> CGRect
Create a rect with origin and size.
pub fn contains_point(&self, p: CGPoint) -> bool
pub fn contains_point(&self, p: CGPoint) -> bool
Returns whether the rectangle contains the provided point.
Trait Implementations§
impl Copy for CGRect
impl Eq for CGRect
impl StructuralPartialEq for CGRect
Auto Trait Implementations§
impl Freeze for CGRect
impl RefUnwindSafe for CGRect
impl Send for CGRect
impl Sync for CGRect
impl Unpin for CGRect
impl UnsafeUnpin for CGRect
impl UnwindSafe for CGRect
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more