KiteBitmap

class KiteBitmap(val width: Int, val height: Int, val argb: IntArray)

A decoded raster image: width × height pixels, packed as non-premultiplied ARGB_8888 in a row-major argb array (argb[y * width + x], alpha in the top byte). One layout for every source format: decoders normalise grayscale, palette, BGR and 16-bit inputs into this on the way out, so consumers and the Compose interop never branch on the source format.

argb is exposed directly (not copied) so a full-screen photo doesn't pay a second multi-megabyte allocation on the way to ImageBitmap. Treat it as read-only; mutate it only if you own the instance.

Constructors

Link copied to clipboard
constructor(width: Int, height: Int, argb: IntArray)

Properties

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

Functions

Link copied to clipboard
fun KiteBitmap.cropped(x: Int, y: Int, width: Int, height: Int): KiteBitmap

Copy the width×height region whose top-left corner is (x, y).

Link copied to clipboard

Mirror left-to-right.

Link copied to clipboard

Mirror top-to-bottom.

Link copied to clipboard
operator fun get(x: Int, y: Int): Int

The packed ARGB pixel at (x, y).

Link copied to clipboard

True if any pixel has alpha < 255. O(n) scan, not cached.

Link copied to clipboard

Apply an EXIF orientation so the result is oriented the way the camera meant it to be seen. Orientation.Normal returns the same instance.

Link copied to clipboard

Rotate a half turn. Dimensions are unchanged.

Link copied to clipboard

Rotate a quarter turn counter-clockwise. Width and height swap.

Link copied to clipboard

Rotate a quarter turn clockwise. Width and height swap.

Link copied to clipboard
fun KiteBitmap.scaled(maxWidth: Int, maxHeight: Int): KiteBitmap

Downscale to fit inside maxWidth×maxHeight, preserving aspect ratio, using box (area-average) filtering: each destination pixel averages every source pixel that maps into its bin, so thumbnails don't shimmer the way nearest-neighbor ones do.

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard

Mirror across the main diagonal: dst(x, y) = src(y, x). Axes swap.

Link copied to clipboard

Mirror across the anti-diagonal. Axes swap.