Bitmap

Implements a bitmap with variable bit depth. Use the aliases to initialize them.

Note on 16 bit bitmaps: 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 on 4 bit bitmaps: It's width needs to be an even number (for rendering simplicity), otherwise it'll cause an exception.

Note on 1 bit bitmaps: Uses size_t based paddings for more than one bit testing at the time in the future, through the use of logic functions.

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 w, int h)

Creates an empty bitmap.

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

Creates a bitmap from an array.

this
this(int w, int h)

Creates an empty bitmap.

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

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()

Clears the Bitmap

clear
void clear()
Undocumented in source. Be warned that the author may not have intended to support it.
generateStandardCollisionModel
Bitmap1Bit generateStandardCollisionModel(T transparency)

Generates a standard collision model by checking against a transparency value (default vaule is T.init).

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
T 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.

testChunkCollision
bool testChunkCollision(int line, int chOffset, Bitmap1Bit other, int otherLine, int offset)

Tests a single chunk of pixels between two 1 bit bitmaps for collision, using a single chunk (size_t) of pixels.

testChunkCollisionB
bool testChunkCollisionB(int line, int chOffset, Bitmap1Bit other, int otherLine, int offset)

Tests a single chunk of pixels between two 1 bit bitmaps for collision, using a single chunk (size_t) of pixels, if other is wider than what size_t allows.

testCollision
bool testCollision(int line, int lineAm, Bitmap1Bit other, int otherLine, int offset, int overlapAm)

Tests two collision models against each other.

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

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

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

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

wordLengthByString
string wordLengthByString()
Undocumented in source. Be warned that the author may not have intended to support it.
writePixel
T writePixel(int x, int y, T color)

Writes the pixel at the given position.

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

Writes the pixel at the given position.

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

Writes the pixel at the given position.

Static variables

BITAM
enum BITAM;
Undocumented in source.
BITAM
enum BITAM;
Undocumented in source.
SHAM
enum SHAM;
Undocumented in source.
SHAM
enum SHAM;
Undocumented in source.
SHFLAG
enum SHFLAG;
Undocumented in source.
SHFLAG
enum SHFLAG;
Undocumented in source.

Variables

pitch
size_t pitch;

Total length of a line in bits

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

Image data.

Inherited Members

From ABitmap

width
int width()

Returns the width of the bitmap.

height
int height()

Returns the height of the bitmap.

getPalettePtr
deprecated Color* getPalettePtr()

Returns the palette pointer. DEPRECATED!

setPalettePtr
deprecated 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