use super::{CGAffineTransform, CGFloat};
#[repr(C)]
#[derive(Copy, Clone, Debug, Default, PartialOrd, PartialEq)]
pub struct CGPoint {
pub x: CGFloat,
pub y: CGFloat,
}
impl From<(CGFloat, CGFloat)> for CGPoint {
#[inline]
fn from((x, y): (CGFloat, CGFloat)) -> Self {
Self::new(x, y)
}
}
impl CGPoint {
pub const ZERO: Self = Self::new(0.0, 0.0);
#[inline]
#[doc(alias = "CGPointMake")]
pub const fn new(x: CGFloat, y: CGFloat) -> Self {
Self { x, y }
}
#[inline]
pub const fn from_i16s(x: i16, y: i16) -> Self {
Self::new(x as _, y as _)
}
#[inline]
#[doc(alias = "CGPointApplyAffineTransform")]
pub fn apply(self, transform: CGAffineTransform) -> Self {
extern "C" {
fn CGPointApplyAffineTransform(point: CGPoint, transform: CGAffineTransform)
-> CGPoint;
}
unsafe { CGPointApplyAffineTransform(self, transform) }
}
}