1 /*
2  *  This program is free software; you can redistribute it and/or modify
3  *  it under the terms of the GNU General Public License as published by
4  *  the Free Software Foundation; either version 2 of the License, or
5  *  (at your option) any later version.
6  *
7  *  This program is distributed in the hope that it will be useful,
8  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  *  GNU General Public License for more details.
11  *
12  *  You should have received a copy of the GNU General Public License
13  *  along with this program; if not, write to the Free Software
14  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
15  */
16 #ifndef LIBS_GRAPHICS_PRIM_H_
17 #define LIBS_GRAPHICS_PRIM_H_
18 
19 enum gfx_object
20 {
21 	POINT_PRIM = 0,
22 	STAMP_PRIM,
23 	STAMPFILL_PRIM,
24 	LINE_PRIM,
25 	TEXT_PRIM,
26 	RECT_PRIM,
27 	RECTFILL_PRIM,
28 
29 	NUM_PRIMS
30 };
31 typedef BYTE GRAPHICS_PRIM;
32 
33 typedef union
34 {
35    POINT Point;
36    STAMP Stamp;
37    LINE Line;
38    TEXT Text;
39    RECT Rect;
40 } PRIM_DESC;
41 
42 typedef DWORD PRIM_LINKS;
43 
44 typedef struct
45 {
46 	PRIM_LINKS Links;
47 	GRAPHICS_PRIM Type;
48 	Color color;
49 	PRIM_DESC Object;
50 } PRIMITIVE;
51 
52 #define END_OF_LIST ((COUNT)0xFFFF)
53 
54 #define GetPredLink(l) LOWORD(l)
55 #define GetSuccLink(l) HIWORD(l)
56 #define MakeLinks MAKE_DWORD
57 #define SetPrimLinks(pPrim,p,s) ((pPrim)->Links = MakeLinks (p, s))
58 #define GetPrimLinks(pPrim) ((pPrim)->Links)
59 #define SetPrimType(pPrim,t) ((pPrim)->Type = t)
60 #define GetPrimType(pPrim) ((pPrim)->Type)
61 #define SetPrimColor(pPrim,c) ((pPrim)->color = c)
62 #define GetPrimColor(pPrim) ((pPrim)->color)
63 
64 static inline void
SetPrimNextLink(PRIMITIVE * pPrim,COUNT Link)65 SetPrimNextLink (PRIMITIVE *pPrim, COUNT Link)
66 {
67 	SetPrimLinks (pPrim, END_OF_LIST, Link);
68 }
69 
70 
71 static inline COUNT
GetPrimNextLink(PRIMITIVE * pPrim)72 GetPrimNextLink (PRIMITIVE *pPrim)
73 {
74 	return GetSuccLink (GetPrimLinks (pPrim));
75 }
76 
77 
78 #endif  /* PRIM_H */
79 
80 
81