create_video_bitmap(3alleg4)

πŸ’– create_video_bitmap β€” Allegro manual (that's 3alleg4 bestie, section 3, Allegro 4 era) πŸ’–

okay so. you want video memory. not regular memory. video memory. and you want a bitmap living in it. this is the function for that, and it's part of the Allegro game programming library, so it's giving very much graphics-era energy ✨


✨ SYNOPSIS ✨

#include <allegro.h>

BITMAP *create_video_bitmap(int width, int height);

like, you hand it a width and a height, it hands you back a BITMAP *. simple. iconic. no cap 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

so this one allocates a video memory bitmap of the size you asked for. it's literally in the name bestie.

what's it for?? two main character uses, periodt:

  • allocating offscreen video memory to stash your source graphics in, all ready and waiting for a hardware accelerated blitting operation πŸ”₯
  • creating multiple video memory pages, which you can then show off by calling show_video_bitmap() πŸ‘‘

and if you want the whole tea on how this compares to the other bitmap types, plus other specific details, go read the introduction of this chapter. it's right there, it's free, it slaps πŸ’…

⚠️ warning warning warning ⚠️ video memory bitmaps are usually allocated from the same space as the screen bitmap, so they may overlap with it. which means: it is therefore not a good idea to use the global screen at the same time as any surfaces returned by this function. don't do it. i'm begging. not both at once, bestie 😭

🌸 RETURN VALUE 🌸

returns a pointer to the bitmap on success πŸ’–

or NULL if you have run out of video ram πŸ˜” (it happens. video ram is finite. tragic.)

πŸŽ€ remember: destroy this bitmap before any subsequent call to set_gfx_mode(). don't leave it hanging. clean up after yourself, it's the vibe. ✨

🌈 SEE ALSO 🌈

the whole friend group, in order, fr fr:


okay that's the whole page, you ate it πŸ’…

sign-off time: this was the Allegro manual, version 4.4.3, page create_video_bitmap(3alleg4). go make something pretty with it, bestie πŸ’–πŸ¦‹πŸŒΈβœ¨