| Flutter macOS Embedder |

FlutterTexture.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef FLUTTER_FLUTTERTEXTURE_H_
6 #define FLUTTER_FLUTTERTEXTURE_H_
7
8 #import <CoreMedia/CoreMedia.h>
9 #import <Foundation/Foundation.h>
10
11 #import "FlutterMacros.h"
12
13 NS_ASSUME_NONNULL_BEGIN
14
15 FLUTTER_DARWIN_EXPORT
16 /**
17 * Represents a texture that can be shared with Flutter.
18 *
19 * See also: https://github.com/flutter/plugins/tree/master/packages/camera
20 */
21 @protocol FlutterTexture <NSObject>
22 /** Copy the contents of the texture into a `CVPixelBuffer`. */
23 - (CVPixelBufferRef _Nullable)copyPixelBuffer;
24
25 /**
26 * Called when the texture is unregistered.
27 *
28 * Called on the raster thread.
29 */
30 @optional
31 - (void)onTextureUnregistered:(NSObject<FlutterTexture>*)texture;
32 @end
33
34 FLUTTER_DARWIN_EXPORT
35 /**
36 * A collection of registered `FlutterTexture`'s.
37 */
38 @protocol FlutterTextureRegistry <NSObject>
39 /**
40 * Registers a `FlutterTexture` for usage in Flutter and returns an id that can be used to reference
41 * that texture when calling into Flutter with channels. Textures must be registered on the
42 * platform thread. On success returns the pointer to the registered texture, else returns 0.
43 */
44 - (int64_t)registerTexture:(NSObject<FlutterTexture>*)texture;
45 /**
46 * Notifies Flutter that the content of the previously registered texture has been updated.
47 *
48 * This will trigger a call to `-[FlutterTexture copyPixelBuffer]` on the raster thread.
49 */
50 - (void)textureFrameAvailable:(int64_t)textureId;
51 /**
52 * Unregisters a `FlutterTexture` that has previously regeistered with `registerTexture:`. Textures
53 * must be unregistered on the platform thread.
54 *
55 * @param textureId The result that was previously returned from `registerTexture:`.
56 */
57 - (void)unregisterTexture:(int64_t)textureId;
58 @end
59
60 NS_ASSUME_NONNULL_END
61
62 #endif // FLUTTER_FLUTTERTEXTURE_H_
NS_ASSUME_NONNULL_END
#define NS_ASSUME_NONNULL_END
Definition: FlutterMacros.h:20
FlutterTextureRegistry-p
Definition: FlutterTexture.h:38
NS_ASSUME_NONNULL_BEGIN
#define NS_ASSUME_NONNULL_BEGIN
Definition: FlutterMacros.h:19
FlutterMacros.h
-[FlutterTexture-p copyPixelBuffer]
CVPixelBufferRef _Nullable copyPixelBuffer()
FLUTTER_DARWIN_EXPORT
#define FLUTTER_DARWIN_EXPORT
Definition: FlutterMacros.h:14
FlutterTexture-p
Definition: FlutterTexture.h:21