Companion

object Companion

Functions

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

Wraps a GPU-backed buffer into Surface.

Link copied to clipboard
fun makeFromMTKView(context: DirectContext, mtkViewPtr: NativePointer, origin: SurfaceOrigin, sampleCount: Int, colorFormat: SurfaceColorFormat, colorSpace: ColorSpace?, surfaceProps: SurfaceProps?): Surface
Link copied to clipboard
fun makeNull(width: Int, height: Int): Surface

Returns Surface without backing pixels. Drawing to Canvas returned from Surface has no effect. Calling makeImageSnapshot() on returned Surface returns null.

Link copied to clipboard
fun makeRaster(imageInfo: ImageInfo): Surface

Allocates raster Surface. Canvas returned by Surface draws directly into pixels. Allocates and zeroes pixel memory. Pixel memory size is imageInfo.height() times imageInfo.minRowBytes(). Pixel memory is deleted when Surface is deleted.

fun makeRaster(imageInfo: ImageInfo, rowBytes: Int): Surface
fun makeRaster(imageInfo: ImageInfo, rowBytes: Int, surfaceProps: SurfaceProps?): Surface

Allocates raster Surface. Canvas returned by Surface draws directly into pixels. Allocates and zeroes pixel memory. Pixel memory size is imageInfo.height() times rowBytes, or times imageInfo.minRowBytes() if rowBytes is zero. Pixel memory is deleted when Surface is deleted.

Link copied to clipboard
fun makeRasterDirect(pixmap: Pixmap, surfaceProps: SurfaceProps?): Surface

fun makeRasterDirect(imageInfo: ImageInfo, pixelsPtr: NativePointer, rowBytes: Int): Surface
fun makeRasterDirect(imageInfo: ImageInfo, pixelsPtr: NativePointer, rowBytes: Int, surfaceProps: SurfaceProps?): Surface

Allocates raster Surface. Canvas returned by Surface draws directly into pixels.

Link copied to clipboard
fun makeRasterN32Premul(width: Int, height: Int): Surface

Allocates raster Surface.

Link copied to clipboard
fun makeRenderTarget(context: DirectContext, budgeted: Boolean, imageInfo: ImageInfo): Surface
fun makeRenderTarget(context: DirectContext, budgeted: Boolean, imageInfo: ImageInfo, sampleCount: Int, surfaceProps: SurfaceProps?): Surface
fun makeRenderTarget(context: DirectContext, budgeted: Boolean, imageInfo: ImageInfo, sampleCount: Int, origin: SurfaceOrigin, surfaceProps: SurfaceProps?): Surface
fun makeRenderTarget(context: DirectContext, budgeted: Boolean, imageInfo: ImageInfo, sampleCount: Int, origin: SurfaceOrigin, surfaceProps: SurfaceProps?, shouldCreateWithMips: Boolean): Surface

Returns Surface on GPU indicated by context. Allocates memory for pixels, based on the width, height, and ColorType in ImageInfo. describes the pixel format in ColorType, and transparency in AlphaType, and color matching in ColorSpace.