al_lock_bitmap_region(3alleg5)

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

πŸ’– NAME πŸ’–

okay so bestie, this is al_lock_bitmap_region β€” it's giving Allegro 5 API and it's here to let you lock just a lil slice of a bitmap instead of the whole entire thing. slay. πŸŽ€


✨ SYNOPSIS ✨

#include <allegro5/allegro.h>

ALLEGRO_LOCKED_REGION *al_lock_bitmap_region(ALLEGRO_BITMAP *bitmap,
   int x, int y, int width, int height, int format, int flags)

πŸ¦‹ DESCRIPTION πŸ¦‹

So it's literally the same vibe as al_lock_bitmap(3alleg5), except β€” plot twist β€” you only lock one specific area of the bitmap. iconic. ✨

If the bitmap is a video bitmap, then only that lil area of the texture gets updated when you unlock it. no cap. And here's the tea, bestie: locking only the region you intend to modify is genuinely faster than locking the whole entire bitmap, so don't be out here locking everything like a rookie. πŸ’…

Note: okay so if you're using ALLEGRO_LOCK_WRITEONLY with a blocked pixel format β€” and by "blocked" I mean any format where al_get_pixel_block_width(3alleg5) or al_get_pixel_block_height(3alleg5) does not return 1 β€” then for optimal performance your region needs to be aligned to the block width. πŸ™ˆ If it's not aligned, the function has to lock the region with ALLEGRO_LOCK_READWRITE instead, just so it can pad the region out with valid data. it's giving "fine, I'll do it myself" energy. πŸ’€

🌈 SEE ALSO 🌈


and that's the whole page, periodt. πŸ’œ this was the Allegro reference manual serving al_lock_bitmap_region(3alleg5) realness β€” go lock your regions responsibly, bestie, ily 🫢🌸

πŸ“¦ where this page comes from