Package io.flutter.view
Interface TextureRegistry.SurfaceProducer
- All Superinterfaces:
TextureRegistry.TextureEntry
- Enclosing interface:
- TextureRegistry
Uses a Surface to populate the texture.
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
Direct access to the surface object.int
getWidth()
void
This method is not officially part of the public API surface and will be deprecated.void
Sets a callback that is notified when a previously createdSurface
returned bygetSurface()
is no longer valid, either due to being destroyed or being changed.void
setSize
(int width, int height) Specify the size of this texture in physical pixelsMethods inherited from interface io.flutter.view.TextureRegistry.TextureEntry
id, release
-
Method Details
-
setSize
void setSize(int width, int height) Specify the size of this texture in physical pixels -
getWidth
int getWidth()- Returns:
- The currently specified width (physical pixels)
-
getHeight
int getHeight()- Returns:
- The currently specified height (physical pixels)
-
getSurface
Surface getSurface()Direct access to the surface object.When using this API, you will usually need to implement
TextureRegistry.SurfaceProducer.Callback
and provide it tosetCallback(Callback)
in order to be notified when an existing surface has been destroyed (such as when the application goes to the background) or a new surface has been created (such as when the application is resumed back to the foreground).NOTE: You should not cache the returned surface but instead invoke
getSurface
each time you need to draw. The surface may change when the texture is resized or has its format changed.- Returns:
- a Surface to use for a drawing target for various APIs.
-
setCallback
Sets a callback that is notified when a previously createdSurface
returned bygetSurface()
is no longer valid, either due to being destroyed or being changed.- Parameters:
callback
- The callback to notify, or null to remove the callback.
-
scheduleFrame
void scheduleFrame()This method is not officially part of the public API surface and will be deprecated.
-