#[repr(C)]pub struct CGSize {
pub width: f64,
pub height: f64,
}Expand description
CGSize representation
Represents a 2D size with width and height.
§Examples
use screencapturekit::cg::CGSize;
let size = CGSize::new(1920.0, 1080.0);
assert_eq!(size.aspect_ratio(), 1920.0 / 1080.0);
assert_eq!(size.area(), 1920.0 * 1080.0);Fields§
§width: f64§height: f64Implementations§
Source§impl CGSize
impl CGSize
Sourcepub const fn new(width: f64, height: f64) -> Self
pub const fn new(width: f64, height: f64) -> Self
Create a new size
§Examples
use screencapturekit::cg::CGSize;
let size = CGSize::new(800.0, 600.0);
assert_eq!(size.width, 800.0);Sourcepub const fn zero() -> Self
pub const fn zero() -> Self
Create a zero-sized size
§Examples
use screencapturekit::cg::CGSize;
let size = CGSize::zero();
assert!(size.is_null());Sourcepub fn aspect_ratio(&self) -> f64
pub fn aspect_ratio(&self) -> f64
Get the aspect ratio (width / height)
Sourcepub const fn is_square(&self) -> bool
pub const fn is_square(&self) -> bool
Check if this is a square (width == height) Note: Uses exact comparison, may not work well with computed values
pub fn is_empty(&self) -> bool
Trait Implementations§
impl Copy for CGSize
impl Eq for CGSize
impl StructuralPartialEq for CGSize
Auto Trait Implementations§
impl Freeze for CGSize
impl RefUnwindSafe for CGSize
impl Send for CGSize
impl Sync for CGSize
impl Unpin for CGSize
impl UnwindSafe for CGSize
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