Surface

class Surface : RefCnt

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Returns Canvas that draws into Surface.

Link copied to clipboard

Returns unique value identifying the content of Surface.

Link copied to clipboard
val height: Int

Returns pixel row count; may be zero or greater.

Link copied to clipboard

Returns an ImageInfo describing the surface.

Link copied to clipboard
expect open val isClosed: Boolean

Check if underlying resource is closed.

Link copied to clipboard

May return true if the caller is the only owner.

Link copied to clipboard

Returns the recording context being used by the Surface.

Link copied to clipboard
expect val refCount: Int

Number of references on underlying native object.

Link copied to clipboard
val width: Int

Returns pixel count in each row; may be zero or greater.

Functions

Link copied to clipboard
expect open fun close()

Free underlying native resource, peer is useless afterwards.

Link copied to clipboard
fun draw(canvas: Canvas?, x: Int, y: Int, paint: Paint?)
fun draw(canvas: Canvas?, x: Int, y: Int, samplingMode: SamplingMode, paint: Paint?)

Draws Surface contents to canvas, with its top-left corner at (x, y).

Link copied to clipboard
fun flush()
Link copied to clipboard
fun flushAndSubmit(syncCpu: Boolean)

Call to ensure all reads/writes of the surface have been issued to the underlying 3D API.

Link copied to clipboard

Returns Image capturing Surface contents.

Like the no-parameter version, this returns an image of the current surface contents.

Link copied to clipboard
fun makeSurface(imageInfo: ImageInfo): Surface?

Returns a compatible Surface, or null.

fun makeSurface(width: Int, height: Int): Surface?

Calls makeSurface(ImageInfo) with the same ImageInfo as this surface, but with the specified width and height.

Link copied to clipboard

Notifies that Surface contents will be changed by code outside of Skia.

Link copied to clipboard
fun peekPixels(pixmap: Pixmap): Boolean
Link copied to clipboard
fun readPixels(bitmap: Bitmap?, srcX: Int, srcY: Int): Boolean

Copies Rect of pixels from Surface into bitmap.

fun readPixels(pixmap: Pixmap?, srcX: Int, srcY: Int): Boolean
Link copied to clipboard
expect open override fun toString(): String
Link copied to clipboard
fun writePixels(bitmap: Bitmap?, x: Int, y: Int)

Copies Rect of pixels from the src Bitmap to the Surface.

fun writePixels(pixmap: Pixmap?, x: Int, y: Int)