makeFromBackendRenderTarget

fun makeFromBackendRenderTarget(context: DirectContext, rt: BackendRenderTarget, origin: SurfaceOrigin, colorFormat: SurfaceColorFormat, colorSpace: ColorSpace?, surfaceProps: SurfaceProps? = null): Surface?

Wraps a GPU-backed buffer into Surface.

Caller must ensure backendRenderTarget is valid for the lifetime of returned Surface.

Surface is returned if all parameters are valid. backendRenderTarget is valid if its pixel configuration agrees with colorSpace and context; for instance, if backendRenderTarget has an sRGB configuration, then context must support sRGB, and colorSpace must be present. Further, backendRenderTarget width and height must not exceed context capabilities, and the context must be able to support back-end render targets.

Return

Surface if all parameters are valid; otherwise, null

Parameters

context

GPU context

rt

texture residing on GPU

origin

surfaceOrigin pins either the top-left or the bottom-left corner to the origin.

colorFormat

color format

colorSpace

range of colors; may be null

See also