Flutter Linux Embedder
fl_texture_registrar.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_SHELL_PLATFORM_LINUX_PUBLIC_FLUTTER_LINUX_FL_TEXTURE_REGISTRAR_H_
6 #define FLUTTER_SHELL_PLATFORM_LINUX_PUBLIC_FLUTTER_LINUX_FL_TEXTURE_REGISTRAR_H_
7 
8 #if !defined(__FLUTTER_LINUX_INSIDE__) && !defined(FLUTTER_LINUX_COMPILATION)
9 #error "Only <flutter_linux/flutter_linux.h> can be included directly."
10 #endif
11 
12 #include <glib-object.h>
13 #include <gmodule.h>
14 #include <stdint.h>
15 
16 #include "fl_texture.h"
17 
18 G_BEGIN_DECLS
19 
20 G_MODULE_EXPORT
21 G_DECLARE_INTERFACE(FlTextureRegistrar,
22  fl_texture_registrar,
23  FL,
24  TEXTURE_REGISTRAR,
25  GObject)
26 
27 struct _FlTextureRegistrarInterface {
28  GTypeInterface parent_iface;
29 
30  gboolean (*register_texture)(FlTextureRegistrar* registrar,
31  FlTexture* texture);
32 
33  FlTexture* (*lookup_texture)(FlTextureRegistrar* registrar, int64_t id);
34 
35  gboolean (*mark_texture_frame_available)(FlTextureRegistrar* registrar,
36  FlTexture* texture);
37 
38  gboolean (*unregister_texture)(FlTextureRegistrar* registrar,
39  FlTexture* texture);
40 
41  void (*shutdown)(FlTextureRegistrar* registrar);
42 };
43 
44 /**
45  * FlTextureRegistrar:
46  *
47  * #FlTextureRegistrar is used when registering textures.
48  *
49  * Flutter Framework accesses your texture by the related unique texture ID. To
50  * draw your texture in Dart, you should add Texture widget in your widget tree
51  * with the same texture ID. Use platform channels to send this unique texture
52  * ID to the Dart side.
53  */
54 
55 /**
56  * fl_texture_registrar_register_texture:
57  * @registrar: an #FlTextureRegistrar.
58  * @texture: an #FlTexture for registration.
59  *
60  * Registers a texture.
61  *
62  * Returns: %TRUE on success.
63  */
64 gboolean fl_texture_registrar_register_texture(FlTextureRegistrar* registrar,
65  FlTexture* texture);
66 
67 /**
68  * fl_texture_registrar_mark_texture_frame_available:
69  * @registrar: an #FlTextureRegistrar.
70  * @texture: the texture that has a frame available.
71  *
72  * Notifies the flutter engine that the texture object has updated and needs to
73  * be rerendered.
74  *
75  * Returns: %TRUE on success.
76  */
78  FlTextureRegistrar* registrar,
79  FlTexture* texture);
80 
81 /**
82  * fl_texture_registrar_unregister_texture:
83  * @registrar: an #FlTextureRegistrar.
84  * @texture: the texture being unregistered.
85  *
86  * Unregisters an existing texture object.
87  *
88  * Returns: %TRUE on success.
89  */
90 gboolean fl_texture_registrar_unregister_texture(FlTextureRegistrar* registrar,
91  FlTexture* texture);
92 
93 G_END_DECLS
94 
95 #endif // FLUTTER_SHELL_PLATFORM_LINUX_PUBLIC_FLUTTER_LINUX_FL_TEXTURE_REGISTRAR_H_
fl_texture_registrar_register_texture
gboolean fl_texture_registrar_register_texture(FlTextureRegistrar *registrar, FlTexture *texture)
Definition: fl_texture_registrar.cc:181
G_DECLARE_INTERFACE
G_BEGIN_DECLS G_MODULE_EXPORT G_DECLARE_INTERFACE(FlTextureRegistrar, fl_texture_registrar, FL, TEXTURE_REGISTRAR, GObject) struct _FlTextureRegistrarInterface
Definition: fl_texture_registrar.h:21
shutdown
static void shutdown(FlBinaryMessenger *messenger)
Definition: fl_binary_messenger.cc:367
id
int64_t id
Definition: fl_pixel_buffer_texture.cc:28
mark_texture_frame_available
static gboolean mark_texture_frame_available(FlTextureRegistrar *registrar, FlTexture *texture)
Definition: fl_texture_registrar.cc:117
unregister_texture
static gboolean unregister_texture(FlTextureRegistrar *registrar, FlTexture *texture)
Definition: fl_texture_registrar.cc:130
fl_texture_registrar_unregister_texture
gboolean fl_texture_registrar_unregister_texture(FlTextureRegistrar *registrar, FlTexture *texture)
Definition: fl_texture_registrar.cc:206
FL
FL
Definition: fl_binary_messenger.cc:27
fl_texture_registrar_mark_texture_frame_available
gboolean fl_texture_registrar_mark_texture_frame_available(FlTextureRegistrar *registrar, FlTexture *texture)
Definition: fl_texture_registrar.cc:197
register_texture
static gboolean register_texture(FlTextureRegistrar *registrar, FlTexture *texture)
Definition: fl_texture_registrar.cc:75
fl_texture.h