aUCBLogo Demos and Tests / bitmaptest2
to bitmapTest2
setUpdateGraph false
setps [2 2]
n=10
r=Array n
v=Array n
a=(list .0 -1.)
c=Array n
s=Array n
repeat n
[ i=repcount
r.i=(list 600*rnd-400 400*rnd-300)
v.i=(list 10*(rnd-0.5) 0.0)
c.i=hsb 360*i/n 1 1
ht
cs
setPC c.i
setFC c.i
run pick [frbox fbox frbox circ]
s.i=bitCopy 201 201
bitMakeTransparent s.i rgb 1 1 1
updateGraph
]
disableBlend ;blending really slows things down too much
enableAlphaTest ;comment to make it much faster,
;but without alpha test it's not so nice
forever
[ v=v+a
r=r+v
clean
repeat n
[ i=repcount
if r.i.2 < -300
[ v.i.2= -v.i.2
r.i.2=r.i.2+v.i.2
]
if r.i.1 < -400 or2 r.i.1 > 200
[ v.i.1= -v.i.1
r.i.1=r.i.1+v.i.1
]
pu setPos r.i pd
bitPaste s.i
]
updateGraph
if key? [break]
]
enableBlend
disableAlphaTest
end
to circ
pu rt 45 fd (sqrt 2)*100 pd
fillCircle 100
pu bk (sqrt 2)*100 lt 45 pd
end
to fbox
fillRect [0 0][200 200]
end
to frbox
disableLineSmooth
seth 0
pu rt 45 fd (sqrt 2)*100 lt 45 pd
(rBox 200)
fill
pu lt 135 fd (sqrt 2)*100 lt 135 pd
enableLineSmooth
end