Interface TextureRegistry.SurfaceProducer
- All Superinterfaces:
- TextureRegistry.TextureEntry
- Enclosing interface:
- TextureRegistry
- 
Nested Class SummaryNested Classes
- 
Method SummaryModifier and TypeMethodDescriptionDirect access to a surface, which will be newly created (and thus, different from any surface objects returned from previous calls togetSurface()orgetForcedNewSurface().intDirect access to the surface object.intgetWidth()booleanReturns whether the current rendering path handles crop and rotation metadata.voidThis method is not officially part of the public API surface and will be deprecated.voidSets a callback that is notified when a previously createdSurfacereturned bygetSurface()is no longer valid due to being destroyed, or a new surface is now available (after the previous one was destroyed) for rendering.voidsetSize(int width, int height) Specify the size of this texture in physical pixelsMethods inherited from interface io.flutter.view.TextureRegistry.TextureEntryid, release
- 
Method Details- 
setSizevoid setSize(int width, int height) Specify the size of this texture in physical pixels
- 
getWidthint getWidth()- Returns:
- The currently specified width (physical pixels)
 
- 
getHeightint getHeight()- Returns:
- The currently specified height (physical pixels)
 
- 
getSurfaceSurface getSurface()Direct access to the surface object.When using this API, you will usually need to implement TextureRegistry.SurfaceProducer.Callbackand 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 getSurfaceeach 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.
 
- 
getForcedNewSurfaceSurface getForcedNewSurface()Direct access to a surface, which will be newly created (and thus, different from any surface objects returned from previous calls togetSurface()orgetForcedNewSurface().When using this API, you will usually need to implement TextureRegistry.SurfaceProducer.Callbackand 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 getSurfaceeach 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.
 
- 
setCallbackSets a callback that is notified when a previously createdSurfacereturned bygetSurface()is no longer valid due to being destroyed, or a new surface is now available (after the previous one was destroyed) for rendering.- Parameters:
- callback- The callback to notify, or null to remove the callback.
 
- 
scheduleFramevoid scheduleFrame()This method is not officially part of the public API surface and will be deprecated.
- 
handlesCropAndRotationboolean handlesCropAndRotation()Returns whether the current rendering path handles crop and rotation metadata.On most newer Android devices (API 29+), a ImageReaderbackend is used, which has more features, works in new graphic backends directly (such as Impeller's Vulkan backend), and is the Android recommended solution. However, crop and rotation metadata are not handled automatically, and require plugin authors to make appropriate changes ().void example(SurfaceProducer producer) { bool supported = producer.handlesCropAndRotation(); if (!supported) { // Manually rotate/crop, either in the Android plugin or in the Dart framework layer. } }- Returns:
- trueif crop and rotation is handled automatically,- falseotherwise.
 
 
-