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#[doc(alias = "CVMetalTextureRef")]
20#[cfg(all(feature = "CVBuffer", feature = "CVImageBuffer"))]
21pub type CVMetalTexture = CVImageBuffer;
22
23#[inline]
24pub extern "C-unwind" fn CVMetalTextureGetTypeID() -> CFTypeID {
25 extern "C-unwind" {
26 fn CVMetalTextureGetTypeID() -> CFTypeID;
27 }
28 unsafe { CVMetalTextureGetTypeID() }
29}
30
31/// Returns the Metal MTLTexture object of the CVMetalTextureRef
32///
33/// Parameter `image`: Target CVMetalTexture
34///
35/// Returns: Metal texture
36#[cfg(all(
37 feature = "CVBuffer",
38 feature = "CVImageBuffer",
39 feature = "objc2",
40 feature = "objc2-metal"
41))]
42#[cfg(not(target_os = "watchos"))]
43#[inline]
44pub extern "C-unwind" fn CVMetalTextureGetTexture(
45 image: &CVMetalTexture,
46) -> Option<Retained<ProtocolObject<dyn MTLTexture>>> {
47 extern "C-unwind" {
48 fn CVMetalTextureGetTexture(image: &CVMetalTexture) -> *mut ProtocolObject<dyn MTLTexture>;
49 }
50 let ret = unsafe { CVMetalTextureGetTexture(image) };
51 unsafe { Retained::retain_autoreleased(ret) }
52}
53
54/// Returns whether the image is flipped vertically or not.
55///
56/// Parameter `image`: Target CVMetalTexture
57///
58/// Returns: True if 0,0 in the texture is upper left, false if 0,0 is lower left
59#[cfg(all(feature = "CVBuffer", feature = "CVImageBuffer"))]
60#[inline]
61pub extern "C-unwind" fn CVMetalTextureIsFlipped(image: &CVMetalTexture) -> bool {
62 extern "C-unwind" {
63 fn CVMetalTextureIsFlipped(image: &CVMetalTexture) -> Boolean;
64 }
65 let ret = unsafe { CVMetalTextureIsFlipped(image) };
66 ret != 0
67}
68
69extern "C" {
70 /// 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
71 ///
72 /// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvmetaltextureusage?language=objc)
73 pub static kCVMetalTextureUsage: &'static CFString;
74}
75
76extern "C" {
77 /// 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
78 ///
79 /// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvmetaltexturestoragemode?language=objc)
80 pub static kCVMetalTextureStorageMode: &'static CFString;
81}