HEBitmap C Docs

⚙️ Initialization

void he_library_init(PlaydateAPI *pd);
Initialize the library.

⚙️ Macros

Macros are in the he_api.h header. You can edit them in the header, or add them as preprocessor macros.
#define HE_GFX_STACK_SIZE 1024
Set the graphics stack size (default value is 1024).

🎨 Graphics

void he_graphics_setClipRect(int x, int y, int width, int height);
Set the clip rect.
void he_graphics_clearClipRect(void);
Clear the clip rect.
HERect he_graphics_getClipRect(void);
Get the clip rect.
void he_graphics_pushContext(void);
Push the graphics context.
void he_graphics_popContext(void);
Pop the graphics context.

🖼️ Bitmap

HEBitmap* HEBitmap_load(const char *filename);
Loads a new HEBitmap from a Playdate image file (similar to playdate->graphics->loadBitmap).
HEBitmap* HEBitmap_loadHEB(const char *filename);
Loads a new HEBitmap from a .heb file (use the Python encoder to create it). Heb files are faster to load but larger on disk compared to the Playdate image format.
HEBitmap* HEBitmap_fromLCDBitmap(LCDBitmap *lcd_bitmap);
Create a HEBitmap from a LCDBitmap.
void HEBitmap_draw(HEBitmap *bitmap, int x, int y);
Draws the bitmap at the given position.
int width;
Bitmap width (HEBitmap struct)
int height;
Bitmap height (HEBitmap struct)
LCDColor HEBitmap_colorAt(HEBitmap *bitmap, int x, int y);
Gets the color at the given position, it returns an LCDColor.
void HEBitmap_getData(HEBitmap *bitmap, uint8_t **data, uint8_t **mask, int *rowbytes, int *bx, int *by, int *bw, int *bh);
Gets the bitmap data, mask, rowbytes and bounds (surrounding transparent pixels are trimmed).
void HEBitmap_free(HEBitmap *bitmap);
Frees the bitmap.

🖼️ Bitmap Table

HEBitmapTable* HEBitmapTable_load(const char *filename);
Loads a new HEBitmap from a Playdate image table file (similar to playdate->graphics->loadBitmapTable).
HEBitmapTable* HEBitmapTable_loadHEBT(const char *filename);
Loads a new HEBitmapTable from a .hebt file (use the Python encoder to create it).
HEBitmapTable* HEBitmapTable_loadHEBT_options(const char *filename, int useAllocator);
Loads a new HEBitmapTable from a .hebt file with configurable options. If useAllocator is false and the table is compressed, each image is allocated individually resulting in multiple allocations.
HEBitmap* HEBitmap_atIndex(HEBitmapTable *bitmapTable, unsigned int index);
Gets the bitmap at the given index in a table.
unsigned int length;
Table length (HEBitmapTable struct)
void HEBitmapTable_free(HEBitmapTable *bitmapTable);
Frees the bitmap table.