1al_lock_bitmap(3) Library Functions Manual al_lock_bitmap(3)
2
3
4
6 al_lock_bitmap
7
9 #include <allegro5/allegro.h>
10
11 ALLEGRO_LOCKED_REGION *al_lock_bitmap(ALLEGRO_BITMAP *bitmap,
12 int format, int flags)
13
15 Lock an entire bitmap for reading or writing. If the bitmap is a dis‐
16 play bitmap it will be updated from system memory after the bitmap is
17 unlocked (unless locked read only). Returns NULL if the bitmap cannot
18 be locked, e.g. the bitmap was locked previously and not unlocked.
19
20 Flags are:
21
22 · ALLEGRO_LOCK_READONLY - The locked region will not be written to.
23 This can be faster if the bitmap is a video texture, as it can be
24 discarded after the lock instead of uploaded back to the card.
25
26 · ALLEGRO_LOCK_WRITEONLY - The locked region will not be read from.
27 This can be faster if the bitmap is a video texture, as no data need
28 to be read from the video card. You are required to fill in all pix‐
29 els before unlocking the bitmap again, so be careful when using this
30 flag.
31
32 · ALLEGRO_LOCK_READWRITE - The locked region can be written to and read
33 from.
34
35 `format' indicates the pixel format that the returned buffer will be
36 in. To lock in the same format as the bitmap stores it's data inter‐
37 nally, call with al_get_bitmap_format(bitmap) as the format or use
38 ALLEGRO_PIXEL_FORMAT_ANY. Locking in the native format will usually be
39 faster.
40
41 Note: While a bitmap is locked, you can not use any drawing
42 operations on it (with the sole exception of al_put_pixel(3) and
43 al_put_blended_pixel(3)).
44
46 ALLEGRO_LOCKED_REGION(3), ALLEGRO_PIXEL_FORMAT(3), al_unlock_bitmap(3)
47
48
49
50Allegro reference manual al_lock_bitmap(3)