objc2_core_video/generated/
CVOpenGLBuffer.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2_core_foundation::*;
5#[cfg(feature = "objc2-open-gl")]
6#[cfg(target_os = "macos")]
7use objc2_open_gl::*;
8
9use crate::*;
10
11extern "C" {
12    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvopenglbufferwidth?language=objc)
13    #[deprecated = "OpenGL/OpenGLES is no longer supported. Use Metal APIs instead. (Define COREVIDEO_SILENCE_GL_DEPRECATION to silence these warnings)"]
14    pub static kCVOpenGLBufferWidth: &'static CFString;
15}
16
17extern "C" {
18    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvopenglbufferheight?language=objc)
19    #[deprecated = "OpenGL/OpenGLES is no longer supported. Use Metal APIs instead. (Define COREVIDEO_SILENCE_GL_DEPRECATION to silence these warnings)"]
20    pub static kCVOpenGLBufferHeight: &'static CFString;
21}
22
23extern "C" {
24    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvopenglbuffertarget?language=objc)
25    #[deprecated = "OpenGL/OpenGLES is no longer supported. Use Metal APIs instead. (Define COREVIDEO_SILENCE_GL_DEPRECATION to silence these warnings)"]
26    pub static kCVOpenGLBufferTarget: &'static CFString;
27}
28
29extern "C" {
30    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvopenglbufferinternalformat?language=objc)
31    #[deprecated = "OpenGL/OpenGLES is no longer supported. Use Metal APIs instead. (Define COREVIDEO_SILENCE_GL_DEPRECATION to silence these warnings)"]
32    pub static kCVOpenGLBufferInternalFormat: &'static CFString;
33}
34
35extern "C" {
36    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvopenglbuffermaximummipmaplevel?language=objc)
37    #[deprecated = "OpenGL/OpenGLES is no longer supported. Use Metal APIs instead. (Define COREVIDEO_SILENCE_GL_DEPRECATION to silence these warnings)"]
38    pub static kCVOpenGLBufferMaximumMipmapLevel: &'static CFString;
39}
40
41/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/cvopenglbuffer?language=objc)
42#[doc(alias = "CVOpenGLBufferRef")]
43#[cfg(all(feature = "CVBuffer", feature = "CVImageBuffer"))]
44pub type CVOpenGLBuffer = CVImageBuffer;
45
46#[deprecated = "OpenGL/OpenGLES is no longer supported. Use Metal APIs instead. (Define COREVIDEO_SILENCE_GL_DEPRECATION to silence these warnings)"]
47#[inline]
48pub extern "C-unwind" fn CVOpenGLBufferGetTypeID() -> CFTypeID {
49    extern "C-unwind" {
50        fn CVOpenGLBufferGetTypeID() -> CFTypeID;
51    }
52    unsafe { CVOpenGLBufferGetTypeID() }
53}
54
55extern "C-unwind" {
56    /// Create a new CVOpenGLBuffer that may be used for OpenGL rendering purposes
57    ///
58    /// Parameter `width`: The width of the buffer in pixels
59    ///
60    /// Parameter `height`: The height of the buffer in pixels
61    ///
62    /// Parameter `attributes`: A CFDictionaryRef containing other desired attributes of the buffer (texture target, internal format, max mipmap level, etc.).
63    /// May be NULL.  Defaults are GL_TEXTURE_RECTANGLE_EXT, GL_RGBA, and 0 for kCVOpenGLBufferTarget, kCVOpenGLBufferInternalFormat and kCVOpenGLBufferMaximumMipmapLevel,
64    /// respectively.
65    ///
66    /// Parameter `bufferOut`: The newly created buffer will be placed here.
67    ///
68    /// Returns: kCVReturnSuccess if the attachment succeeded
69    ///
70    /// # Safety
71    ///
72    /// - `attributes` generics must be of the correct type.
73    /// - `buffer_out` must be a valid pointer.
74    #[cfg(all(feature = "CVBuffer", feature = "CVImageBuffer", feature = "CVReturn"))]
75    #[deprecated = "OpenGL/OpenGLES is no longer supported. Use Metal APIs instead. (Define COREVIDEO_SILENCE_GL_DEPRECATION to silence these warnings)"]
76    pub fn CVOpenGLBufferCreate(
77        allocator: Option<&CFAllocator>,
78        width: usize,
79        height: usize,
80        attributes: Option<&CFDictionary>,
81        buffer_out: NonNull<*mut CVOpenGLBuffer>,
82    ) -> CVReturn;
83}
84
85/// Parameter `openGLBuffer`: Target OpenGL Buffer.
86///
87/// Returns: CVOpenGLBuffer attributes dictionary, NULL if not set.
88#[cfg(all(feature = "CVBuffer", feature = "CVImageBuffer"))]
89#[deprecated = "OpenGL/OpenGLES is no longer supported. Use Metal APIs instead. (Define COREVIDEO_SILENCE_GL_DEPRECATION to silence these warnings)"]
90#[inline]
91pub extern "C-unwind" fn CVOpenGLBufferGetAttributes(
92    open_gl_buffer: &CVOpenGLBuffer,
93) -> Option<CFRetained<CFDictionary>> {
94    extern "C-unwind" {
95        fn CVOpenGLBufferGetAttributes(
96            open_gl_buffer: &CVOpenGLBuffer,
97        ) -> Option<NonNull<CFDictionary>>;
98    }
99    let ret = unsafe { CVOpenGLBufferGetAttributes(open_gl_buffer) };
100    ret.map(|ret| unsafe { CFRetained::retain(ret) })
101}
102
103extern "C-unwind" {
104    /// Parameter `openGLBuffer`: The buffer you wish to attach a GL context to
105    ///
106    /// Parameter `cglContext`: The CGLContextObj you wish to attach
107    ///
108    /// Parameter `face`: The target GL face enum (0 for non cube maps)
109    ///
110    /// Parameter `level`: The mipmap level index you wish to attach to
111    ///
112    /// Parameter `screen`: The virtual screen number you want to use
113    ///
114    /// Returns: kCVReturnSuccess if the attachment succeeded
115    ///
116    /// # Safety
117    ///
118    /// `cgl_context` must be a valid pointer.
119    #[cfg(all(
120        feature = "CVBuffer",
121        feature = "CVImageBuffer",
122        feature = "CVReturn",
123        feature = "objc2-open-gl"
124    ))]
125    #[cfg(target_os = "macos")]
126    #[deprecated = "OpenGL/OpenGLES is no longer supported. Use Metal APIs instead. (Define COREVIDEO_SILENCE_GL_DEPRECATION to silence these warnings)"]
127    pub fn CVOpenGLBufferAttach(
128        open_gl_buffer: &CVOpenGLBuffer,
129        cgl_context: CGLContextObj,
130        face: GLenum,
131        level: GLint,
132        screen: GLint,
133    ) -> CVReturn;
134}