1set_clip_rect(3) Allegro manual set_clip_rect(3)
2
3
4
6 set_clip_rect - Sets the clipping rectangle of a bitmap. Allegro game
7 programming library.
8
10 #include <allegro.h>
11
12
13 void set_clip_rect(BITMAP *bitmap, int x1, int y1, int x2, int y2);
14
16 Each bitmap has an associated clipping rectangle, which is the area of
17 the image that it is OK to draw onto. Nothing will be drawn to posi‐
18 tions outside this space. This function sets the clipping rectangle for
19 the specified bitmap. Pass the coordinates of the top-left and bottom-
20 right corners of the clipping rectangle in this order; these are both
21 inclusive, i.e. set_clip_rect(bitmap, 16, 16, 32, 32) will allow draw‐
22 ing to (16, 16) and (32, 32), but not to (15, 15) and (33, 33).
23
24 Drawing operations will be performed (at least partially) on the bitmap
25 as long as the first coordinates of its clipping rectangle are not
26 greater than the second coordinates and its intersection with the
27 actual image is non-empty. If either condition is not fulfilled, draw‐
28 ing will be turned off for the bitmap, e.g.
29
30 set_clip_rect(bmp, 0, 0, -1, -1); /* disable drawing on bmp */
31
32 Note that passing "out-of-bitmap" coordinates is allowed, but they are
33 likely to be altered (and so the coordinates returned by
34 get_clip_rect() will be different). However, such modifications are
35 guaranteed to preserve the external effect of the clipping rectangle,
36 that is not to modify the actual area of the image that it is OK to
37 draw onto.
38
39
41 get_clip_rect(3), add_clip_rect(3), set_clip_state(3),
42 get_clip_state(3), ex12bit(3), excamera(3)
43
44
45
46Allegro version 4.4.3 set_clip_rect(3)