DiffusionImage

class DiffusionImage(val width: Int, val height: Int, val channels: Int, val pixels: ByteArray)(source)

A generated image: packed 8-bit RGB (channels = 3), row-major, no row padding, width * height * channels bytes. The pixels were copied out of the native buffer, which is already freed; this object owns plain heap memory.

Constructors

Link copied to clipboard
constructor(width: Int, height: Int, channels: Int, pixels: ByteArray)

Properties

Link copied to clipboard

bytes per pixel (3 for the RGB images DiffusionEngine produces).

Link copied to clipboard
val height: Int

image height in pixels.

Link copied to clipboard

width * height * channels bytes, row-major, top row first.

Link copied to clipboard
val width: Int

image width in pixels.

Functions

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean

Images are equal when their dimensions, channel count and pixel bytes are equal.

Link copied to clipboard
open override fun hashCode(): Int

Hash of the dimensions, channel count and pixel bytes, consistent with equals.

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

Byte offset of pixel (x, y) in pixels.

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

The dimensions and channel count, without the pixel bytes.