← back to roto on ba3a.dev

Raster

class Raster

A rectangular grid of Argb pixels, row-major from the top-left corner.

The one image type every pipeline stage reads and writes. Equality is by size and pixel content, so two stages that produce the same image produce equal rasters — the determinism tests rely on it. Mutable through set so brush fixes and per-pixel stages can fill a raster in place; take a copy before handing one raster to code that must not see later writes.

Constructors

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

A fully transparent raster.

Types

Link copied to clipboard
object Companion

Creation of whole grids.

Properties

Link copied to clipboard
val height: Int

the height in pixels

Link copied to clipboard
val width: Int

the width in pixels

Functions

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

Whether (x, y) lies inside the grid.

Link copied to clipboard
fun copy(): Raster

A copy; later writes to either one do not show in the other.

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

Equal when the size and every pixel are.

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

The pixel at (x, y) as an Argb value.

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

Consistent with equals.

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

Sets the pixel at (x, y) to argb.

Link copied to clipboard

The pixels as a fresh row-major array; writing to it does not change this raster.

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

The size, for messages and tests.