← back to roto on ba3a.dev

Argb

object Argb

Packing and unpacking of a pixel colour stored as one Int in 0xAARRGGBB order, 8 bits per channel, sRGB, straight (non-premultiplied) alpha. This is the layout of java.awt.image.BufferedImage.TYPE_INT_ARGB, so a Raster moves to and from AWT without conversion.

Properties

Link copied to clipboard
const val OPAQUE_ALPHA: Int = 255

The alpha channel of a fully opaque pixel.

Link copied to clipboard
const val TRANSPARENT: Int = 0

Fully transparent black, the pixel value 0.

Functions

Link copied to clipboard
fun alpha(argb: Int): Int

The alpha channel of argb, 0..255.

Link copied to clipboard
fun blue(argb: Int): Int

The blue channel of argb, 0..255.

Link copied to clipboard
fun format(argb: Int): String

#AARRGGBB, for test failures and log lines.

Link copied to clipboard
fun green(argb: Int): Int

The green channel of argb, 0..255.

Link copied to clipboard
fun of(red: Int, green: Int, blue: Int, alpha: Int = OPAQUE_ALPHA): Int

Packs four channels, each 0..255, into one pixel.

Link copied to clipboard
fun red(argb: Int): Int

The red channel of argb, 0..255.