Flutter Engine
The Flutter Engine
Instance Methods | Class Methods | List of all members
FlutterTextureRegistrar Class Reference

#import <FlutterTextureRegistrar.h>

Inheritance diagram for FlutterTextureRegistrar:
<FlutterTextureRegistry>

Instance Methods

(nullable instancetype) - NS_UNAVAILABLE
 
(nullable instancetype) - initWithDelegate:engine:
 
(nullable FlutterExternalTexture *) - getTextureWithID:
 
(instancetype) - initWithDelegate:engine: [implementation]
 
(int64_t) - registerTexture: [implementation]
 
(void) - textureFrameAvailable: [implementation]
 
(void) - unregisterTexture: [implementation]
 
- Instance Methods inherited from <FlutterTextureRegistry>
(int64_t) - registerTexture:
 
(void) - textureFrameAvailable:
 
(void) - unregisterTexture:
 

Class Methods

(nullable instancetype) + NS_UNAVAILABLE
 

Detailed Description

Definition at line 28 of file FlutterTextureRegistrar.h.

Method Documentation

◆ getTextureWithID:

- (FlutterExternalTexture *) getTextureWithID: (int64_t)  textureID

Definition at line 15 of file FlutterTextureRegistrar.mm.

57 :(int64_t)textureID {
58 return _textures[@(textureID)];
59}
NSMutableDictionary< NSNumber *, FlutterExternalTexture * > * _textures

◆ initWithDelegate:engine: [1/2]

- (instancetype) initWithDelegate: (id<FlutterTextureRegistrarDelegate>)  delegate
engine: (FlutterEngine*)  engine 
implementation

Definition at line 15 of file FlutterTextureRegistrar.mm.

18 :(id<FlutterTextureRegistrarDelegate>)delegate
20 if (self = [super init]) {
21 _delegate = delegate;
23 _textures = [[NSMutableDictionary alloc] init];
24 }
25 return self;
26}
__weak FlutterEngine * _flutterEngine
FlutterEngine engine
Definition: main.cc:68
static bool init()

◆ initWithDelegate:engine: [2/2]

- (nullable instancetype) initWithDelegate: (nonnull id< FlutterTextureRegistrarDelegate >)  delegate
engine: (nonnull FlutterEngine *)  NS_DESIGNATED_INITIALIZER 

◆ NS_UNAVAILABLE [1/2]

- (nullable instancetype) NS_UNAVAILABLE

◆ NS_UNAVAILABLE [2/2]

+ (nullable instancetype) NS_UNAVAILABLE

◆ registerTexture:

- (int64_t) registerTexture: (id<FlutterTexture>)  texture
implementation

Definition at line 15 of file FlutterTextureRegistrar.mm.

28 :(id<FlutterTexture>)texture {
29 FlutterExternalTexture* externalTexture = [_delegate onRegisterTexture:texture];
30 int64_t textureID = [externalTexture textureID];
31 BOOL success = [_flutterEngine registerTextureWithID:textureID];
32 if (success) {
33 _textures[@(textureID)] = externalTexture;
34 return textureID;
35 } else {
36 NSLog(@"Unable to register the texture with id: %lld.", textureID);
37 return 0;
38 }
39}
FlTexture * texture
int BOOL
Definition: windows_types.h:37

◆ textureFrameAvailable:

- (void) textureFrameAvailable: (int64_t)  textureId
implementation

Notifies Flutter that the content of the previously registered texture has been updated.

This will trigger a call to -[FlutterTexture copyPixelBuffer] on the raster thread.

Reimplemented from <FlutterTextureRegistry>.

Definition at line 15 of file FlutterTextureRegistrar.mm.

41 :(int64_t)textureID {
42 BOOL success = [_flutterEngine markTextureFrameAvailable:textureID];
43 if (!success) {
44 NSLog(@"Unable to mark texture with id %lld as available.", textureID);
45 }
46}

◆ unregisterTexture:

- (void) unregisterTexture: (int64_t)  textureId
implementation

Unregisters a FlutterTexture that has previously regeistered with registerTexture:. Textures must be unregistered on the platform thread.

Parameters
textureIdThe result that was previously returned from registerTexture:.

Reimplemented from <FlutterTextureRegistry>.

Definition at line 15 of file FlutterTextureRegistrar.mm.

48 :(int64_t)textureID {
49 bool success = [_flutterEngine unregisterTextureWithID:textureID];
50 if (success) {
51 [_textures removeObjectForKey:@(textureID)];
52 } else {
53 NSLog(@"Unable to unregister texture with id: %lld.", textureID);
54 }
55}

The documentation for this class was generated from the following files: