al_lock_bitmap_region(3)
π
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 theALLEGRO_LOCK_WRITEONLYwith a blocked pixel format (i.e. formats for whichal_get_pixel_block_width(3)oral_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 theALLEGRO_LOCK_READWRITEinstead 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