1 /**@(#)
2 **/
3 #include <tina/sys.h>
4 #include <tina/sysfuncs.h>
5 #include <tina/math.h>
6 #include <tina/mathfuncs.h>
7 #include <tina/tv.h>
8 #include <tina/tw_Xfuncs.h>
9
10 extern Ipos tv_proj2(Tv *, Vec2);
11
12 void *tv_mask_get(Tv * tv, int lx, int ly, int ux, int uy)
13 {
14 if (tv == NULL)
15 return (NULL);
16 return ((void *) tv_screen_mask_get(tv->tv_screen, lx, ly, ux, uy));
17 }
18
19 void tv_mask_use(Tv * tv, void *mask)
20 {
21 tv_screen_mask_use(tv->tv_screen, mask);
22 }
23
24 void tv_mask_point(Tv * tv, void *mask, Ipos pos, int bit)
25 {
26 tv_screen_mask_point(tv->tv_screen, mask, pos, bit);
27 }
28
29 void *tv_clip_mask_get(Tv * tv, int lx, int ly, int ux, int uy)
30 {
31 void *mask = tv_mask_get(tv, lx, ly, ux, uy);
32 int x, y;
33 for(x = lx; x < ux; x++)
34 for(y = ly; y < uy; y++)
35 tv_mask_point(tv, mask, ipos(x, y), 1);
36 return(mask);
37 }
38
39 void *tv_clip_mask2_get(Tv * tv, Vec2 p1, Vec2 p2)
40 {
41 Ipos q1 = tv_proj2(tv, p1);
42 Ipos q2 = tv_proj2(tv, p2);
43 int lx = ipos_x(q1);
44 int ly = ipos_y(q1);
45 int ux = ipos_x(q2);
46 int uy = ipos_y(q2), x, y;
47 void *mask;
48 if(lx > ux)
49 SWAP(int, lx, ux);
50 if(ly > uy)
51 SWAP(int, ly, uy);
52 mask = tv_mask_get(tv, lx, ly, ux, uy);
53 for(x = lx; x < ux; x++)
54 for(y = ly; y < uy; y++)
55 tv_mask_point(tv, mask, ipos(x, y), 1);
56 return(mask);
57 }
58
59 void tv_mask_free(Tv * tv, void *mask)
60 {
61 tv_screen_mask_free(tv->tv_screen, mask);
62 }
63
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.