al_set_new_bitmap_flags(3alleg5)

πŸ“¦
version 5.2.11.3 Β· 4 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– al_set_new_bitmap_flags β€” Allegro 5 API πŸ’–

okay bestie, so this one lives in the Allegro 5 API (section 3alleg5, if you're keeping track), and it's literally the little switch that decides what vibe every brand-new bitmap is gonna have. let's get into it 🫢


✨ SYNOPSIS ✨

#include <allegro5/allegro.h>

void al_set_new_bitmap_flags(int flags)

🌸 DESCRIPTION 🌸

so what it does: it sets the flags that get used for newly created bitmaps. like, every bitmap you make after you call this is gonna inherit the vibe you just set. no cap.

here's the full list of valid flags, and yes we're going through all of them, sit down, hydrate πŸ’…

  • ALLEGRO_MEMORY_BITMAP β€” makes a bitmap that lives in system memory. operations on it and with it are not hardware accelerated, periodt. BUT the glow-up is that direct pixel access can be relatively quick compared to video bitmaps β€” which depend on whatever display driver you're running. so it's giving "slow to draw, fast to poke at."
note: Allegro's software rendering routines are currently somewhat unoptimised. 😭
note: combining ALLEGRO_VIDEO_BITMAP and ALLEGRO_MEMORY_BITMAP flags is invalid. don't do it bestie.
  • ALLEGRO_VIDEO_BITMAP β€” creates a bitmap that resides in the video card memory. these are the main characters, they receive the greatest benefit from hardware acceleration. ⭐
note: creating a video bitmap will fail if there is no current display, or if the current display driver cannot create the bitmap. the latter happens if, for example, the format or dimensions are not supported. πŸ’€
note: bitmaps created with this flag will be converted to memory bitmaps when the last display is destroyed. in most cases it is therefore easier to use the ALLEGRO_CONVERT_BITMAP flag instead.
note: combining ALLEGRO_VIDEO_BITMAP and ALLEGRO_MEMORY_BITMAP flags is invalid. (yes again. it's that serious.)
  • ALLEGRO_CONVERT_BITMAP β€” this is the default, the moment, the it-girl. it will try to create a video bitmap and if that fails, create a memory bitmap. bitmaps created with this flag when there is no active display will be converted to video bitmaps next time a display is created. they also will remain video bitmaps if the last display is destroyed and then another is created again. since 5.1.0 ✨
note: you can combine this flag with ALLEGRO_MEMORY_BITMAP or ALLEGRO_VIDEO_BITMAP to force the initial type (and fail in the latter case if no video bitmap can be created) β€” but usually neither of those combinations is very useful. πŸ₯΄

you can use the display option ALLEGRO_AUTO_CONVERT_BITMAPS to control which displays will try to auto-convert bitmaps.

  • ALLEGRO_FORCE_LOCKING β€” does nothing since 5.1.8. kept for backwards compatibility only. it's a ghost, it's retired, we still love her πŸ™ˆ
  • ALLEGRO_NO_PRESERVE_TEXTURE β€” normally, every effort is taken to preserve the contents of bitmaps, since some platforms may forget them. that can take extra processing time. so if you know it doesn't matter if a bitmap keeps its pixel data β€” like when it's a temporary buffer β€” use this flag to tell Allegro not to attempt to preserve its contents. queen of "idc" energy πŸ’…
  • ALLEGRO_ALPHA_TEST β€” this is a driver hint only. it tells the graphics driver to do alpha testing instead of alpha blending on bitmaps created with this flag. alpha testing is usually faster and preferred if your bitmaps have only one level of alpha (0). this flag is currently not widely implemented (i.e., only for memory bitmaps). so like… it's a suggestion, not a demand πŸŽ€
  • ALLEGRO_MIN_LINEAR β€” when drawing a scaled down version of the bitmap, use linear filtering. this usually looks better. you can also combine it with the MIPMAP flag for even better quality. obsessed with the upgrade path fr fr πŸ”₯
  • ALLEGRO_MAG_LINEAR β€” when drawing a magnified version of a bitmap, use linear filtering. this will cause the picture to get blurry instead of creating a big rectangle for each pixel. whether you want this or not depends on how you want things to look like. it's giving artistic choice, bestie πŸ¦‹
  • ALLEGRO_MIPMAP β€” this can only be used for bitmaps whose width and height is a power of two. in that case, it will generate mipmaps and use them when drawing scaled down versions. for example if the bitmap is 64x64, then extra bitmaps of sizes 32x32, 16x16, 8x8, 4x4, 2x2 and 1x1 will be created, always containing a scaled down version of the original. it's the whole little family tree, iconic πŸ‘‘

πŸ‘€ SEE ALSO πŸ‘€


that's the whole page babes πŸ’œ this came straight from the Allegro reference manual, al_set_new_bitmap_flags(3alleg5), section 3 of the Allegro 5 docs β€” so go set your flags and slay βœ¨πŸŽ€πŸ’…

πŸ“¦ where this page comes from