Source code
Revision control
Copy as Markdown
Other Tools
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
use crate::*;
/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsaffinetransformstruct?language=objc)
#[cfg(feature = "objc2-core-foundation")]
#[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 = "objc2-core-foundation")]
unsafe impl Encode for NSAffineTransformStruct {
const ENCODING: Encoding = Encoding::Struct(
"?",
&[
<CGFloat>::ENCODING,
<CGFloat>::ENCODING,
<CGFloat>::ENCODING,
<CGFloat>::ENCODING,
<CGFloat>::ENCODING,
<CGFloat>::ENCODING,
],
);
}
#[cfg(feature = "objc2-core-foundation")]
unsafe impl RefEncode for NSAffineTransformStruct {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[cfg(feature = "objc2-core-foundation")]
unsafe impl Send for NSAffineTransformStruct {}
#[cfg(feature = "objc2-core-foundation")]
unsafe impl Sync for NSAffineTransformStruct {}
extern_class!(
/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsaffinetransform?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSAffineTransform;
);
#[cfg(feature = "NSObject")]
extern_conformance!(
unsafe impl NSCoding for NSAffineTransform {}
);
#[cfg(feature = "NSObject")]
extern_conformance!(
unsafe impl NSCopying for NSAffineTransform {}
);
#[cfg(feature = "NSObject")]
unsafe impl CopyingHelper for NSAffineTransform {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for NSAffineTransform {}
);
#[cfg(feature = "NSObject")]
extern_conformance!(
unsafe impl NSSecureCoding for NSAffineTransform {}
);
impl NSAffineTransform {
extern_methods!(
#[unsafe(method(transform))]
#[unsafe(method_family = none)]
pub fn transform() -> Retained<NSAffineTransform>;
#[unsafe(method(initWithTransform:))]
#[unsafe(method_family = init)]
pub fn initWithTransform(
this: Allocated<Self>,
transform: &NSAffineTransform,
) -> Retained<Self>;
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(translateXBy:yBy:))]
#[unsafe(method_family = none)]
pub fn translateXBy_yBy(&self, delta_x: CGFloat, delta_y: CGFloat);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(rotateByDegrees:))]
#[unsafe(method_family = none)]
pub fn rotateByDegrees(&self, angle: CGFloat);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(rotateByRadians:))]
#[unsafe(method_family = none)]
pub fn rotateByRadians(&self, angle: CGFloat);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(scaleBy:))]
#[unsafe(method_family = none)]
pub fn scaleBy(&self, scale: CGFloat);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(scaleXBy:yBy:))]
#[unsafe(method_family = none)]
pub fn scaleXBy_yBy(&self, scale_x: CGFloat, scale_y: CGFloat);
#[unsafe(method(invert))]
#[unsafe(method_family = none)]
pub fn invert(&self);
#[unsafe(method(appendTransform:))]
#[unsafe(method_family = none)]
pub fn appendTransform(&self, transform: &NSAffineTransform);
#[unsafe(method(prependTransform:))]
#[unsafe(method_family = none)]
pub fn prependTransform(&self, transform: &NSAffineTransform);
#[cfg(all(feature = "NSGeometry", feature = "objc2-core-foundation"))]
#[unsafe(method(transformPoint:))]
#[unsafe(method_family = none)]
pub fn transformPoint(&self, a_point: NSPoint) -> NSPoint;
#[cfg(all(feature = "NSGeometry", feature = "objc2-core-foundation"))]
#[unsafe(method(transformSize:))]
#[unsafe(method_family = none)]
pub fn transformSize(&self, a_size: NSSize) -> NSSize;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(transformStruct))]
#[unsafe(method_family = none)]
pub fn transformStruct(&self) -> NSAffineTransformStruct;
#[cfg(feature = "objc2-core-foundation")]
/// Setter for [`transformStruct`][Self::transformStruct].
#[unsafe(method(setTransformStruct:))]
#[unsafe(method_family = none)]
pub fn setTransformStruct(&self, transform_struct: NSAffineTransformStruct);
);
}
/// Methods declared on superclass `NSObject`.
impl NSAffineTransform {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for NSAffineTransform {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}