objc2_foundation/generated/
NSAffineTransform.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8
9use crate::*;
10
11/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsaffinetransformstruct?language=objc)
12#[cfg(feature = "objc2-core-foundation")]
13#[repr(C)]
14#[derive(Clone, Copy, Debug, PartialEq)]
15pub struct NSAffineTransformStruct {
16    pub m11: CGFloat,
17    pub m12: CGFloat,
18    pub m21: CGFloat,
19    pub m22: CGFloat,
20    pub tX: CGFloat,
21    pub tY: CGFloat,
22}
23
24#[cfg(feature = "objc2-core-foundation")]
25unsafe impl Encode for NSAffineTransformStruct {
26    const ENCODING: Encoding = Encoding::Struct(
27        "?",
28        &[
29            <CGFloat>::ENCODING,
30            <CGFloat>::ENCODING,
31            <CGFloat>::ENCODING,
32            <CGFloat>::ENCODING,
33            <CGFloat>::ENCODING,
34            <CGFloat>::ENCODING,
35        ],
36    );
37}
38
39#[cfg(feature = "objc2-core-foundation")]
40unsafe impl RefEncode for NSAffineTransformStruct {
41    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
42}
43
44#[cfg(feature = "objc2-core-foundation")]
45unsafe impl Send for NSAffineTransformStruct {}
46
47#[cfg(feature = "objc2-core-foundation")]
48unsafe impl Sync for NSAffineTransformStruct {}
49
50extern_class!(
51    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsaffinetransform?language=objc)
52    #[unsafe(super(NSObject))]
53    #[derive(Debug, PartialEq, Eq, Hash)]
54    pub struct NSAffineTransform;
55);
56
57#[cfg(feature = "NSObject")]
58extern_conformance!(
59    unsafe impl NSCoding for NSAffineTransform {}
60);
61
62#[cfg(feature = "NSObject")]
63extern_conformance!(
64    unsafe impl NSCopying for NSAffineTransform {}
65);
66
67#[cfg(feature = "NSObject")]
68unsafe impl CopyingHelper for NSAffineTransform {
69    type Result = Self;
70}
71
72extern_conformance!(
73    unsafe impl NSObjectProtocol for NSAffineTransform {}
74);
75
76#[cfg(feature = "NSObject")]
77extern_conformance!(
78    unsafe impl NSSecureCoding for NSAffineTransform {}
79);
80
81impl NSAffineTransform {
82    extern_methods!(
83        #[unsafe(method(transform))]
84        #[unsafe(method_family = none)]
85        pub unsafe fn transform() -> Retained<NSAffineTransform>;
86
87        #[unsafe(method(initWithTransform:))]
88        #[unsafe(method_family = init)]
89        pub unsafe fn initWithTransform(
90            this: Allocated<Self>,
91            transform: &NSAffineTransform,
92        ) -> Retained<Self>;
93
94        #[unsafe(method(init))]
95        #[unsafe(method_family = init)]
96        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
97
98        #[cfg(feature = "objc2-core-foundation")]
99        #[unsafe(method(translateXBy:yBy:))]
100        #[unsafe(method_family = none)]
101        pub unsafe fn translateXBy_yBy(&self, delta_x: CGFloat, delta_y: CGFloat);
102
103        #[cfg(feature = "objc2-core-foundation")]
104        #[unsafe(method(rotateByDegrees:))]
105        #[unsafe(method_family = none)]
106        pub unsafe fn rotateByDegrees(&self, angle: CGFloat);
107
108        #[cfg(feature = "objc2-core-foundation")]
109        #[unsafe(method(rotateByRadians:))]
110        #[unsafe(method_family = none)]
111        pub unsafe fn rotateByRadians(&self, angle: CGFloat);
112
113        #[cfg(feature = "objc2-core-foundation")]
114        #[unsafe(method(scaleBy:))]
115        #[unsafe(method_family = none)]
116        pub unsafe fn scaleBy(&self, scale: CGFloat);
117
118        #[cfg(feature = "objc2-core-foundation")]
119        #[unsafe(method(scaleXBy:yBy:))]
120        #[unsafe(method_family = none)]
121        pub unsafe fn scaleXBy_yBy(&self, scale_x: CGFloat, scale_y: CGFloat);
122
123        #[unsafe(method(invert))]
124        #[unsafe(method_family = none)]
125        pub unsafe fn invert(&self);
126
127        #[unsafe(method(appendTransform:))]
128        #[unsafe(method_family = none)]
129        pub unsafe fn appendTransform(&self, transform: &NSAffineTransform);
130
131        #[unsafe(method(prependTransform:))]
132        #[unsafe(method_family = none)]
133        pub unsafe fn prependTransform(&self, transform: &NSAffineTransform);
134
135        #[cfg(all(feature = "NSGeometry", feature = "objc2-core-foundation"))]
136        #[unsafe(method(transformPoint:))]
137        #[unsafe(method_family = none)]
138        pub unsafe fn transformPoint(&self, a_point: NSPoint) -> NSPoint;
139
140        #[cfg(all(feature = "NSGeometry", feature = "objc2-core-foundation"))]
141        #[unsafe(method(transformSize:))]
142        #[unsafe(method_family = none)]
143        pub unsafe fn transformSize(&self, a_size: NSSize) -> NSSize;
144
145        #[cfg(feature = "objc2-core-foundation")]
146        #[unsafe(method(transformStruct))]
147        #[unsafe(method_family = none)]
148        pub unsafe fn transformStruct(&self) -> NSAffineTransformStruct;
149
150        #[cfg(feature = "objc2-core-foundation")]
151        /// Setter for [`transformStruct`][Self::transformStruct].
152        #[unsafe(method(setTransformStruct:))]
153        #[unsafe(method_family = none)]
154        pub unsafe fn setTransformStruct(&self, transform_struct: NSAffineTransformStruct);
155    );
156}
157
158/// Methods declared on superclass `NSObject`.
159impl NSAffineTransform {
160    extern_methods!(
161        #[unsafe(method(new))]
162        #[unsafe(method_family = new)]
163        pub unsafe fn new() -> Retained<Self>;
164    );
165}