---
name: "al_lock_bitmap_region"
section: "3"
platform: "linux"
package: "allegro"
version: "5.2.11.3-2"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/al_lock_bitmap_region"
---

# al\_lock\_bitmap\_region(3)

Allegro 5 API

## NAME

al\_lock\_bitmap\_region - Allegro 5 API

## 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)](/al_lock_bitmap/3.md), but only locks a specific area of the bitmap. If the bitmap is a video bitmap, only that area of the texture will be updated when it is unlocked. Locking only the region you indend to modify will be faster than locking the whole bitmap.

*Note:* Using the ALLEGRO\_LOCK\_WRITEONLY with a blocked pixel format (i.e. formats for which [al\_get\_pixel\_block\_width(3)](/al_get_pixel_block_width/3.md) or [al\_get\_pixel\_block\_height(3)](/al_get_pixel_block_height/3.md) 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

[ALLEGRO\_LOCKED\_REGION(3)](/ALLEGRO_LOCKED_REGION/3.md), [ALLEGRO\_PIXEL\_FORMAT(3)](/ALLEGRO_PIXEL_FORMAT/3.md), [al\_unlock\_bitmap(3)](/al_unlock_bitmap/3.md)
