KiteBitmap16

class KiteBitmap16(val width: Int, val height: Int, val channels: Int, val samples: ShortArray)(source)

A decoded image at 16 bits a sample, for the files whose low byte matters: depth maps, scientific and medical images, heavily graded photographs. KiteBitmap keeps 8 bits a channel and is what drawing wants; this keeps every bit a 16-bit PNG or TIFF stores, and ImageKodec.decode16 is where it comes from.

samples holds channels samples a pixel, row by row, interleaved (samples[(y * width + x) * channels + c]), each an unsigned 16-bit value in a Short: read one with toInt() and 0xFFFF, or through get. The channels are those the file stores once a palette is looked up: 1 gray, 2 gray and alpha, 3 RGB, 4 RGBA. Alpha is straight, as in KiteBitmap, so a gray depth map stays one sample a pixel rather than four.

samples is exposed directly, not copied. Treat it as read-only; mutate it only if you own the instance.

Throws

if the dimensions are not positive, channels is not 1 to 4, or samples does not hold exactly width × height × channels samples

Constructors

Link copied to clipboard
constructor(width: Int, height: Int, channels: Int, samples: ShortArray)

Properties

Link copied to clipboard
Link copied to clipboard

True for gray and alpha (2 channels) and RGBA (4).

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

Functions

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

Sample channel of the pixel at (x, y), 0 to 65535.

Link copied to clipboard
fun oriented(orientation: Orientation): KiteBitmap16

Apply an EXIF orientation, as KiteBitmap.oriented does. Orientation.Normal returns the same instance.

Link copied to clipboard

This image at 8 bits a channel, each sample cut to its high byte, which is what ImageKodec.decode returns for a 16-bit PNG or TIFF.

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