Image

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
open val bytesPerPixel: Int

Returns number of bytes per pixel required by ColorType. Returns zero if colorType is ColorType.UNKNOWN.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open val height: Int

Returns pixel row count.

Link copied to clipboard
open override val imageInfo: ImageInfo

Returns a ImageInfo describing the width, height, color type, alpha type, and color space of the Image.

Link copied to clipboard
expect open val isClosed: Boolean

Check if underlying resource is closed.

Link copied to clipboard
open val isEmpty: Boolean

Returns true if either getWidth() or getHeight() are zero.

Link copied to clipboard
open val isOpaque: Boolean

Returns true if ColorAlphaType is set to hint that all pixels are opaque; their alpha value is implicitly or explicitly 1.0. If true, and all pixels are not opaque, Skia may draw incorrectly.

Link copied to clipboard
expect val refCount: Int

Number of references on underlying native object.

Link copied to clipboard
open val shiftPerPixel: Int

Returns bit shift converting row bytes to row pixels. Returns zero for ColorType.UNKNOWN.

Link copied to clipboard
open val width: Int

Returns pixel count in each row. Should be equal or less than getRowBytes() / getImageInfo().getBytesPerPixel().

Functions

Link copied to clipboard
expect open fun close()

Free underlying native resource, peer is useless afterwards.

Link copied to clipboard
fun encodeToData(format: EncodedImageFormat = EncodedImageFormat.PNG, quality: Int = 100): Data?

Encodes Image pixels, returning result as Data. Returns existing encoded data if present; otherwise, Image is encoded with EncodedImageFormat.PNG.

Link copied to clipboard
fun makeShader(localMatrix: Matrix33?): Shader
fun makeShader(tmx: FilterTileMode, tmy: FilterTileMode, localMatrix: Matrix33?): Shader
fun makeShader(tmx: FilterTileMode = FilterTileMode.CLAMP, tmy: FilterTileMode = FilterTileMode.CLAMP, sampling: SamplingMode = SamplingMode.DEFAULT, localMatrix: Matrix33? = null): Shader
Link copied to clipboard

If pixel address is available, return Pixmap. If pixel address is not available, return null.

fun peekPixels(pixmap: Pixmap?): Boolean
Link copied to clipboard
fun readPixels(context: DirectContext, dst: Bitmap): Boolean
fun readPixels(dst: Bitmap, srcX: Int, srcY: Int): Boolean
fun readPixels(context: DirectContext, dst: Bitmap, srcX: Int, srcY: Int): Boolean
fun readPixels(dst: Pixmap, srcX: Int, srcY: Int, cache: Boolean): Boolean

fun readPixels(context: DirectContext?, dst: Bitmap, srcX: Int, srcY: Int, cache: Boolean): Boolean

Copies Rect of pixels from Image to Bitmap. Copy starts at offset (srcX, srcY), and does not exceed Image (getWidth(), getHeight()).

Link copied to clipboard
fun scalePixels(dst: Pixmap, samplingMode: SamplingMode, cache: Boolean): Boolean
Link copied to clipboard
expect open override fun toString(): String