objc2_core_image/generated/
CIVector.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5#[cfg(feature = "objc2-core-foundation")]
6use objc2_core_foundation::*;
7use objc2_foundation::*;
8
9use crate::*;
10
11extern_class!(
12    /// The Core Image class that defines a vector object.
13    ///
14    /// A `CIVector` can store one or more `CGFloat` in one object. They can store a group of float values
15    /// for a variety of different uses such as coordinate points, direction vectors, geometric rectangles,
16    /// transform matrices, convolution weights, or just a list a parameter values.
17    ///
18    /// You use `CIVector` objects in conjunction with other Core Image classes, such as ``CIFilter-class``
19    /// and ``CIKernel``.  Many of the built-in Core Image filters have one or more `CIVector` inputs that
20    /// you can set to affect the filter's behavior.
21    ///
22    /// See also [Apple's documentation](https://developer.apple.com/documentation/coreimage/civector?language=objc)
23    #[unsafe(super(NSObject))]
24    #[derive(Debug, PartialEq, Eq, Hash)]
25    pub struct CIVector;
26);
27
28unsafe impl Send for CIVector {}
29
30unsafe impl Sync for CIVector {}
31
32extern_conformance!(
33    unsafe impl NSCoding for CIVector {}
34);
35
36extern_conformance!(
37    unsafe impl NSCopying for CIVector {}
38);
39
40unsafe impl CopyingHelper for CIVector {
41    type Result = Self;
42}
43
44extern_conformance!(
45    unsafe impl NSObjectProtocol for CIVector {}
46);
47
48extern_conformance!(
49    unsafe impl NSSecureCoding for CIVector {}
50);
51
52impl CIVector {
53    extern_methods!(
54        #[cfg(feature = "objc2-core-foundation")]
55        /// Create a Core Image vector object that is initialized with the specified values.
56        /// - Parameters:
57        /// - values: The pointer `CGFloat` values to initialize the vector with.
58        /// - count: The number of `CGFloats` specified by the `values` parameter.
59        /// - Returns:
60        /// An autoreleased ``CIVector`` object of length `count`.
61        ///
62        /// # Safety
63        ///
64        /// `values` must be a valid pointer.
65        #[unsafe(method(vectorWithValues:count:))]
66        #[unsafe(method_family = none)]
67        pub unsafe fn vectorWithValues_count(
68            values: NonNull<CGFloat>,
69            count: usize,
70        ) -> Retained<Self>;
71
72        #[cfg(feature = "objc2-core-foundation")]
73        /// Create a Core Image vector object that is initialized with one value.
74        /// - Parameters:
75        /// - x: The value for the first position in the vector.
76        /// - Returns:
77        /// An autoreleased ``CIVector`` object of length 1.
78        #[unsafe(method(vectorWithX:))]
79        #[unsafe(method_family = none)]
80        pub unsafe fn vectorWithX(x: CGFloat) -> Retained<Self>;
81
82        #[cfg(feature = "objc2-core-foundation")]
83        /// Create a Core Image vector object that is initialized with two values.
84        /// - Parameters:
85        /// - x: The value for the first position in the vector.
86        /// - y: The value for the second position in the vector.
87        /// - Returns:
88        /// An autoreleased ``CIVector`` object of length 2.
89        #[unsafe(method(vectorWithX:Y:))]
90        #[unsafe(method_family = none)]
91        pub unsafe fn vectorWithX_Y(x: CGFloat, y: CGFloat) -> Retained<Self>;
92
93        #[cfg(feature = "objc2-core-foundation")]
94        /// Create a Core Image vector object that is initialized with three values.
95        /// - Parameters:
96        /// - x: The value for the first position in the vector.
97        /// - y: The value for the second position in the vector.
98        /// - z: The value for the third position in the vector.
99        /// - Returns:
100        /// An autoreleased ``CIVector`` object of length 3.
101        #[unsafe(method(vectorWithX:Y:Z:))]
102        #[unsafe(method_family = none)]
103        pub unsafe fn vectorWithX_Y_Z(x: CGFloat, y: CGFloat, z: CGFloat) -> Retained<Self>;
104
105        #[cfg(feature = "objc2-core-foundation")]
106        /// Create a Core Image vector object that is initialized with four values.
107        /// - Parameters:
108        /// - x: The value for the first position in the vector.
109        /// - y: The value for the second position in the vector.
110        /// - z: The value for the third position in the vector.
111        /// - w: The value for the forth position in the vector.
112        /// - Returns:
113        /// An autoreleased ``CIVector`` object of length 4.
114        #[unsafe(method(vectorWithX:Y:Z:W:))]
115        #[unsafe(method_family = none)]
116        pub unsafe fn vectorWithX_Y_Z_W(
117            x: CGFloat,
118            y: CGFloat,
119            z: CGFloat,
120            w: CGFloat,
121        ) -> Retained<Self>;
122
123        #[cfg(feature = "objc2-core-foundation")]
124        /// Create a Core Image vector object that is initialized with two values provided by a `CGPoint` structure.
125        ///
126        /// The `CGRect` structure’s `y` and `y` values
127        /// are stored in the vector’s two values.
128        /// - Parameters:
129        /// - p: The `CGPoint` structure.
130        /// - Returns:
131        /// An autoreleased ``CIVector`` object of length 2.
132        #[unsafe(method(vectorWithCGPoint:))]
133        #[unsafe(method_family = none)]
134        pub unsafe fn vectorWithCGPoint(p: CGPoint) -> Retained<Self>;
135
136        #[cfg(feature = "objc2-core-foundation")]
137        /// Create a Core Image vector object that is initialized with four values provided by a `CGRect` structure.
138        ///
139        /// The `CGRect` structure’s `x`, `y`, `height` and `width` values
140        /// are stored in the vector’s four values.
141        /// - Parameters:
142        /// - r: The `CGRect` structure.
143        /// - Returns:
144        /// An autoreleased ``CIVector`` object of length 4.
145        #[unsafe(method(vectorWithCGRect:))]
146        #[unsafe(method_family = none)]
147        pub unsafe fn vectorWithCGRect(r: CGRect) -> Retained<Self>;
148
149        #[cfg(feature = "objc2-core-foundation")]
150        /// Create a Core Image vector object that is initialized with six values provided by a `CGAffineTransform` structure.
151        ///
152        /// The `CGAffineTransform` structure’s `a`, `b`, `c`, `d`, `tx` and `ty` values
153        /// are stored in the vector’s six values.
154        /// - Parameters:
155        /// - t: The `CGAffineTransform` structure.
156        /// - Returns:
157        /// An autoreleased ``CIVector`` object of length 6.
158        #[unsafe(method(vectorWithCGAffineTransform:))]
159        #[unsafe(method_family = none)]
160        pub unsafe fn vectorWithCGAffineTransform(t: CGAffineTransform) -> Retained<Self>;
161
162        /// Create a Core Image vector object with values provided in a string representation.
163        /// - Parameters:
164        /// - representation: A string that is in one of the formats returned by the `stringRepresentation` method.
165        /// - Returns:
166        /// An autoreleased ``CIVector`` object.
167        #[unsafe(method(vectorWithString:))]
168        #[unsafe(method_family = none)]
169        pub unsafe fn vectorWithString(representation: &NSString) -> Retained<Self>;
170
171        #[cfg(feature = "objc2-core-foundation")]
172        /// Initialize a Core Image vector object with the specified the values.
173        /// - Parameters:
174        /// - values: A pointer `CGFloat` values for vector.
175        /// - count: The number of `CGFloats` specified by the `values` parameter.
176        /// - Returns:
177        /// An initialized ``CIVector`` object of length `count`.
178        ///
179        /// # Safety
180        ///
181        /// `values` must be a valid pointer.
182        #[unsafe(method(initWithValues:count:))]
183        #[unsafe(method_family = init)]
184        pub unsafe fn initWithValues_count(
185            this: Allocated<Self>,
186            values: NonNull<CGFloat>,
187            count: usize,
188        ) -> Retained<Self>;
189
190        #[cfg(feature = "objc2-core-foundation")]
191        /// Initialize a Core Image vector object with one value.
192        /// - Parameters:
193        /// - x: The value for the first position in the vector.
194        /// - Returns:
195        /// An initialized ``CIVector`` object of length 1.
196        #[unsafe(method(initWithX:))]
197        #[unsafe(method_family = init)]
198        pub unsafe fn initWithX(this: Allocated<Self>, x: CGFloat) -> Retained<Self>;
199
200        #[cfg(feature = "objc2-core-foundation")]
201        /// Initialize a Core Image vector object with two values.
202        /// - Parameters:
203        /// - x: The value for the first position in the vector.
204        /// - y: The value for the second position in the vector.
205        /// - Returns:
206        /// An initialized ``CIVector`` object of length 2.
207        #[unsafe(method(initWithX:Y:))]
208        #[unsafe(method_family = init)]
209        pub unsafe fn initWithX_Y(this: Allocated<Self>, x: CGFloat, y: CGFloat) -> Retained<Self>;
210
211        #[cfg(feature = "objc2-core-foundation")]
212        /// Initialize a Core Image vector object with three values.
213        /// - Parameters:
214        /// - x: The value for the first position in the vector.
215        /// - y: The value for the second position in the vector.
216        /// - z: The value for the third position in the vector.
217        /// - Returns:
218        /// An initialized ``CIVector`` object of length 3.
219        #[unsafe(method(initWithX:Y:Z:))]
220        #[unsafe(method_family = init)]
221        pub unsafe fn initWithX_Y_Z(
222            this: Allocated<Self>,
223            x: CGFloat,
224            y: CGFloat,
225            z: CGFloat,
226        ) -> Retained<Self>;
227
228        #[cfg(feature = "objc2-core-foundation")]
229        /// Initialize a Core Image vector object with four values.
230        /// - Parameters:
231        /// - x: The value for the first position in the vector.
232        /// - y: The value for the second position in the vector.
233        /// - z: The value for the third position in the vector.
234        /// - w: The value for the forth position in the vector.
235        /// - Returns:
236        /// An initialized ``CIVector`` object of length 4.
237        #[unsafe(method(initWithX:Y:Z:W:))]
238        #[unsafe(method_family = init)]
239        pub unsafe fn initWithX_Y_Z_W(
240            this: Allocated<Self>,
241            x: CGFloat,
242            y: CGFloat,
243            z: CGFloat,
244            w: CGFloat,
245        ) -> Retained<Self>;
246
247        #[cfg(feature = "objc2-core-foundation")]
248        /// Initialize a Core Image vector object with two values provided by a `CGPoint` structure.
249        ///
250        /// The `CGRect` structure’s `y` and `y` values
251        /// are stored in the vector’s two values.
252        /// - Parameters:
253        /// - p: The `CGPoint` structure.
254        /// - Returns:
255        /// An initialized ``CIVector`` object of length 2.
256        #[unsafe(method(initWithCGPoint:))]
257        #[unsafe(method_family = init)]
258        pub unsafe fn initWithCGPoint(this: Allocated<Self>, p: CGPoint) -> Retained<Self>;
259
260        #[cfg(feature = "objc2-core-foundation")]
261        /// Initialize a Core Image vector object with four values provided by a `CGRect` structure.
262        ///
263        /// The `CGRect` structure’s `x`, `y`, `height` and `width` values
264        /// are stored in the vector’s four values.
265        /// - Parameters:
266        /// - r: The `CGRect` structure.
267        /// - Returns:
268        /// An initialized ``CIVector`` object of length 4.
269        #[unsafe(method(initWithCGRect:))]
270        #[unsafe(method_family = init)]
271        pub unsafe fn initWithCGRect(this: Allocated<Self>, r: CGRect) -> Retained<Self>;
272
273        #[cfg(feature = "objc2-core-foundation")]
274        /// Initialize a Core Image vector object with six values provided by a `CGAffineTransform` structure.
275        ///
276        /// The `CGAffineTransform` structure’s `a`, `b`, `c`, `c`, `tx` and `ty` values
277        /// are stored in the vector’s six values.
278        /// - Parameters:
279        /// - t: The `CGAffineTransform` structure.
280        /// - Returns:
281        /// An initialized ``CIVector`` object of length 6.
282        #[unsafe(method(initWithCGAffineTransform:))]
283        #[unsafe(method_family = init)]
284        pub unsafe fn initWithCGAffineTransform(
285            this: Allocated<Self>,
286            t: CGAffineTransform,
287        ) -> Retained<Self>;
288
289        /// Initialize a Core Image vector object with values provided in a string representation.
290        /// - Parameters:
291        /// - representation: A string that is in one of the formats returned by the `stringRepresentation` method.
292        /// - Returns:
293        /// An initialized ``CIVector`` object.
294        #[unsafe(method(initWithString:))]
295        #[unsafe(method_family = init)]
296        pub unsafe fn initWithString(
297            this: Allocated<Self>,
298            representation: &NSString,
299        ) -> Retained<Self>;
300
301        #[cfg(feature = "objc2-core-foundation")]
302        /// Returns a value from a specific position in the vector.
303        ///
304        /// The numbering of elements in a vector begins with zero.
305        /// - Parameters:
306        /// - index: The position in the vector of the value that you want to retrieve.
307        /// - Returns:
308        /// The value retrieved from the vector or `0` if the position is undefined.
309        #[unsafe(method(valueAtIndex:))]
310        #[unsafe(method_family = none)]
311        pub unsafe fn valueAtIndex(&self, index: usize) -> CGFloat;
312
313        /// The number of items in the vector.
314        #[unsafe(method(count))]
315        #[unsafe(method_family = none)]
316        pub unsafe fn count(&self) -> usize;
317
318        #[cfg(feature = "objc2-core-foundation")]
319        /// The value located in the first position in the vector.
320        #[unsafe(method(X))]
321        #[unsafe(method_family = none)]
322        pub unsafe fn X(&self) -> CGFloat;
323
324        #[cfg(feature = "objc2-core-foundation")]
325        /// The value located in the second position in the vector.
326        #[unsafe(method(Y))]
327        #[unsafe(method_family = none)]
328        pub unsafe fn Y(&self) -> CGFloat;
329
330        #[cfg(feature = "objc2-core-foundation")]
331        /// The value located in the third position in the vector.
332        #[unsafe(method(Z))]
333        #[unsafe(method_family = none)]
334        pub unsafe fn Z(&self) -> CGFloat;
335
336        #[cfg(feature = "objc2-core-foundation")]
337        /// The value located in the forth position in the vector.
338        #[unsafe(method(W))]
339        #[unsafe(method_family = none)]
340        pub unsafe fn W(&self) -> CGFloat;
341
342        #[cfg(feature = "objc2-core-foundation")]
343        /// Returns the values in the vector as a `CGPoint` structure.
344        /// - Returns:
345        /// Reading this property returns a `CGPoint` structure
346        /// from the `X` and `Y` values from the vector.
347        #[unsafe(method(CGPointValue))]
348        #[unsafe(method_family = none)]
349        pub unsafe fn CGPointValue(&self) -> CGPoint;
350
351        #[cfg(feature = "objc2-core-foundation")]
352        /// Returns the values in the vector as a `CGRect` structure.
353        /// - Returns:
354        /// Reading this property creates a `CGRect` structure
355        /// whose origin is the `X`, `Y`, `Z` and `W` values from the vector.
356        #[unsafe(method(CGRectValue))]
357        #[unsafe(method_family = none)]
358        pub unsafe fn CGRectValue(&self) -> CGRect;
359
360        #[cfg(feature = "objc2-core-foundation")]
361        /// Returns the values in the vector as a `CGAffineTransformValue` structure.
362        /// - Returns:
363        /// Reading this property creates a `CGAffineTransformValue` structure
364        /// from the first six values in the vector.
365        #[unsafe(method(CGAffineTransformValue))]
366        #[unsafe(method_family = none)]
367        pub unsafe fn CGAffineTransformValue(&self) -> CGAffineTransform;
368
369        /// Returns a formatted string with all the values of a `CIVector`.
370        ///
371        /// Some example string representations of vectors:
372        ///
373        /// `CIVector`                               | `stringRepresentation`
374        /// ---------------------------------------- | --------------
375        /// `[CIVector vectorWithX:1.0 Y:0.5 Z:0.3]` | `"[1.0 0.5 0.3]"`
376        /// `[CIVector vectorWithX:10.0 Y:23.0]`     | `"[10.0 23.0]"`
377        ///
378        /// To create a ``CIVector`` object from a string representation, use the ``vectorWithString:`` method.
379        #[unsafe(method(stringRepresentation))]
380        #[unsafe(method_family = none)]
381        pub unsafe fn stringRepresentation(&self) -> Retained<NSString>;
382    );
383}
384
385/// Methods declared on superclass `NSObject`.
386impl CIVector {
387    extern_methods!(
388        #[unsafe(method(init))]
389        #[unsafe(method_family = init)]
390        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
391
392        #[unsafe(method(new))]
393        #[unsafe(method_family = new)]
394        pub unsafe fn new() -> Retained<Self>;
395    );
396}