al_set_new_bitmap_flags(3alleg5)
π 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: combiningALLEGRO_VIDEO_BITMAPandALLEGRO_MEMORY_BITMAPflags 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: combiningALLEGRO_VIDEO_BITMAPandALLEGRO_MEMORY_BITMAPflags 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 withALLEGRO_MEMORY_BITMAPorALLEGRO_VIDEO_BITMAPto 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 theMIPMAPflag 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 is64x64, then extra bitmaps of sizes32x32,16x16,8x8,4x4,2x2and1x1will 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
- debian trixie: allegro5-doc 2:5.2.10.1+dfsg-1 Β· Zlib
- ubuntu questing: allegro5-doc 2:5.2.10.1+dfsg-1build1
- ubuntu resolute: allegro5-doc 2:5.2.11.3+dfsg-1 Β· Zlib
- ubuntu stonking: allegro5-doc 2:5.2.11.3+dfsg-1 Β· Zlib
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms