Bitmap

Implements a bitmap with variable bit depth. Use the aliases to initialize them. Note for 16Bit bitmap: It's using the master palette, It's not implementing any 16 bit RGB or RGBA color space directly. Can implement such colorspaces via proper lookup tables. Note for 4Bit bitmap: It's width needs to be an even number (for rendering simplicity), otherwise it'll cause an exception.

class Bitmap : ABitmap (
string S
T
) {}

Constructors

this
this(int w, int h)

Unified CTOR to create empty bitmap.

this
this(T[] src, int w, int h)

Unified CTOR tor create bitmap from preexisting data.

this
this(int x, int y, Color* palettePtr)

Creates an empty bitmap. DEPRECATED!

this
this(ubyte[] p, int x, int y, Color* palettePtr)

Creates a bitmap from an array. DEPRECATED!

this
this(int x, int y)

Creates an empty bitmap.

this
this(ubyte[] p, int x, int y)

Creates a bitmap from an array.

this
this(int w, int h)

CTOR for 1 bit bitmaps with no preexisting source.

this
this(ubyte[] src, int w, int h)

CTOR to convert 8bit aligned bitmaps to 32/64bit ones.

this
this(size_t[] src, int w, int h)

CTOR for 1 bit bitmaps with a preexisting source. Alignment and padding is for size_t (32 and 64 bit, on their respected systems)

Members

Functions

clear
void clear()
Undocumented in source. Be warned that the author may not have intended to support it.
clear
void clear()
Undocumented in source. Be warned that the author may not have intended to support it.
getBasicCollisionShape
Bitmap1bit getBasicCollisionShape()

Generates a basic collision shape using

getPtr
T* getPtr()
Undocumented in source. Be warned that the author may not have intended to support it.
offsetIndexes
void offsetIndexes(ushort offset, bool keepZerothIndex)

Offsets all indexes in the bitmap by a certain value. Keeps zeroth index (usually for transparency) if needed. Useful when converting bitmaps.

readPixel
T readPixel(int x, int y)

Returns the pixel at the given position.

readPixel
ubyte readPixel(int x, int y)

Returns the pixel at the given position.

readPixel
bool readPixel(int x, int y)

Returns the pixel at the given position.

resize
void resize(int x, int y)

Resizes the bitmap. NOTE: It's not for scaling.

resize
void resize(int x, int y)

Resizes the array behind the bitmap.

window
Bitmap!(S, T) window(int iX0, int iY0, int iX1, int iY1)

Returns a 2D slice (window) of the bitmap.

writePixel
void writePixel(int x, int y, T color)

Writes the pixel at the given position.

writePixel
void writePixel(int x, int y, ubyte color)

Writes the pixel at the given position.

writePixel
bool writePixel(int x, int y, bool val)

Writes the pixel at the given position.

Properties

wordLengthByString
string wordLengthByString [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

invertHoriz
bool invertHoriz;

Horizontal invertion for reading and writing

invertVert
bool invertVert;

Vertical invertion for reading anr writing

pitch
size_t pitch;

Total length of a line in bits

pixelAccess
BitArray pixelAccess;
Undocumented in source.
pixels
T[] pixels;
Undocumented in source.

Inherited Members

From ABitmap

width
int width()

Returns the width of the bitmap.

height
int height()

Returns the height of the bitmap.

getPalettePtr
Color* getPalettePtr()

Returns the palette pointer.

setPalettePtr
void setPalettePtr(Color* p)

Sets the palette pointer. Make sure that you set it to a valid memory location. DEPRECATED!

wordLengthByString
string wordLengthByString()

Returns the wordlength of the type

clear
void clear()

Clears the whole bitmap to a transparent color.

Meta