Class FlutterImageView

    • Constructor Detail

      • FlutterImageView

        public FlutterImageView​(@NonNull
                                Context context)
      • FlutterImageView

        public FlutterImageView​(@NonNull
                                Context context,
                                @NonNull
                                AttributeSet attrs)
    • Method Detail

      • getSurface

        @NonNull
        public Surface getSurface()
      • getAttachedRenderer

        @Nullable
        public FlutterRenderer getAttachedRenderer()
        Description copied from interface: RenderSurface
        Returns the FlutterRenderer that is attached to this RenderSurface, or null if no FlutterRenderer is currently attached.
        Specified by:
        getAttachedRenderer in interface RenderSurface
      • attachToRenderer

        public void attachToRenderer​(@NonNull
                                     FlutterRenderer flutterRenderer)
        Invoked by the owner of this FlutterImageView when it wants to begin rendering a Flutter UI to this FlutterImageView.
        Specified by:
        attachToRenderer in interface RenderSurface
      • detachFromRenderer

        public void detachFromRenderer()
        Invoked by the owner of this FlutterImageView when it no longer wants to render a Flutter UI to this FlutterImageView.
        Specified by:
        detachFromRenderer in interface RenderSurface
      • acquireLatestImage

        public boolean acquireLatestImage()
        Acquires the next image to be drawn to the Canvas. Returns true if there's an image available in the queue.
      • resizeIfNeeded

        public void resizeIfNeeded​(int width,
                                   int height)
        Creates a new image reader with the provided size.
      • closeImageReader

        public void closeImageReader()
        Closes the image reader associated with the current FlutterImageView.

        Once the image reader is closed, calling acquireLatestImage will result in an IllegalStateException.

      • onDraw

        protected void onDraw​(Canvas canvas)
        Overrides:
        onDraw in class View
      • onSizeChanged

        protected void onSizeChanged​(int width,
                                     int height,
                                     int oldWidth,
                                     int oldHeight)
        Overrides:
        onSizeChanged in class View