al_get_parent_bitmap(3)

πŸ“¦
version 5.2.11.3 Β· 3 versions
, in arch rolling

πŸ’– 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