diff --git a/src/geometry.rs b/src/geometry.rs index 06741f0..b7f73b0 100644 --- a/src/geometry.rs +++ b/src/geometry.rs @@ -21,6 +21,16 @@ pub struct CGSize { pub height: CGFloat, } +impl CGSize { + #[inline] + pub fn new(width: CGFloat, height: CGFloat) -> CGSize { + CGSize { + width: width, + height: height, + } + } +} + #[repr(C)] #[derive(Clone, Copy, Debug)] pub struct CGPoint { @@ -28,9 +38,30 @@ pub struct CGPoint { pub y: CGFloat, } +impl CGPoint { + #[inline] + pub fn new(x: CGFloat, y: CGFloat) -> CGPoint { + CGPoint { + x: x, + y: y, + } + } +} + #[repr(C)] #[derive(Clone, Copy, Debug)] pub struct CGRect { pub origin: CGPoint, pub size: CGSize } + +impl CGRect { + #[inline] + pub fn new(origin: &CGPoint, size: &CGSize) -> CGRect { + CGRect { + origin: *origin, + size: *size, + } + } +} +