use objc2::__framework_prelude::*;
use crate::*;
#[cfg(feature = "NSGeometry")]
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct NSAffineTransformStruct {
pub m11: CGFloat,
pub m12: CGFloat,
pub m21: CGFloat,
pub m22: CGFloat,
pub tX: CGFloat,
pub tY: CGFloat,
}
#[cfg(feature = "NSGeometry")]
unsafe impl Encode for NSAffineTransformStruct {
const ENCODING: Encoding = Encoding::Struct(
"?",
&[
<CGFloat>::ENCODING,
<CGFloat>::ENCODING,
<CGFloat>::ENCODING,
<CGFloat>::ENCODING,
<CGFloat>::ENCODING,
<CGFloat>::ENCODING,
],
);
}
#[cfg(feature = "NSGeometry")]
unsafe impl RefEncode for NSAffineTransformStruct {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[cfg(feature = "NSGeometry")]
unsafe impl Send for NSAffineTransformStruct {}
#[cfg(feature = "NSGeometry")]
unsafe impl Sync for NSAffineTransformStruct {}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSAffineTransform;
unsafe impl ClassType for NSAffineTransform {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
#[cfg(feature = "NSObject")]
unsafe impl NSCoding for NSAffineTransform {}
#[cfg(feature = "NSObject")]
unsafe impl NSCopying for NSAffineTransform {}
unsafe impl NSObjectProtocol for NSAffineTransform {}
#[cfg(feature = "NSObject")]
unsafe impl NSSecureCoding for NSAffineTransform {}
extern_methods!(
unsafe impl NSAffineTransform {
#[method_id(@__retain_semantics Other transform)]
pub unsafe fn transform() -> Retained<NSAffineTransform>;
#[method_id(@__retain_semantics Init initWithTransform:)]
pub unsafe fn initWithTransform(
this: Allocated<Self>,
transform: &NSAffineTransform,
) -> Retained<Self>;
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[cfg(feature = "NSGeometry")]
#[method(translateXBy:yBy:)]
pub unsafe fn translateXBy_yBy(&self, delta_x: CGFloat, delta_y: CGFloat);
#[cfg(feature = "NSGeometry")]
#[method(rotateByDegrees:)]
pub unsafe fn rotateByDegrees(&self, angle: CGFloat);
#[cfg(feature = "NSGeometry")]
#[method(rotateByRadians:)]
pub unsafe fn rotateByRadians(&self, angle: CGFloat);
#[cfg(feature = "NSGeometry")]
#[method(scaleBy:)]
pub unsafe fn scaleBy(&self, scale: CGFloat);
#[cfg(feature = "NSGeometry")]
#[method(scaleXBy:yBy:)]
pub unsafe fn scaleXBy_yBy(&self, scale_x: CGFloat, scale_y: CGFloat);
#[method(invert)]
pub unsafe fn invert(&self);
#[method(appendTransform:)]
pub unsafe fn appendTransform(&self, transform: &NSAffineTransform);
#[method(prependTransform:)]
pub unsafe fn prependTransform(&self, transform: &NSAffineTransform);
#[cfg(feature = "NSGeometry")]
#[method(transformPoint:)]
pub unsafe fn transformPoint(&self, a_point: NSPoint) -> NSPoint;
#[cfg(feature = "NSGeometry")]
#[method(transformSize:)]
pub unsafe fn transformSize(&self, a_size: NSSize) -> NSSize;
#[cfg(feature = "NSGeometry")]
#[method(transformStruct)]
pub unsafe fn transformStruct(&self) -> NSAffineTransformStruct;
#[cfg(feature = "NSGeometry")]
#[method(setTransformStruct:)]
pub unsafe fn setTransformStruct(&self, transform_struct: NSAffineTransformStruct);
}
);
extern_methods!(
unsafe impl NSAffineTransform {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);