create_sub_bitmap(3alleg4)
β¨ NAME β¨
create_sub_bitmap β bestie, it literally creates a memory sub bitmap π
. Part of the Allegro game programming library, no cap. π
π¦ SYNOPSIS π¦
#include <allegro.h>
BITMAP *create_sub_bitmap(BITMAP *parent, int x, y, width, height);
πΈ DESCRIPTION πΈ
Okay so picture this: you've got a bitmap already, right? A whole entire parent bitmap, living its main character life. Now create_sub_bitmap makes you a sub-bitmap β which is a bitmap that shares its drawing memory with that pre-existing bitmap, but it can have its own different size and its own clipping settings. It's giving "we're not copies, we're connected." π«Ά
Tiny but crucial detail: when you're making a sub-bitmap of the mode-X screen, the x position must be a multiple of four. Like, that's not a suggestion, that's the vibe check. π₯
The sub-bitmap's width and height can totally extend past the right and bottom edges of the parent β they'll just get clipped, nbd π. But the origin point has to lie inside the parent region. That part is non-negotiable, bestie. π
π RETURN VALUE π
It hands you back a pointer to the freshly created sub bitmap, all sparkly and new β¨. Or, if the sub bitmap couldn't be created, you get NULL β and honestly? Not iconic, but it happens. π
β οΈ GIRL, LISTEN β οΈ Remember to free the sub bitmap before you free the parent bitmap! Otherwise you get memory leaks and potentially crashes from accessing memory that's already been freed. That's not a fun surprise, that's a jumpscare. π
β SEE ALSO β
create_bitmap(3alleg4)create_bitmap_ex(3alleg4)destroy_bitmap(3alleg4)is_sub_bitmap(3alleg4)clear_bitmap(3alleg4)clear_to_color(3alleg4)expat(3alleg4)exscroll(3alleg4)exswitch(3alleg4)
Okay that's the whole page, you ate that π β this was Allegro, version 4.4.3, and yes, the page is literally named create_sub_bitmap(3alleg4). Go forth and make sub-bitmaps, queen. ππ§
π¦ where this page comes from
- debian bookworm: allegro4-doc 2:4.4.3.1-3 Β· Allegro-gift-ware
- debian trixie: allegro4-doc 2:4.4.3.1-5 Β· Allegro-gift-ware
- ubuntu jammy: allegro4-doc 2:4.4.3.1-2 Β· Allegro-gift-ware
- ubuntu noble: allegro4-doc 2:4.4.3.1-4.1build3 Β· Allegro-gift-ware
- ubuntu questing: allegro4-doc 2:4.4.3.1-6
- ubuntu resolute: allegro4-doc 2:4.4.3.1-7 Β· Allegro-gift-ware
- ubuntu stonking: allegro4-doc 2:4.4.3.1-9 Β· Allegro-gift-ware
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms