IndexedImage

An image that consists of indexes into a color palette. Use getAsTrueColorImage if you don't care about palettes

Constructors

this
this(int w, int h)

.

Members

Functions

addColor
ubyte addColor(Color c)

Adds an entry to the palette, returning its inded

convertToTrueColor
TrueColorImage convertToTrueColor()

Creates a new TrueColorImage based on this data

getAsTrueColorImage
TrueColorImage getAsTrueColorImage()

returns a new image

getOrAddColor
ubyte getOrAddColor(Color c)

Gets an exact match, if possible, adds if not. See also: the findNearestColor free function.

height
int height()

.

numColors
int numColors()

Number of colors currently in the palette (note: palette entries are not necessarily used in the image data)

width
int width()

.

Variables

data
ubyte[] data;

the data as indexes into the palette. Stored left to right, top to bottom, no padding.

palette
Color[] palette;

.

Inherited Members

From MemoryImage

getAsTrueColorImage
TrueColorImage getAsTrueColorImage()

gets it as a TrueColorImage. May return this or may do a conversion and return a new image

width
int width()

Image width, in pixels

height
int height()

Image height, in pixels

getPixel
Color getPixel(int x, int y)

Get image pixel. Slow, but returns valid RGBA color (completely transparent for off-image pixels).

setPixel
void setPixel(int x, int y, in Color clr)

Set image pixel.

fromImage
MemoryImage fromImage(T filename)

Load image from file. This will import arsd.image to do the actual work, and cost nothing if you don't use it.

fromImageFile
alias fromImageFile = fromImage

Convenient alias for fromImage

Meta