home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 1: Amiga
/
FrozenFish-Apr94.iso
/
bbs
/
alib
/
d6xx
/
d634
/
apig.lha
/
APIG
/
apig33.lzh
/
e8_blits.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1991-09-27
|
4KB
|
147 lines
/* Example using the Blt... functions */
/* refer to your favorite Amiga reference for discussion on MINTERMs */
x = addlib("apig.library",0,-30,0)
portname = "example8_port"
p = openport(portname)
call set_apig_globals()
scrtitle = "Hey Buddy, Yea You, This is Your New Screen !"
wintitle = "This is your title"
winidcmp = CLOSEWINDOW+GADGETDOWN+GADGETUP
winflags = WINDOWCLOSE+WINDOWDRAG+WINDOWSIZING+WINDOWDEPTH+GIMMEZEROZERO
scr = openscreen(0,0,640,400,3,4,5,LACE+HIRES,CUSTOMSCREEN,scrtitle)
/* open window */
w1 = openwindow(portname,0,0,640,400,2,4,winidcmp,winflags,wintitle,scr,0,0,0)
rpw1 = getwindowrastport(w1)
windowsbitmap = getrpbitmap(rpw1) /* points to the window rastport bitmap */
bitmap1 = loadiff("bitmap")
bitmap2 = loadiff("bitmap2")
width1 = bmwidth(bitmap1)
height1 = bmheight(bitmap1)
depth1 = bmdepth(bitmap1)
width2 = bmwidth(bitmap2)
height2 = bmheight(bitmap2)
depth2 = bmdepth(bitmap2)
/* --- Bltbitmap --- */
x = bltbitmap(bitmap1,0,0,windowsbitmap,270,60,width1,height1,c2d('00c0'x),15,0)
x = bltbitmap(bitmap2,0,0,windowsbitmap,270,90,width2,height2,c2d('00c0'x),15,0)
z = pitext(rpw1,140,110," You probably didn't notice but ...",0,6,JAM2,0,0)
z = pitext(rpw1,140,121," the above images were 'BLITTED' ",0,6,JAM2,0,0)
z = pitext(rpw1,204,133," using BLTBITMAP() ",0,6,JAM2,0,0)
wait 2 secs
/* --- Bltbitmaprastport --- */
z = pitext(rpw1,204,145," gonna blit using BLTBITMAPRASTPORT() now ...",0,6,JAM2,0,0)
wait 1 secs
x = bltbitmaprastport(bitmap1,0,0,rpw1,270,200,width1,height1,c2d('00c0'x),15)
x = bltbitmaprastport(bitmap2,0,0,rpw1,270,220,width2,height2,c2d('00c0'x),15)
/* --- blitting through a mask --- */
numbytes = (( width1 * height1 ) / 8) + 8 /* forgot why I added 8 here */
/* suspect just so I had enough mem */
mask = allocmem(numbytes,MEMF_CHIP) /* need chip mem for mask */
do i = 0 to ((numbytes - 8) / 2 ) /* div. by 2, cuz set two bytes at a time */
x = setarray(mask,i,c2d('f00f'x)) /* fill mask mem with 0xf00f */
end
z = pitext(rpw1,204,155," gonna blit using BLTMASKBITMAPRASTPORT() now ...",0,6,JAM2,0,0)
wait 1 sec
/* the minterm in this blit copies thru the mask */
x = bltmaskbitmaprastport(bitmap1,0,0,rpw1,150,155,width1,height1,c2d('00e0'x),mask)
/* the minterm in this blit copies thru the mask and inverts */
x = bltmaskbitmaprastport(bitmap2,0,0,rpw1,99,155,width2,height2,c2d('0020'x),mask)
/* --- Bltpattern --- */
z = pitext(rpw1,204,176," blit using BLTPATTERN ...",0,6,JAM2,0,0)
do i = 0 to ((numbytes-8)/2)
x = setarray(mask,i,c2d('0ff0'x)) /* reusing mask as pattern */
/* pattern must be chipmem */
end
x = setapen(rpw1,2)
x = setbpen(rpw1,3)
x = setdrmd(rpw1,JAM2)
x = bltpattern(rpw1,mask,152,176,200,188,(width1/8))
/* --- Blttemplate --- */
z = pitext(rpw1,204,192," blit using BLTTEMPLATE ...",0,6,JAM2,0,0)
x = blttemplate(mask,0,6,rpw1,152,192,48,12)
/* --- clipblit from one rastport to another --- */
rp2 = makerastport( 300, 220, depth1) /* make offscreen rastport */
do x = 0 to 180 by width1 /* putting multiple copies into rp2 */
do y = 0 to 180 by height1
/* blit the bitmap into rp2 (ie. copy it) */
z = bltbitmaprastport(bitmap1,0,0,rp2,x,y,width1,height1,c2d('00c0'x),15)
end
end
wait 2 secs
z = pitext(rpw1,190,280," <--- This is being done with CLIPBLIT()...",3,2,JAM2,0,0)
z = pitext(rpw1,190,292," with varying minterm values. ",3,2,JAM2,0,0)
do i = 0 to 255 by 16 /* NOW BLIT FROM RP2 TO THE WINDOWS RASTPORT */
z = clipblit(rp2,0,0,rpw1,90,210,99,99,i)
wait 1 sec
end
z = pitext(rpw1,200,315," Im Done ...",1,2,JAM2,0,0)
exitme = 0
do forever
x = waitpkt(portname)
do forever
msg = getpkt(portname)
if msg = '0000 0000'x then leave
class = getarg(msg,0)
if class = CLOSEWINDOW then exitme = 1
x = reply(msg,0)
end
if exitme = 1 then leave
end
x = freemem(mask,numbytes)
x = freebitmap(bitmap1)
x = freebitmap(bitmap2)
x = freerastport(rp2)
a =closewindow(w1)
a =closescreen(scr)
exit