al_create_sub_bitmap(3)
π NAME π
okay so this is the al_create_sub_bitmap(3) page from the Library Functions Manual, and the function is al_create_sub_bitmap β Allegro 5 API energy, no cap. π
β¨
πΈ SYNOPSIS πΈ
bestie, hereβs the exact spell to cast:
#include <allegro5/allegro.h>
ALLEGRO_BITMAP *al_create_sub_bitmap(ALLEGRO_BITMAP *parent,
int x, int y, int w, int h)
π¦ DESCRIPTION π¦
okay so al_create_sub_bitmap creates a sub-bitmap of the parent, at the coordinates you specify and with the size you specify. Itβs giving βbaby bitmap, same drawing memoryβ β a sub-bitmap is a bitmap that shares drawing memory with a pre-existing parent bitmap, but it can possibly have a different size and clipping settings. π
- The sub-bitmap may originate off or extend past the parent bitmap. yes, it can be extra like that. π
- go read the discussion in
al_get_backbuffer(3)about using sub-bitmaps of the backbuffer, iykyk. - the parent bitmapβs clipping rectangles are ignored. not invited to the group chat. π«
If a sub-bitmap was not or cannot be created, then NULL is returned. thatβs the vibe check failing, bestie. π
When youβre done using the sub-bitmap, you must call al_destroy_bitmap(3) on it to free any resources allocated for it. no ghosting your cleanup duties, periodt. π§Ήβ¨
β οΈ big note, bestie: destroying parents of sub-bitmaps will not destroy the sub-bitmaps. instead, the sub-bitmaps become invalid and should no longer be used for drawing β they still must be destroyed with al_destroy_bitmap(3) however. it does not matter whether you destroy a sub-bitmap before or after its parent otherwise. so likeβ¦ destroy responsibly, okay? ππ«Ά
β¨ SEE ALSO β¨
youβll also wanna peek at al_create_bitmap(3) β itβs the related icon, fr fr. π
cute sign-off: this page is signed by the Allegro reference manual, with al_create_sub_bitmap(3) riding alongside β bye bestie, go make some sub-bitmaps! πππ¦
π¦ where this page comes from
- arch rolling: allegro 5.2.11.3-2 Β· Zlib AND BSD-3-Clause AND OFL-1.1 AND LicenseRef-Custom
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms