Package io.flutter.embedding.engine.renderer

## Interface RenderSurface

- All Known Implementing Classes:
    `FlutterImageView`, `FlutterSurfaceView`, `FlutterTextureView`

      public interface RenderSurface

  Owns a `Surface` that `FlutterRenderer` would like to paint.

  `RenderSurface` is responsible for providing a `Surface` to a given `FlutterRenderer` when requested, and then notify that `FlutterRenderer` when the `Surface` changes, or is destroyed.

  The behavior of providing a `Surface` is delegated to this interface because the timing of a `Surface`'s availability is determined by Android. Therefore, an accessor method would not fulfill the requirements. Therefore, a `RenderSurface` is given a `FlutterRenderer`, which the `RenderSurface` is expected to notify as a `Surface` becomes available, changes, or is destroyed.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `attachToRenderer​(FlutterRenderer renderer)` | Instructs this `RenderSurface` to give its `Surface` to the given `FlutterRenderer` so that Flutter can paint pixels on it.
    `void` | `detachFromRenderer()` | Instructs this `RenderSurface` to stop forwarding `Surface` notifications to the `FlutterRenderer` that was previously connected with `attachToRenderer(FlutterRenderer)`.
    `FlutterRenderer` | `getAttachedRenderer()` | Returns the `FlutterRenderer` that is attached to this `RenderSurface`, or null if no `FlutterRenderer` is currently attached.
    `void` | `pause()` | Instructs this `RenderSurface` to stop forwarding `Surface` notifications to the `FlutterRenderer` that was previously connected with `attachToRenderer(FlutterRenderer)`.

- - ### Method Detail

    - #### getAttachedRenderer

          @Nullable
          FlutterRenderer getAttachedRenderer()

      Returns the `FlutterRenderer` that is attached to this `RenderSurface`, or null if no `FlutterRenderer` is currently attached.

    - #### attachToRenderer

          void attachToRenderer​(@NonNull
                                FlutterRenderer renderer)

      Instructs this `RenderSurface` to give its `Surface` to the given `FlutterRenderer` so that Flutter can paint pixels on it.

      After this call, `RenderSurface` is expected to invoke the following methods on `FlutterRenderer` at the appropriate times:

      1. `FlutterRenderer.startRenderingToSurface(Surface)`
      2. `FlutterRenderer.surfaceChanged(int, int)`}
      3. `FlutterRenderer.stopRenderingToSurface()`

    - #### detachFromRenderer

          void detachFromRenderer()

      Instructs this `RenderSurface` to stop forwarding `Surface` notifications to the `FlutterRenderer` that was previously connected with `attachToRenderer(FlutterRenderer)`.

      This `RenderSurface` should also clean up any references related to the previously connected `FlutterRenderer`.

    - #### pause

          void pause()

      Instructs this `RenderSurface` to stop forwarding `Surface` notifications to the `FlutterRenderer` that was previously connected with `attachToRenderer(FlutterRenderer)`.