Logo

DOME

The comfortable framework for making games in Wren

Download the latest version here!

View the Project on GitHub domeengine/dome

< Back

Bitmap

This set of APIs allows you to load and manage graphics from supported file formats. (See the graphics module for more information.)

Acquisition

BITMAP_API_v0* bitmap = (BITMAP_API_v0*)DOME_getAPI(API_BITMAP, BITMAP_API_VERSION);

Struct

DOME_Bitmap

The DOME_Bitmap type contains the following fields:

Field Type Purpose
width int32_t Width of the bitmap in pixels.
height int32_t Height of the bitmap in pixels.
pixels DOME_Color* Pointer to the first pixel of the bitmap.

Methods

method: fromFile

DOME_Bitmap* fromFile(DOME_Context ctx, const char* path)

Loads an image file from path on disk (relative to the application entry point) and returns a DOME_Bitmap. You are responsible for freeing it using the free function in this API.

If there is a problem with the file, this method will return NULL. You can find out why using core->getLastError(DOME_Context ctx);

method: fromFileInMemory

DOME_Bitmap* fromFileInMemory(DOME_Context ctx, void* buffer, size_t length)

Loads an image file stored in memory at buffer, with a size of length, and returns a DOME_Bitmap. You are responsible for freeing it using the free function in this API.

If there is a problem with the file, this method will return NULL. You can find out why using core->getLastError(DOME_Context ctx);

method: free

void free(DOME_Bitmap* bitmap)

Safely frees the bitmap. Make sure you don’t attempt to use the bitmap pointer after this function returns.

method: pget

DOME_Color pget(DOME_Bitmap* bitmap, uint32_t x, uint32_t y)

Returns the color of the pixel located at (x, y) in bitmap.

method: pset

void pset(DOME_Bitmap* bitmap, uint32_t x, uint32_t y, DOME_Color color)

Sets the color of the pixel located at (x, y) in bitmap to color.