← back to roto on ba3a.dev

IndexedRaster

A rectangular grid of palette indices 0..255, row-major from the top-left corner.

The indexed counterpart of Raster: what the draft renderer produces and what an indexed .ase cel stores. It knows nothing about the palette its indices point into. Equality is by size and content, and it is mutable through set in the same way as Raster.

Constructors

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

A raster filled with index 0.

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

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 palette index at (x, y), 0..255.

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

Consistent with equals.

Link copied to clipboard
fun maxIndex(): Int

The largest index used anywhere in the raster.

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

Sets the palette index at (x, y) to index, 0..255.

Link copied to clipboard

The indices as a fresh row-major array of unsigned bytes; writing to it does not change this raster.

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

The size, for messages and tests.