Bitmap

Constructors

this
this()

Create empty bitmap.

this
this(uint width, uint height, BitmapFormat format)

Create bitmap with certain dimensions and pixel format.

this
this(ULBitmap ptr)

Destructor

~this
~this()

Destroy a bitmap. Remarks: You should only destroy Bitmaps you have explicitly created via one of the creation functions above.

Members

Functions

bpp
uint bpp()

Get the bytes per pixel.

erase
void erase()

Reset bitmap pixels to 0.

format
BitmapFormat format()

Get the pixel format.

height
uint height()

Get the height in pixels.

isEmpty
bool isEmpty()

Whether or not this bitmap is empty.

lockPixels
ubyte[] lockPixels()

Lock pixels for reading/writing.

ownsPixels
bool ownsPixels()

Whether or not this bitmap owns its own pixel buffer.

rawPixels
ubyte[] rawPixels()

Get raw pixel buffer.

rowBytes
uint rowBytes()

Get the number of bytes per row.

size
size_t size()

Get the size in bytes of the underlying pixel buffer.

swapRedBlueChannels
void swapRedBlueChannels()

Converts a BGRA bitmap to RGBA bitmap and vice-versa by swapping the red and blue channels.

unlockPixels
void unlockPixels()

Unlock pixels after locking.

width
uint width()

Get the width in pixels.

writePng
bool writePng(string path)

Write bitmap to a PNG on disk.

Static functions

fromCopy
Bitmap fromCopy(Bitmap existingBitmap)

Create bitmap from copy.

fromPixels
Bitmap fromPixels(uint width, uint height, BitmapFormat format, uint row_bytes, ubyte[] pixels, bool should_copy)

Create bitmap from existing pixel buffer.

Variables

ptr
ULBitmap ptr;

See Also

Meta