objc2_core_video/generated/
CVMetalTexture.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4#[cfg(feature = "objc2")]
5use objc2::__framework_prelude::*;
6use objc2_core_foundation::*;
7#[cfg(feature = "objc2-metal")]
8#[cfg(not(target_os = "watchos"))]
9use objc2_metal::*;
10
11use crate::*;
12
13/// Metal texture based image buffer
14///
15/// IMPORTANT NOTE: Clients should retain CVMetalTexture objects until they are done using the images in them.
16/// Retaining a CVMetalTexture is your way to indicate that you're still using the image in the buffer, and that it should not be recycled yet.
17///
18/// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/cvmetaltexture?language=objc)
19#[cfg(all(feature = "CVBuffer", feature = "CVImageBuffer"))]
20pub type CVMetalTexture = CVImageBuffer;
21
22#[inline]
23pub extern "C-unwind" fn CVMetalTextureGetTypeID() -> CFTypeID {
24    extern "C-unwind" {
25        fn CVMetalTextureGetTypeID() -> CFTypeID;
26    }
27    unsafe { CVMetalTextureGetTypeID() }
28}
29
30/// Returns the Metal MTLTexture object of the CVMetalTextureRef
31///
32/// Parameter `image`: Target CVMetalTexture
33///
34/// Returns: Metal texture
35#[cfg(all(
36    feature = "CVBuffer",
37    feature = "CVImageBuffer",
38    feature = "objc2",
39    feature = "objc2-metal"
40))]
41#[cfg(not(target_os = "watchos"))]
42#[inline]
43pub unsafe extern "C-unwind" fn CVMetalTextureGetTexture(
44    image: &CVMetalTexture,
45) -> Option<Retained<ProtocolObject<dyn MTLTexture>>> {
46    extern "C-unwind" {
47        fn CVMetalTextureGetTexture(image: &CVMetalTexture) -> *mut ProtocolObject<dyn MTLTexture>;
48    }
49    let ret = unsafe { CVMetalTextureGetTexture(image) };
50    unsafe { Retained::retain_autoreleased(ret) }
51}
52
53/// Returns whether the image is flipped vertically or not.
54///
55/// Parameter `image`: Target CVMetalTexture
56///
57/// Returns: True if 0,0 in the texture is upper left, false if 0,0 is lower left
58#[cfg(all(feature = "CVBuffer", feature = "CVImageBuffer"))]
59#[inline]
60pub unsafe extern "C-unwind" fn CVMetalTextureIsFlipped(image: &CVMetalTexture) -> bool {
61    extern "C-unwind" {
62        fn CVMetalTextureIsFlipped(image: &CVMetalTexture) -> Boolean;
63    }
64    let ret = unsafe { CVMetalTextureIsFlipped(image) };
65    ret != 0
66}
67
68extern "C" {
69    /// kCVMetalTextureUsage is a property that can be placed on a CVMetalTextureCache to instruct the MTLTextureUsage of the created MTLTexture. Values for this can can be read from MTLTexture.h
70    ///
71    /// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvmetaltextureusage?language=objc)
72    pub static kCVMetalTextureUsage: &'static CFString;
73}
74
75extern "C" {
76    /// kCVMetalTextureStorageMode is a property that can be placed on a CVMetalTextureCache to instruct the MTLTextureStorageMode of the created MTLTexture. Values for this can can be read from MTLTexture.h
77    ///
78    /// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvmetaltexturestoragemode?language=objc)
79    pub static kCVMetalTextureStorageMode: &'static CFString;
80}