1al_lock_bitmap(3)                                            al_lock_bitmap(3)
2
3
4

NAME

6       al_lock_bitmap - Allegro 5 API
7

SYNOPSIS

9              #include <allegro5/allegro.h>
10
11              ALLEGRO_LOCKED_REGION *al_lock_bitmap(ALLEGRO_BITMAP *bitmap,
12                 int format, int flags)
13

DESCRIPTION

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       This function also returns NULL if the format is a compressed format.
20
21       Flags are:
22
23       · ALLEGRO_LOCK_READONLY  -  The  locked  region will not be written to.
24         This can be faster if the bitmap is a video texture,  as  it  can  be
25         discarded after the lock instead of uploaded back to the card.
26
27       · ALLEGRO_LOCK_WRITEONLY  -  The  locked  region will not be read from.
28         This can be faster if the bitmap is a video texture, as no data  need
29         to be read from the video card.  You are required to fill in all pix‐
30         els before unlocking the bitmap again, so be careful when using  this
31         flag.
32
33       · ALLEGRO_LOCK_READWRITE - The locked region can be written to and read
34         from.  Use this flag if a partial number of pixels need to be written
35         to, even if reading is not needed.
36
37       format  indicates the pixel format that the returned buffer will be in.
38       To lock in the same format as the bitmap stores  its  data  internally,
39       call  with  al_get_bitmap_format(bitmap)  as  the  format  or use ALLE‐
40       GRO_PIXEL_FORMAT_ANY.  Locking in the native  format  will  usually  be
41       faster.   If  the bitmap format is compressed, using ALLEGRO_PIXEL_FOR‐
42       MAT_ANY will choose an implementation defined non-compressed format.
43
44       On some platforms, Allegro automatically backs up the contents of video
45       bitmaps  because  they  may  be  occasionally  lost  (see discussion in
46       al_create_bitmap(3)'s documentation).  If you're completely  recreating
47       the  bitmap  contents  often (e.g.  every frame) then you will get much
48       better performance by creating the target bitmap  with  ALLEGRO_NO_PRE‐
49       SERVE_TEXTURE flag.
50
51              Note:  While a bitmap is locked, you can not use any drawing op‐
52              erations on it (with the sole exception of  al_put_pixel(3)  and
53              al_put_blended_pixel(3)).
54

SEE ALSO

56       ALLEGRO_LOCKED_REGION(3), ALLEGRO_PIXEL_FORMAT(3), al_unlock_bitmap(3),
57       al_lock_bitmap_region(3), al_lock_bitmap_blocked(3), al_lock_bitmap_re‐
58       gion_blocked(3)
59
60
61
62Allegro reference manual                                     al_lock_bitmap(3)
Impressum