2 Copyright © 1998, The AROS Development Team. All rights reserved.
5 Desc: Test for graphics.hidd
9 /*****************************************************************************
17 BitMapNewDispose HIDD/K,WIDTH/N/K,HEIGHT/N/K,DEPTH/N/K,CHUNKY/S/,DISPLAYABLE=DP/S
25 Creates a bitmap, prints the attributes of the bitmap and dispose
29 HIDD - name of the hidd to use e.g. "graphics-X11.hidd"
30 (default: graphics.hidd)
31 WIDTH - width of bitmap (default: 320)
32 HEIGHT - height of bitmap (default: 200)
33 DEPTH - depth of bitmap (default: 8)
34 CHUNKY - create bitmap in chunky-mode (default: planar)
35 DISPLAYABLE - show bitmap (default: FALSE)
38 RETURN_OK - hidd works
39 RETURN_ERROR - hidd produce errors
40 RETURN_FAIL - could not test hidd i.e. OpenLibrary() fails
54 ******************************************************************************/
62 #include <aros/config.h>
64 #include <exec/types.h>
66 #include <proto/exec.h>
67 #include <proto/dos.h>
68 #include <proto/oop.h>
69 #include <proto/utility.h>
71 #include <utility/tagitem.h>
73 #include <dos/rdargs.h>
76 #include <hidd/graphics.h>
78 #include "gfxhiddtool.h"
83 #include <aros/debug.h>
85 struct DosLibrary
*DOSBase
;
86 struct Library
*OOPBase
;
87 struct Library
*HIDDGraphicsBase
;
89 struct ght_OpenLibs LibsArray
[] =
91 GHT_LIB("dos.library" , 37, &DOSBase
),
92 GHT_LIB(AROSOOP_NAME
, 0, &OOPBase
),
93 GHT_LIB(NULL
, 0, NULL
)
95 /***************************************************************/
97 int main(int argc
, char **argv
)
99 ULONG ret
= RETURN_FAIL
;
101 OOP_AttrBase HiddGfxAttrBase
;
102 OOP_AttrBase HiddBitMapAttrBase
;
107 STRPTR hiddName
= "graphics.hidd";
111 ULONG format
= vHidd_BitMap_Format_Planar
;
123 struct Args args
= {hiddName
, &width
, &height
, &depth
, 0, 0};
126 if(ght_OpenLibs(LibsArray
))
128 rda
= ReadArgs("HIDD/K,WIDTH/N/K,HEIGHT/N/K,DEPTH/N/K,CHUNKY/S,DISPLAYABLE=DP/S", (IPTR
*)&args
, NULL
);
131 if(args
.chunky
!= 0) format
= vHidd_BitMap_Format_Chunky
;
132 if(args
.displayable
!= 0) args
.displayable
= (ULONG
) TRUE
;
134 HIDDGraphicsBase
= OpenLibrary(args
.hiddName
, 0);
138 HiddGfxAttrBase
= OOP_ObtainAttrBase(IID_Hidd_Gfx
);
139 HiddBitMapAttrBase
= OOP_ObtainAttrBase(IID_Hidd_BitMap
);
141 if(HiddGfxAttrBase
&& HiddBitMapAttrBase
)
143 gfxHidd
= OOP_NewObject(NULL
, args
.hiddName
, NULL
);
146 struct TagItem bm_tags
[] =
148 {aHidd_BitMap_Width
, (IPTR
) *args
.width
},
149 {aHidd_BitMap_Height
, (IPTR
) *args
.height
},
150 {aHidd_BitMap_Depth
, (IPTR
) *args
.depth
},
151 {aHidd_BitMap_Format
, (IPTR
) format
},
152 {aHidd_BitMap_Displayable
, (IPTR
) args
.displayable
},
156 bitMap
= HIDD_Gfx_NewBitMap(gfxHidd
, bm_tags
);
159 printf("BitMap created:\n");
160 printf(" width : %li\n", ght_GetAttr(bitMap
, aHidd_BitMap_Width
));
161 printf(" height : %li\n", ght_GetAttr(bitMap
, aHidd_BitMap_Height
));
162 printf(" depth : %li\n", ght_GetAttr(bitMap
, aHidd_BitMap_Depth
));
163 printf(" format : %li\n", ght_GetAttr(bitMap
, aHidd_BitMap_Format
));
164 printf(" displayable: %li\n", ght_GetAttr(bitMap
, aHidd_BitMap_Displayable
));
166 HIDD_Gfx_DisposeBitMap(gfxHidd
, bitMap
);
171 if(gfxHidd
) OOP_DisposeObject(gfxHidd
);
176 } /* if(HiddGfxAttrBase && HiddBitMapAttrBase) */
178 if(HiddBitMapAttrBase
) OOP_ReleaseAttrBase(IID_Hidd_BitMap
);
179 if(HiddGfxAttrBase
) OOP_ReleaseAttrBase(IID_Hidd_Gfx
);
181 CloseLibrary(HIDDGraphicsBase
);
182 } /* if(HIDDGraphicsBase) */
188 PrintFault(IoErr(), "");
189 } /* if (rda != NULL) */
191 } /* if OpenLibs() */
193 ght_CloseLibs(LibsArray
);