d2d.rendering.bitmap



class Bitmap: d2d.core.iverifiable.IVerifiable, d2d.core.idisposable.IDisposable;
Thin wrap around SDL_Surface including loading [png, webp, tiff, bmp] using SDL_Image.

@property SDL_Surface* surface();
Handle to the
SDL_Surface*
.

@property bool valid();
Checks if the handle is not null.

@property int width();
Width of this bitmap. Returns 0 if invalid.

@property int height();
Height of this bitmap. Returns 0 if invalid.

this(int width, int height, int depth = 24, int redChannel = 0, int greenChannel = 0, int blueChannel = 0, int alphaChannel = 0);
Creates a new width x height bitmap with a specified bit depth.

this(void[] pixels, int width, int height, int depth = 24, int redChannel = 0, int greenChannel = 0, int blueChannel = 0, int alphaChannel = 0);
Creates a new width x height bitmap with a specified bit depth containing pixel data.

static Bitmap fromSurface(SDL_Surface* surface);
Creates a bitmap from a
SDL_Surface*
.

static Bitmap load(string file);
Loads a png/webp/tiff/bmp from a file on the filesystem.

void dispose();
Deallocates the memory and invalidates
this
.

void save(string file);
Saves the bitmap to a .bmp file.

Bitmap convert(const SDL_PixelFormat* format);
Copies the bitmap and creates a new bitmap in the given pixelformat.

uint mapRGB(Color color);
Gets the rgb hex from the color based on the bitmap format.

uint mapRGBA(ubyte r, ubyte g, ubyte b, ubyte a);
Gets the rgb hex from the color based on the bitmap format.

void fill(Color color);
Fills the entire bitmap with one color.

void fill(int x, int y, int width, int height, Color color);
Fills a rectangle with one color.

Color getPixel(int x, int y);
Gets the RGB color at position x, y. (0, 0) is top left.

ubyte[] getPixelRGBA(int x, int y);
Gets the RGBA color at position x, y as R, G, B, A ubyte array. (0, 0) is top left.

void setPixel(int x, int y, Color color);
Sets the RGB color at position x, y. (0, 0) is top left.

void setPixelRGBA(int x, int y, ubyte r, ubyte g, ubyte b, ubyte a);
Sets the RGBA color at position x, y. (0, 0) is top left.


Page generated by Ddoc.