Bitmap

abstract class Bitmap(val width: Int, val height: Int, val bpp: Int, premultiplied: Boolean, val backingArray: Any?) : SizeableInt, Extra

Inheritors

Constructors

Link copied to clipboard
constructor(width: Int, height: Int, bpp: Int, premultiplied: Boolean, backingArray: Any?)

Properties

Link copied to clipboard
val area: Int
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val bpp: Int
Link copied to clipboard

Version of the content. lock+unlock mutates this version to allow for example to re-upload the bitmap to the GPU when synchronizing bitmaps into textures

Link copied to clipboard
Link copied to clipboard
open override var extra: ExtraType
Link copied to clipboard
val height: Int
Link copied to clipboard
Link copied to clipboard

Specifies whether mipmaps should be created for this Bitmap

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override val size: SizeInt
Link copied to clipboard
val stride: Int
Link copied to clipboard
val width: Int

Functions

Link copied to clipboard
Link copied to clipboard
fun Bitmap.asNinePatchSimple(left: Int, top: Int, right: Int, bottom: Int): NinePatchBmpSlice
Link copied to clipboard
Link copied to clipboard
fun clampWidth(x: Int): Int
Link copied to clipboard
fun clampX(x: Int): Int
Link copied to clipboard
fun clampY(y: Int): Int
Link copied to clipboard
Link copied to clipboard
open fun clone(): Bitmap
Link copied to clipboard
open fun contentEquals(other: Bitmap): Boolean
Link copied to clipboard
open fun contentHashCode(): Int
Link copied to clipboard
fun copy(srcX: Int, srcY: Int, dst: Bitmap, dstX: Int, dstY: Int, width: Int, height: Int)
Link copied to clipboard
open fun copyUnchecked(srcX: Int, srcY: Int, dst: Bitmap, dstX: Int, dstY: Int, width: Int, height: Int)
Link copied to clipboard
open fun createWithThisFormat(width: Int, height: Int): Bitmap
Link copied to clipboard
fun Bitmap.distanceMap(out: DistanceBitmap = DistanceBitmap(width, height), thresold: Double = 0.5): DistanceBitmap
Link copied to clipboard
suspend fun Bitmap.encode(formats: ImageFormat = RegisteredImageFormats, props: ImageEncodingProps = ImageEncodingProps()): ByteArray
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun flipX(): Bitmap

Inplace flips

Link copied to clipboard
open fun flipY(): Bitmap
Link copied to clipboard
inline fun forEach(sx: Int = 0, sy: Int = 0, width: Int = this.width - sx, height: Int = this.height - sy, callback: (n: Int, x: Int, y: Int) -> Unit)
Link copied to clipboard
open fun getContext2d(antialiasing: Boolean = true): Context2d
Link copied to clipboard
open fun getInt(x: Int, y: Int): Int

UNSAFE: Gets the color in the x, y coordinates in the internal format of this Bitmap

Link copied to clipboard
open fun getRgba(x: Int, y: Int): RGBA

Gets the color v in the x, y coordinates in RGBA non-premultiplied

Link copied to clipboard
fun getRgbaClamped(x: Int, y: Int): RGBA
Link copied to clipboard
Link copied to clipboard

Gets the color v in the x, y coordinates in RGBAPremultiplied

Link copied to clipboard
open fun getRgbaRaw(x: Int, y: Int): RGBA

UNSAFE: Gets the color v in the x, y coordinates in the internal format of this Bitmap (either premultiplied or not)

Link copied to clipboard
fun getRgbaSampled(x: Float, y: Float, count: Int, row: RgbaArray)
Link copied to clipboard
fun inBounds(x: Int, y: Int): Boolean
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun index(x: Int, y: Int): Int
Link copied to clipboard
fun inside(x: Int, y: Int): Boolean
Link copied to clipboard
open fun lock()
inline fun lock(rect: RectangleInt = this.rect, doLock: Boolean = true, block: () -> Unit): Int
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun oriented(orientation: ImageOrientation): Bitmap
Link copied to clipboard
fun Bitmap.putSliceWithBorder(x: Int, y: Int, bmp: BmpSlice, border: Int = 1)
Link copied to clipboard
open fun readPixelsUnsafe(x: Int, y: Int, width: Int, height: Int, out: IntArray, offset: Int = 0)
Link copied to clipboard
fun Bitmap.readPixelsUnsafe(x: Int, y: Int, width: Int, height: Int): IntArray
Link copied to clipboard
fun Bitmap.resized(out: Bitmap, scale: ScaleMode, anchor: Anchor): Bitmap
fun Bitmap.resized(width: Int, height: Int, scale: ScaleMode, anchor: Anchor, native: Boolean = true): Bitmap
Link copied to clipboard
fun Bitmap.resizedUpTo(width: Int, height: Int, native: Boolean = true): Bitmap
Link copied to clipboard
fun rotated(rotation: ImageRotation): Bitmap
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun Bitmap.sdf(out: DistanceBitmap = DistanceBitmap(width, height), thresold: Double = 0.5): DistanceBitmap
Link copied to clipboard
open fun setInt(x: Int, y: Int, color: Int)

UNSAFE: Sets the color color in the x, y coordinates in the internal format of this Bitmap

Link copied to clipboard
open fun setRgba(x: Int, y: Int, v: RGBA)

Sets the color v in the x, y coordinates in RGBA non-premultiplied

open fun setRgba(x: Int, y: Int, v: RGBAPremultiplied)

Sets the color v in the x, y coordinates in RGBAPremultiplied

Link copied to clipboard
open fun setRgbaRaw(x: Int, y: Int, v: RGBA)

UNSAFE: Sets the color v in the x, y coordinates in the internal format of this Bitmap (either premultiplied or not)

Link copied to clipboard
suspend fun Bitmap.showImageAndWait(kind: Int = 0)
Link copied to clipboard
open fun swapColumns(x0: Int, x1: Int)
Link copied to clipboard
open fun swapRows(y0: Int, y1: Int)
Link copied to clipboard
Link copied to clipboard
fun Bitmap.toAwt(out: BufferedImage = BufferedImage( width.coerceAtLeast(1), height.coerceAtLeast(1), if (this.premultiplied) BufferedImage.TYPE_INT_ARGB_PRE else BufferedImage.TYPE_INT_ARGB )): BufferedImage
Link copied to clipboard
open fun toBMP32(): Bitmap32
Link copied to clipboard
Link copied to clipboard
fun Bitmap.toFloatBMP32(out: FloatBitmap32 = FloatBitmap32(width, height, premultiplied = premultiplied)): FloatBitmap32
Link copied to clipboard
Link copied to clipboard
fun Bitmap.toPaint(transform: Matrix = Matrix.IDENTITY, cycleX: CycleMethod = CycleMethod.NO_CYCLE, cycleY: CycleMethod = CycleMethod.NO_CYCLE, smooth: Boolean = true, units: GradientUnits = GradientUnits.OBJECT_BOUNDING_BOX): BitmapPaint
Link copied to clipboard
fun Bitmap.toUIImage(): UIImage
Link copied to clipboard
Link copied to clipboard
inline fun Bitmap.trace(): VectorPath
inline fun Bitmap.trace(func: (RGBA) -> Boolean): VectorPath
Link copied to clipboard
open fun transposed(): Bitmap

Creates a new bitmap with the rows and columns transposed

Link copied to clipboard
Link copied to clipboard
open fun unlock(rect: RectangleInt = this.rect): Int
Link copied to clipboard
open fun writePixelsUnsafe(x: Int, y: Int, width: Int, height: Int, out: IntArray, offset: Int = 0)
Link copied to clipboard
suspend fun Bitmap.writeTo(file: VfsFile, formats: ImageFormat = RegisteredImageFormats, props: ImageEncodingProps = ImageEncodingProps()): Long