r6831@lvps87-230-33-50: verhaegs | 2008-02-03 14:08:57 +0100
[AROS.git] / test / HiddGraphics / gfxhiddtool.c
blobc20d92d715b8d5e79b36577851970f4a48702bc9
1 #define AROS_USE_OOP
3 #include <stdio.h>
4 #include <strings.h>
6 #include <aros/config.h>
7 #include <exec/types.h>
9 #include <proto/exec.h>
10 #include <proto/dos.h>
11 #include <proto/oop.h>
12 #include <proto/utility.h>
14 #include <utility/tagitem.h>
16 #include <oop/oop.h>
17 #include <hidd/graphics.h>
19 #include "gfxhiddtool.h"
21 #undef SDEBUG
22 #undef DEBUG
23 #define DEBUG 1
24 #include <aros/debug.h>
26 extern struct Library *OOPBase;
27 /***************************************************************/
29 BOOL ght_OpenLibs(struct ght_OpenLibs *libsArray)
31 ULONG i = 0;
32 BOOL ok = TRUE;
34 while(libsArray[i].base)
36 *libsArray[i++].base = NULL;
39 i = 0;
41 while(libsArray[i].libName && ok)
43 *libsArray[i].base = OpenLibrary(libsArray[i].libName, libsArray[i].version);
44 if(*libsArray[i].base == NULL)
46 printf("Can't open library '%s' V%li!\n",
47 libsArray[i].libName,
48 libsArray[i].version
50 ok = FALSE;
53 i++;
56 return ok;
58 /***************************************************************/
60 void ght_CloseLibs(struct ght_OpenLibs *libsArray)
62 ULONG i = 0;
63 BOOL quit = FALSE;
65 while(libsArray[i].base && !quit)
67 if(*libsArray[i].base != NULL)
69 CloseLibrary(*libsArray[i].base);
70 i++;
72 else
74 quit = TRUE;
78 /***************************************************************/
80 ULONG ght_GetAttr(Object *obj, ULONG attrID)
82 ULONG ret;
84 GetAttr(obj, attrID, &ret);
85 return ret;
87 /***************************************************************/
89 OOP_Object * NewGC(OOP_Object *hiddGfx, ULONG gcType, struct TagItem *tagList)
91 static OOP_MethodID mid = 0;
92 struct pHidd_Gfx_NewGC p;
94 if(!mid) mid = OOP_GetMethodID(IID_Hidd_Gfx, moHidd_Gfx_NewGC);
96 p.mID = mid;
97 /* p.gcType = gcType;*/
98 p.attrList = tagList;
100 return((OOP_Object *) OOP_DoMethod(hiddGfx, (OOP_Msg) &p));
102 /***************************************************************/
104 void DisposeGC(OOP_Object *hiddGfx, OOP_Object *gc)
106 static OOP_MethodID mid = 0;
107 struct pHidd_Gfx_DisposeGC p;
109 if(!mid) mid = OOP_GetMethodID(IID_Hidd_Gfx, moHidd_Gfx_DisposeGC);
111 p.mID = mid;
112 p.gc = gc;
114 OOP_DoMethod(hiddGfx, (OOP_Msg) &p);
116 /***************************************************************/
118 OOP_Object * NewBitMap(OOP_Object *hiddGfx, struct TagItem *tagList)
120 static OOP_MethodID mid = 0;
121 struct pHidd_Gfx_NewBitMap p;
123 if(!mid) mid = OOP_GetMethodID(IID_Hidd_Gfx, moHidd_Gfx_NewBitMap);
125 p.mID = mid;
126 p.attrList = tagList;
128 return((OOP_Object *) OOP_DoMethod(hiddGfx, (OOP_Msg) &p));
130 /***************************************************************/
132 void DisposeBitMap(OOP_Object *hiddGfx, OOP_Object *bitMap)
134 static OOP_MethodID mid = 0;
135 struct pHidd_Gfx_DisposeBitMap p;
137 if(!mid) mid = OOP_GetMethodID(IID_Hidd_Gfx, moHidd_Gfx_DisposeBitMap);
139 p.mID = mid;
140 p.bitMap = bitMap;
142 OOP_DoMethod(hiddGfx, (OOP_Msg) &p);
144 /***************************************************************/