al_get_parent_bitmap(3)
π al_get_parent_bitmap(3) β Library Functions Manual π
Okay bestie, this page is al_get_parent_bitmap(3) from the Library Functions Manual, and itβs giving βfind the real parent bitmapβ energy. Letβs go π
β¨
πΈ NAME πΈ
al_get_parent_bitmap β Allegro 5 API
π SYNOPSIS π
#include <allegro5/allegro.h>
ALLEGRO_BITMAP *al_get_parent_bitmap(ALLEGRO_BITMAP *bitmap)
π¦ DESCRIPTION π¦
This function returns the bitmap that this bitmap is a sub-bitmap of. If this bitmap is not a sub-bitmap, it returns NULL.
It always returns the real bitmap, and never a sub-bitmap. And yes, this might NOT match what was passed to al_create_sub_bitmap(3). Consider this code, for instance:
ALLEGRO_BITMAP* a = al_create_bitmap(512, 512);
ALLEGRO_BITMAP* b = al_create_sub_bitmap(a, 128, 128, 256, 256);
ALLEGRO_BITMAP* c = al_create_sub_bitmap(b, 64, 64, 128, 128);
ASSERT(al_get_parent_bitmap(b) == a && al_get_parent_bitmap(c) == a);
The assertion will pass because only a is a real bitmap, and both b and c are its sub-bitmaps. Periodt πβ¨
Lowkey important: the returned parent might not be the direct thing you passed to al_create_sub_bitmap(3) β itβs the real bitmap at the root of the sub-bitmap situation π
β SINCE β
5.0.6, 5.1.2
π SEE ALSO π
Catch ya later, bestie β this was al_get_parent_bitmap(3) from the Allegro reference manual and the Allegro 5 API; the footer didnβt give me a date, so Iβm not inventing one π«Άπ
β¨
π¦ 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