public class FlutterRenderer extends Object implements TextureRegistry
FlutterEngine.
FlutterRenderer works in tandem with a provided RenderSurface to paint Flutter
pixels to an Android View hierarchy.
FlutterRenderer manages textures for rendering, and forwards some Java calls to native
Flutter code via JNI. The corresponding RenderSurface provides the Android Surface that this renderer paints.
FlutterSurfaceView and FlutterTextureView are implementations of RenderSurface.
| Modifier and Type | Class and Description |
|---|---|
static class |
FlutterRenderer.ViewportMetrics
Mutable data structure that holds all viewport metrics properties that Flutter cares about.
|
TextureRegistry.SurfaceTextureEntry| Constructor and Description |
|---|
FlutterRenderer(FlutterJNI flutterJNI) |
| Modifier and Type | Method and Description |
|---|---|
void |
addIsDisplayingFlutterUiListener(FlutterUiDisplayListener listener)
Adds a listener that is invoked whenever this
FlutterRenderer starts and stops painting
pixels to an Android View hierarchy. |
TextureRegistry.SurfaceTextureEntry |
createSurfaceTexture()
Creates and returns a new
SurfaceTexture that is also made available to Flutter code. |
void |
dispatchPointerDataPacket(ByteBuffer buffer,
int position) |
void |
dispatchSemanticsAction(int id,
int action,
ByteBuffer args,
int argsPosition) |
Bitmap |
getBitmap() |
boolean |
isDisplayingFlutterUi()
Returns true if this
FlutterRenderer is painting pixels to an Android View
hierarchy, false otherwise. |
boolean |
isSoftwareRenderingEnabled() |
void |
removeIsDisplayingFlutterUiListener(FlutterUiDisplayListener listener)
Removes a listener added via
addIsDisplayingFlutterUiListener(FlutterUiDisplayListener). |
void |
setAccessibilityFeatures(int flags) |
void |
setSemanticsEnabled(boolean enabled) |
void |
setViewportMetrics(FlutterRenderer.ViewportMetrics viewportMetrics)
Notifies Flutter that the viewport metrics, e.g.
|
void |
startRenderingToSurface(Surface surface)
Notifies Flutter that the given
surface was created and is available for Flutter
rendering. |
void |
stopRenderingToSurface()
Notifies Flutter that a
surface previously registered with startRenderingToSurface(Surface) has been destroyed and needs to be released and cleaned up
on the Flutter side. |
void |
surfaceChanged(int width,
int height)
Notifies Flutter that a
surface previously registered with startRenderingToSurface(Surface) has changed size to the given width and height. |
void |
swapSurface(Surface surface)
Swaps the
Surface used to render the current frame. |
public FlutterRenderer(@NonNull
FlutterJNI flutterJNI)
public boolean isDisplayingFlutterUi()
FlutterRenderer is painting pixels to an Android View
hierarchy, false otherwise.public void addIsDisplayingFlutterUiListener(@NonNull
FlutterUiDisplayListener listener)
FlutterRenderer starts and stops painting
pixels to an Android View hierarchy.public void removeIsDisplayingFlutterUiListener(@NonNull
FlutterUiDisplayListener listener)
addIsDisplayingFlutterUiListener(FlutterUiDisplayListener).public TextureRegistry.SurfaceTextureEntry createSurfaceTexture()
SurfaceTexture that is also made available to Flutter code.createSurfaceTexture in interface TextureRegistrypublic void startRenderingToSurface(@NonNull
Surface surface)
surface was created and is available for Flutter
rendering.
See SurfaceHolder.Callback and TextureView.SurfaceTextureListener
public void swapSurface(@NonNull
Surface surface)
Surface used to render the current frame.
In hybrid composition, the root surfaces changes from SurfaceHolder.getSurface() to ImageReader.getSurface() when
a platform view is in the current frame.
public void surfaceChanged(int width,
int height)
surface previously registered with startRenderingToSurface(Surface) has changed size to the given width and height.
See SurfaceHolder.Callback and TextureView.SurfaceTextureListener
public void stopRenderingToSurface()
surface previously registered with startRenderingToSurface(Surface) has been destroyed and needs to be released and cleaned up
on the Flutter side.
See SurfaceHolder.Callback and TextureView.SurfaceTextureListener
public void setViewportMetrics(@NonNull
FlutterRenderer.ViewportMetrics viewportMetrics)
If the width, height, or devicePixelRatio are less than or equal to 0, this update is ignored.
viewportMetrics - The metrics to send to the Dart application.public Bitmap getBitmap()
public void dispatchPointerDataPacket(@NonNull
ByteBuffer buffer,
int position)
public boolean isSoftwareRenderingEnabled()
public void setAccessibilityFeatures(int flags)
public void setSemanticsEnabled(boolean enabled)
public void dispatchSemanticsAction(int id,
int action,
@Nullable
ByteBuffer args,
int argsPosition)