al_lock_bitmap_region(3)

πŸ“¦
version 5.2.11.3 Β· 3 versions
, in arch rolling

πŸ’… al_lock_bitmap_region(3) πŸ’…

okay bestie, this is the Library Functions Manual entry for al_lock_bitmap_region, and it’s giving β€œlock just the part you actually need” energy. no cap. πŸŽ€


✨ NAME ✨

al_lock_bitmap_region β€” Allegro 5 API. she locks a region, not the whole bitmap. periodt. πŸ’…


πŸ¦‹ 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 πŸ’–

Like al_lock_bitmap(3), but only locks a specific area of the bitmap. iconic behavior, honestly. ✨

If the bitmap is a video bitmap, only that area of the texture will be updated when it is unlocked. so you’re not out here updating the whole texture for no reason. 🫢

Locking only the region you intend to modify will be faster than locking the whole bitmap. lowkey obvious, but highkey important. πŸ’…

Note: Using the ALLEGRO_LOCK_WRITEONLY with a blocked pixel format (i.e. formats for which al_get_pixel_block_width(3) or al_get_pixel_block_height(3) do not return 1) requires you to have the region be aligned to the block width for optimal performance. If it is not, then the function will have to lock the region with the ALLEGRO_LOCK_READWRITE instead in order to pad this region with valid data. 🫠

🌸 SEE ALSO 🌸

go read these too, bestie:


signed off by the Allegro reference manual, page al_lock_bitmap_region(3) β€” source/version energy included, and the footer didn’t give us a date, so consider this timeless. πŸ’œβœ¨πŸŽ€

πŸ“¦ where this page comes from
  • arch rolling: allegro 5.2.11.3-2 Β· Zlib AND BSD-3-Clause AND OFL-1.1 AND LicenseRef-Custom
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms