<div class='type'>Interface</div>


<a id='references'></a>

<div class='sourceset sourceset-android'>Android</div>



```kotlin
interface SurfaceScope
```


`SurfaceScope` is a scoped environment provided by `AndroidExternalSurface` and
`AndroidEmbeddedExternalSurface` to handle `Surface` lifecycle events.


## Functions



<h2 id="onchanged-onchanged-width-height">onChanged</h2>

```kotlin
fun Surface.onChanged(onChanged: Surface.(width: Int, height: Int) -> Unit)
```


Invokes `onChanged` when the surface's geometry (width and height) changes. Always invoked on
the main thread.




<hr class="docs-overload-divider">


<h2 id="ondestroyed-ondestroyed">onDestroyed</h2>

```kotlin
fun Surface.onDestroyed(onDestroyed: Surface.() -> Unit)
```


Invokes `onDestroyed` when the surface is destroyed. All rendering into the surface should
stop immediately after `onDestroyed` is invoked. Always invoked on the main thread.