adoptTextureFrom

fun adoptTextureFrom(context: DirectContext, backendTexture: BackendTexture, origin: SurfaceOrigin, colorType: ColorType): Image

Creates GPU-backed SkImage from backendTexture associated with context.

Skia will assume ownership of the resource and will release it when no longer needed. A non-null Image is returned if format of backendTexture is recognized and supported. Recognized formats vary by GPU backend.

Return

created Image

Parameters

context

GPU context

backendTexture

texture residing on GPU

origin

origin of backendTexture

colorType

color type of the resulting Image

Throws

RuntimeException
  • if nullPtr is returned.