3 #include <intuition/intuition.h>
4 #include <graphics/gfx.h>
5 #include <cybergraphx/cybergraphics.h>
6 #include <proto/exec.h>
8 #include <proto/graphics.h>
9 #include <proto/cybergraphics.h>
10 #include <proto/intuition.h>
16 #define SCREENWIDTH 300
17 #define SCREENHEIGHT 200
18 #define SCREENCY (SCREENHEIGHT / 2)
20 /***********************************************************************************/
22 struct IntuitionBase
*IntuitionBase
;
23 struct GfxBase
*GfxBase
;
24 struct Library
*CyberGfxBase
;
29 UBYTE buf
[SCREENWIDTH
* SCREENHEIGHT
];
31 /***********************************************************************************/
33 static void cleanup(char *msg
)
37 printf("BltTemplateAlpha: %s\n",msg
);
40 if (win
) CloseWindow(win
);
42 if (scr
) UnlockPubScreen(0, scr
);
44 if (CyberGfxBase
) CloseLibrary(CyberGfxBase
);
45 if (GfxBase
) CloseLibrary((struct Library
*)GfxBase
);
46 if (IntuitionBase
) CloseLibrary((struct Library
*)IntuitionBase
);
51 /***********************************************************************************/
53 static void openlibs(void)
55 if (!(IntuitionBase
= (struct IntuitionBase
*)OpenLibrary("intuition.library", 39)))
57 cleanup("Can't open intuition.library V39!");
60 if (!(GfxBase
= (struct GfxBase
*)OpenLibrary("graphics.library", 39)))
62 cleanup("Can't open graphics.library V39!");
65 if (!(CyberGfxBase
= OpenLibrary("cybergraphics.library",0)))
67 cleanup("Can't open cybergraphics.library!");
71 /***********************************************************************************/
73 static void getvisual(void)
75 if (!(scr
= LockPubScreen(NULL
)))
77 cleanup("Can't lock pub screen!");
80 if (GetBitMapAttr(scr
->RastPort
.BitMap
, BMA_DEPTH
) <= 8)
82 cleanup("Need hi or true color screen!");
86 /***********************************************************************************/
88 static void makewin(void)
90 win
= OpenWindowTags(NULL
, WA_CustomScreen
, (IPTR
)scr
,
91 WA_InnerWidth
, SCREENWIDTH
,
92 WA_InnerHeight
, SCREENHEIGHT
,
93 WA_Title
, (IPTR
)"BltTemplateAlpha: Moving mouse is useless!",
95 WA_DepthGadget
, TRUE
,
96 WA_CloseGadget
, TRUE
,
98 WA_IDCMP
, IDCMP_CLOSEWINDOW
,
99 WA_BackFill
, (IPTR
) LAYERS_NOBACKFILL
,
102 if (!win
) cleanup("Can't open window");
108 /***********************************************************************************/
111 #define KC_RIGHT 0x4E
116 /***********************************************************************************/
118 /***********************************************************************************/
120 static void action(void)
123 for(y
= 0; y
< SCREENHEIGHT
; y
++)
125 for(x
= 0; x
< SCREENWIDTH
; x
++)
127 buf
[y
* SCREENWIDTH
+ x
] = (y
+ x
) & 255;
131 SetABPenDrMd(rp
, 1, 2, JAM1
);
133 BltTemplateAlpha(buf
, 0, SCREENWIDTH
, rp
, win
->BorderLeft
, win
->BorderTop
, SCREENWIDTH
, SCREENHEIGHT
);
136 WaitPort(win
->UserPort
);
139 /***********************************************************************************/
152 /***********************************************************************************/