pub type CGFloat = f64;
#[repr(C)]
#[derive(Debug, Copy, Clone, PartialEq)]
pub struct CGPoint {
pub x: CGFloat,
pub y: CGFloat,
}
impl CGPoint {
pub const ZERO: CGPoint = CGPoint { x: 0.0, y: 0.0 };
}
#[repr(C)]
#[derive(Debug, PartialEq, Copy, Clone)]
pub struct CGSize {
pub width: CGFloat,
pub height: CGFloat,
}
impl CGSize {
pub const ZERO: CGSize = CGSize {
width: 0.0,
height: 0.0,
};
}
#[repr(C)]
#[derive(Debug, Copy, Clone, PartialEq)]
pub struct CGRect {
pub origin: CGPoint,
pub size: CGSize,
}
impl CGRect {
pub fn new(x: CGFloat, y: CGFloat, width: CGFloat, height: CGFloat) -> CGRect {
CGRect {
origin: CGPoint { x, y },
size: CGSize { width, height },
}
}
pub const ZERO: CGRect = CGRect {
origin: CGPoint { x: 0.0, y: 0.0 },
size: CGSize {
width: 0.0,
height: 0.0,
},
};
pub fn height(&self) -> CGFloat {
self.size.height
}
pub fn width(&self) -> CGFloat {
self.size.width
}
}