9 #include <exec/types.h>
10 #include <graphics/gfxbase.h>
11 #include <intuition/intuition.h>
13 #include <proto/exec.h>
14 #include <proto/intuition.h>
15 #include <proto/graphics.h>
16 #include <iffpragmas.h>
21 struct GfxBase *GfxBase = NULL;
25 0,0,0,0,0,0,0, NULL, CUSTOMSCREEN | SCREENQUIET, NULL, (STRPTR)
"Show3", NULL,
29 struct Screen *
screen[3] = {NULL, NULL, NULL}, *OpenScreen();
31 char *
fname[3] = {NULL, NULL, NULL};
33 void CenterScreen(
register struct Screen *,
int *,
int *);
36 Fail(
char *text,
int status)
40 if(ifffile) CloseIFF(ifffile);
54 printf(
"IffError = %ld\n", i);
59 if(GfxBase) CloseLibrary((
struct Library *)GfxBase);
63 main(
int argc,
char *argv[])
68 struct BitMapHeader *bmhd;
70 if(!strcmp(argv[1],
"?") || ((argc !=4) && (argc != 2))) {
71 printf(
"Usage: %s redfile greenfile bluefile\n"
72 " %s filename (.[rgb] will be appended)\n",
81 fsiz = strlen(argv[1]) + 3;
85 Fail(
"Can't allocate memory", 1);
87 strcpy(
fname[i], argv[1]);
88 strcat(
fname[i], ((i == 0) ?
".r" : ((i == 1) ?
".g" :
".b")));
91 GfxBase = (
struct GfxBase *)OpenLibrary(
"graphics.library",0L);
93 Fail(
"Can't open graphics.library", 1);
97 Fail(
"Can't open intuition.library", 1);
99 if(!(IFFBase = OpenLibrary(IFFNAME,IFFVERSION))) {
100 Fail(
"Copy the iff.library to your LIBS: directory!", 1);
103 for (i=0; i<3; i++) {
104 if(!(ifffile=OpenIFF(fname[i]))){
105 Fail(
"Error opening file", 1);
107 if(!(bmhd=GetBMHD(ifffile))) {
108 Fail(
"BitMapHeader not found", 1);
112 ns.Depth = bmhd->nPlanes;
113 ns.ViewModes = GetViewModes(ifffile);
115 if(!(screen[i] = OpenScreen(&ns))) {
116 Fail(
"Can't open screen!", 1);
118 CenterScreen(
screen[i], &dx, &dy);
120 count = GetColorTab(ifffile,colortable);
121 if(count>32L) count = 32L;
122 LoadRGB4(&(screen[i]->ViewPort),colortable,count);
124 if(!DecodePic(ifffile,&screen[i]->BitMap)) {
125 Fail(
"Can't decode picture", 1);
130 SetTaskPri(FindTask(0L), 20L);
132 if(!((*((UBYTE*)0xbfe001))&64))
break;
134 if(!((*((UBYTE*)0xbfe001))&64))
break;
136 if(!((*((UBYTE*)0xbfe001))&64))
break;
void main(int argc, char **argv)
struct Library * IntuitionBase