File: al_lock_bitmap.3

package info (click to toggle)
allegro5 2%3A5.2.2-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 23,032 kB
  • sloc: ansic: 120,340; cpp: 15,707; objc: 4,805; python: 2,915; java: 2,195; sh: 887; xml: 86; makefile: 49; perl: 37; pascal: 24
file content (67 lines) | stat: -rw-r--r-- 2,493 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
.TH "al_lock_bitmap" "3" "" "Allegro reference manual" ""
.SH NAME
.PP
al_lock_bitmap \- Allegro 5 API
.SH SYNOPSIS
.IP
.nf
\f[C]
#include\ <allegro5/allegro.h>

ALLEGRO_LOCKED_REGION\ *al_lock_bitmap(ALLEGRO_BITMAP\ *bitmap,
\ \ \ int\ format,\ int\ flags)
\f[]
.fi
.SH DESCRIPTION
.PP
Lock an entire bitmap for reading or writing.
If the bitmap is a display bitmap it will be updated from system memory
after the bitmap is unlocked (unless locked read only).
Returns NULL if the bitmap cannot be locked, e.g.
the bitmap was locked previously and not unlocked.
This function also returns NULL if the \f[C]format\f[] is a compressed
format.
.PP
Flags are:
.IP \[bu] 2
ALLEGRO_LOCK_READONLY \- The locked region will not be written to.
This can be faster if the bitmap is a video texture, as it can be
discarded after the lock instead of uploaded back to the card.
.IP \[bu] 2
ALLEGRO_LOCK_WRITEONLY \- The locked region will not be read from.
This can be faster if the bitmap is a video texture, as no data need to
be read from the video card.
You are required to fill in all pixels before unlocking the bitmap
again, so be careful when using this flag.
.IP \[bu] 2
ALLEGRO_LOCK_READWRITE \- The locked region can be written to and read
from.
Use this flag if a partial number of pixels need to be written to, even
if reading is not needed.
.PP
\f[C]format\f[] indicates the pixel format that the returned buffer will
be in.
To lock in the same format as the bitmap stores its data internally,
call with \f[C]al_get_bitmap_format(bitmap)\f[] as the format or use
ALLEGRO_PIXEL_FORMAT_ANY.
Locking in the native format will usually be faster.
If the bitmap format is compressed, using ALLEGRO_PIXEL_FORMAT_ANY will
choose an implementation defined non\-compressed format.
.PP
On some platforms, Allegro automatically backs up the contents of video
bitmaps because they may be occasionally lost (see discussion in
al_create_bitmap(3)\[aq]s documentation).
If you\[aq]re completely recreating the bitmap contents often (e.g.
every frame) then you will get much better performance by creating the
target bitmap with ALLEGRO_NO_PRESERVE_TEXTURE flag.
.RS
.PP
\f[I]Note:\f[] While a bitmap is locked, you can not use any drawing
operations on it (with the sole exception of al_put_pixel(3) and
al_put_blended_pixel(3)).
.RE
.SH SEE ALSO
.PP
ALLEGRO_LOCKED_REGION(3), ALLEGRO_PIXEL_FORMAT(3), al_unlock_bitmap(3),
al_lock_bitmap_region(3), al_lock_bitmap_blocked(3),
al_lock_bitmap_region_blocked(3)