Image

All image classes should be derived from this base. Implements some basic functionality, such as reading and writing pixels, basic data storage, and basic information. Pixeldata should be stored decompressed, but indexing should be preserved on loading with the opinion of upconverting to truecolor.

abstract
class Image {
ubyte[2] pixelOrder4BitBE;
ubyte[2] pixelOrder4BitLE;
ubyte[2] pixelShift4BitBE;
ubyte[2] pixelShift4BitLE;
ubyte[4] pixelOrder2BitBE;
ubyte[4] pixelOrder2BitLE;
ubyte[4] pixelShift2BitBE;
ubyte[4] pixelShift2BitLE;
ubyte[8] pixelOrder1BitBE;
ubyte[8] pixelOrder1BitLE;
ubyte[8] pixelShift1BitBE;
ubyte[8] pixelShift1BitLE;
}

Members

Functions

getImageData
ubyte[] getImageData()

Returns the raw image data.

getPaletteData
ubyte[] getPaletteData()

Returns the raw palette data.

getPixelOrder
ubyte[] getPixelOrder()

Returns the pixel order for bitdepths less than 8. Almost excusively used for indexed bitmaps. Returns null if ordering not needed.

getPixelOrderBitshift
ubyte[] getPixelOrderBitshift()

Returns which pixel how much needs to be shifted right after a byteread.

readPalette
Pixel32Bit readPalette(ushort index)

Looks up the index on the palette, then returns the color value as a 32 bit value.

readPixel
Pixel32Bit readPixel(ushort x, ushort y)

Reads a single 32bit pixel. If the image is indexed, a color lookup will be done.

readPixelIndex
T readPixelIndex(ushort x, ushort y)

Reads an index, if the image isn't indexed throws an ImageFormatException.

writePixel
T writePixel(ushort x, ushort y, T pixel)

Writes a single pixel. ubyte: most indexed formats. ushort: all 16bit indexed formats. Any other pixel structs are used for direct color.

Variables

imageData
ubyte[] imageData;

Raw image data. Cast the data to whatever data you need at the moment.

mod
ubyte mod;

used for fast access of indexes

paletteData
ubyte[] paletteData;

Raw palette data. Null if image is not indexed.

shift
ubyte shift;

used for fast access of indexes

Meta