2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
7 #include <intuition/intuition.h>
8 #include <graphics/gfx.h>
9 #include <cybergraphx/cybergraphics.h>
10 #include <proto/exec.h>
11 #include <proto/dos.h>
12 #include <proto/graphics.h>
13 #include <proto/cybergraphics.h>
14 #include <proto/intuition.h>
20 #define SCREENWIDTH 300
21 #define SCREENHEIGHT 200
22 #define SCREENCY (SCREENHEIGHT / 2)
24 /***********************************************************************************/
26 struct IntuitionBase
*IntuitionBase
;
27 struct GfxBase
*GfxBase
;
28 struct Library
*CyberGfxBase
;
33 UBYTE buf
[SCREENWIDTH
* SCREENHEIGHT
];
35 /***********************************************************************************/
37 static void cleanup(char *msg
)
41 printf("BltTemplateAlpha: %s\n",msg
);
44 if (win
) CloseWindow(win
);
46 if (scr
) UnlockPubScreen(0, scr
);
48 if (CyberGfxBase
) CloseLibrary(CyberGfxBase
);
49 if (GfxBase
) CloseLibrary((struct Library
*)GfxBase
);
50 if (IntuitionBase
) CloseLibrary((struct Library
*)IntuitionBase
);
55 /***********************************************************************************/
57 static void openlibs(void)
59 if (!(IntuitionBase
= (struct IntuitionBase
*)OpenLibrary("intuition.library", 39)))
61 cleanup("Can't open intuition.library V39!");
64 if (!(GfxBase
= (struct GfxBase
*)OpenLibrary("graphics.library", 39)))
66 cleanup("Can't open graphics.library V39!");
69 if (!(CyberGfxBase
= OpenLibrary("cybergraphics.library",0)))
71 cleanup("Can't open cybergraphics.library!");
75 /***********************************************************************************/
77 static void getvisual(void)
79 if (!(scr
= LockPubScreen(NULL
)))
81 cleanup("Can't lock pub screen!");
84 if (GetBitMapAttr(scr
->RastPort
.BitMap
, BMA_DEPTH
) <= 8)
86 cleanup("Need hi or true color screen!");
90 /***********************************************************************************/
92 static void makewin(void)
94 win
= OpenWindowTags(NULL
, WA_CustomScreen
, (IPTR
)scr
,
95 WA_InnerWidth
, SCREENWIDTH
,
96 WA_InnerHeight
, SCREENHEIGHT
,
97 WA_Title
, (IPTR
)"BltTemplateAlpha: Moving mouse is useless!",
99 WA_DepthGadget
, TRUE
,
100 WA_CloseGadget
, TRUE
,
102 WA_IDCMP
, IDCMP_CLOSEWINDOW
,
103 WA_BackFill
, (IPTR
) LAYERS_NOBACKFILL
,
106 if (!win
) cleanup("Can't open window");
112 /***********************************************************************************/
115 #define KC_RIGHT 0x4E
120 /***********************************************************************************/
122 /***********************************************************************************/
124 static void action(void)
127 for(y
= 0; y
< SCREENHEIGHT
; y
++)
129 for(x
= 0; x
< SCREENWIDTH
; x
++)
131 buf
[y
* SCREENWIDTH
+ x
] = (y
+ x
) & 255;
135 SetABPenDrMd(rp
, 1, 2, JAM1
);
137 BltTemplateAlpha(buf
, 0, SCREENWIDTH
, rp
, win
->BorderLeft
, win
->BorderTop
, SCREENWIDTH
, SCREENHEIGHT
);
140 WaitPort(win
->UserPort
);
143 /***********************************************************************************/
156 /***********************************************************************************/