objc2_phase/generated/
PHASEEnvelope.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::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11    /// *************************************************************************************************
12    ///
13    ///
14    ///
15    /// A numeric pair.
16    ///
17    /// See also [Apple's documentation](https://developer.apple.com/documentation/phase/phasenumericpair?language=objc)
18    #[unsafe(super(NSObject))]
19    #[derive(Debug, PartialEq, Eq, Hash)]
20    pub struct PHASENumericPair;
21);
22
23extern_conformance!(
24    unsafe impl NSObjectProtocol for PHASENumericPair {}
25);
26
27impl PHASENumericPair {
28    extern_methods!(
29        /// Initialize a numeric pair with a first and second value.
30        ///
31        /// Parameter `first`: The first value in the pair.
32        ///
33        /// Parameter `second`: The second value in the pair.
34        ///
35        /// Returns: A new pair.
36        #[unsafe(method(initWithFirstValue:secondValue:))]
37        #[unsafe(method_family = init)]
38        pub unsafe fn initWithFirstValue_secondValue(
39            this: Allocated<Self>,
40            first: c_double,
41            second: c_double,
42        ) -> Retained<Self>;
43
44        /// The first value in the numeric pair.
45        ///
46        /// The default value is 0.0.
47        #[unsafe(method(first))]
48        #[unsafe(method_family = none)]
49        pub unsafe fn first(&self) -> c_double;
50
51        /// Setter for [`first`][Self::first].
52        #[unsafe(method(setFirst:))]
53        #[unsafe(method_family = none)]
54        pub unsafe fn setFirst(&self, first: c_double);
55
56        /// The second value in the numeric pair.
57        ///
58        /// The default value is 0.0.
59        #[unsafe(method(second))]
60        #[unsafe(method_family = none)]
61        pub unsafe fn second(&self) -> c_double;
62
63        /// Setter for [`second`][Self::second].
64        #[unsafe(method(setSecond:))]
65        #[unsafe(method_family = none)]
66        pub unsafe fn setSecond(&self, second: c_double);
67    );
68}
69
70/// Methods declared on superclass `NSObject`.
71impl PHASENumericPair {
72    extern_methods!(
73        #[unsafe(method(init))]
74        #[unsafe(method_family = init)]
75        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
76
77        #[unsafe(method(new))]
78        #[unsafe(method_family = new)]
79        pub unsafe fn new() -> Retained<Self>;
80    );
81}
82
83extern_class!(
84    /// *************************************************************************************************
85    ///
86    ///
87    ///
88    /// An envelope segment defined by an end point and a curve type.
89    ///
90    /// Envelope segments do 'not' contain a start point.
91    /// We do this so we can connect envelope segments together end to end and gaurantee continuity along the x and y axes.
92    ///
93    /// See also [Apple's documentation](https://developer.apple.com/documentation/phase/phaseenvelopesegment?language=objc)
94    #[unsafe(super(NSObject))]
95    #[derive(Debug, PartialEq, Eq, Hash)]
96    pub struct PHASEEnvelopeSegment;
97);
98
99extern_conformance!(
100    unsafe impl NSObjectProtocol for PHASEEnvelopeSegment {}
101);
102
103impl PHASEEnvelopeSegment {
104    extern_methods!(
105        #[cfg(feature = "PHASETypes")]
106        /// The curve type of the envelope segment.
107        ///
108        /// The default value is PHASECurveTypeLinear.
109        #[unsafe(method(curveType))]
110        #[unsafe(method_family = none)]
111        pub unsafe fn curveType(&self) -> PHASECurveType;
112
113        #[cfg(feature = "PHASETypes")]
114        /// Setter for [`curveType`][Self::curveType].
115        #[unsafe(method(setCurveType:))]
116        #[unsafe(method_family = none)]
117        pub unsafe fn setCurveType(&self, curve_type: PHASECurveType);
118    );
119}
120
121/// Methods declared on superclass `NSObject`.
122impl PHASEEnvelopeSegment {
123    extern_methods!(
124        #[unsafe(method(init))]
125        #[unsafe(method_family = init)]
126        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
127
128        #[unsafe(method(new))]
129        #[unsafe(method_family = new)]
130        pub unsafe fn new() -> Retained<Self>;
131    );
132}
133
134extern_class!(
135    /// *************************************************************************************************
136    ///
137    ///
138    ///
139    /// A segmented envelope.
140    ///
141    /// See also [Apple's documentation](https://developer.apple.com/documentation/phase/phaseenvelope?language=objc)
142    #[unsafe(super(NSObject))]
143    #[derive(Debug, PartialEq, Eq, Hash)]
144    pub struct PHASEEnvelope;
145);
146
147extern_conformance!(
148    unsafe impl NSObjectProtocol for PHASEEnvelope {}
149);
150
151impl PHASEEnvelope {
152    extern_methods!(
153        #[unsafe(method(init))]
154        #[unsafe(method_family = init)]
155        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
156
157        #[unsafe(method(new))]
158        #[unsafe(method_family = new)]
159        pub unsafe fn new() -> Retained<Self>;
160
161        /// Evaluates the envelope.
162        ///
163        /// If required, x will be clamped to the envelope's domain.
164        ///
165        /// Parameter `x`: The input along the x-axis.
166        ///
167        /// Returns: The output along the y-axis.
168        #[unsafe(method(evaluateForValue:))]
169        #[unsafe(method_family = none)]
170        pub unsafe fn evaluateForValue(&self, x: c_double) -> c_double;
171
172        /// The segments of the envelope.
173        #[unsafe(method(segments))]
174        #[unsafe(method_family = none)]
175        pub unsafe fn segments(&self) -> Retained<NSArray<PHASEEnvelopeSegment>>;
176
177        /// The domain (along the x-axis).
178        ///
179        /// The first value in the pair is the minimum value of the domain.
180        /// The second value in the pair is the maximum value of the domain.
181        #[unsafe(method(domain))]
182        #[unsafe(method_family = none)]
183        pub unsafe fn domain(&self) -> Retained<PHASENumericPair>;
184
185        /// The range (along the y-axis).
186        ///
187        /// The first value in the pair is the minimum value of the range.
188        /// The second value in the pair is the maximum value of the range.
189        #[unsafe(method(range))]
190        #[unsafe(method_family = none)]
191        pub unsafe fn range(&self) -> Retained<PHASENumericPair>;
192    );
193}