It took 5 minutes(still better than 20-60). Ric's rounding function greatly reduces time to finish, but doesn't work.
Here's the code for anyone who wants it:
`Remed out rounding function by Ric(modified version of Mentor's code).
`Memblock functions by Benjamin.
sync on : sync rate 0
load bitmap "HM.bmp",1
`load image "BM.bmp",3
wl=64
qv as float
qv=12
sundir=3
make memblock from bitmap 1,1
make memblock from bitmap 2,1
set current bitmap 0
MEM_setup(1,bitmap width(1),bitmap height(1),4,2)
MEM_setup(1,bitmap width(1),bitmap height(1),4,1)
time=timer()
for x=0 to bitmap width(1)-1
for y=0 to bitmap height(1)-1
c=MEM_point(x,y)
a=(rgbr(c)+rgbg(c)+rgbb(c))/3
MEM_dotRGB(x,y,a,a,a)
next y
next x
copy memblock 1,2,0,0,get memblock size(1)
for x=0 to bitmap width(1)-1
for y=0 to bitmap height(1)-1
c=MEM_point(x,y)
h=rgbr(c)
q=round(h/qv)
q2=q*qv
wld=h-wl
if wld>255 then wld=255
if wld<1 then wld=1
rr=(128/wld)
rg=(64/wld)
c=rgb(rr*h,rg*h,0)
if q2<(wl+(qv*2)) then c=rgb(0,155,0)
if q2<(wl+qv) then c=rgb(0,255,0)
if q2<wl then c=rgb(0,0,255)
if q2<(wl-qv) then c=rgb(0,0,155)
MEM_dot(x,y,c)
next y
next x
if sunpos=1 then sx=-1 : sy=-1
if sunpos=2 then sx=0 : sy=-1
if sunpos=3 then sx=1 : sy=-1
if sunpos=4 then sx=1 : sy=0
if sunpos=5 then sx=1 : sy=1
if sunpos=6 then sx=0 : sy=1
if sunpos=7 then sx=-1 : sy=1
if sunpos=8 then sx=-1 : sy=0
for x=0 to bitmap width(1)-1
for y=0 to bitmap height(1)-1
MEM_setup(2,bitmap width(1),bitmap height(1),4,1)
c=MEM_point(x,y)
c2=MEM_point(x+sx,y+sy)
if c>c2 then d=c-c2 else d=0
MEM_setup(1,bitmap width(1),bitmap height(1),4,2)
MEM_setup(1,bitmap width(1),bitmap height(1),4,1)
c3=MEM_point(x,y)
if rgbr(c3)-d<0 then r=0 else r=rgbr(c3)-d
if rgbg(c3)-d<0 then g=0 else g=rgbg(c3)-d
if rgbb(c3)-d<0 then b=0 else b=rgbb(c3)-d
MEM_dotRGB(x,y,r,g,b)
next y
next x
make image from memblock 1,1
delete memblock 1
delete memblock 2
save image "HM_output.bmp",1
`load sound "done.wav",1
`play sound 1
`wait 1000
newtime=timer()-time
set current bitmap 0
text 0,100,str$(newtime)
sync
wait key
end
`function round(num#)
`num$=str$(num#)
`le=len(num$)
`do
`t=t+1
`if t>le then exitfunction int(num#)
`if mid$(num$,t)="." then exit
`loop
`t#=t+0.0
`number#=number#*(10^t#)
`number#=number#+0.5
`number#=int(number#)
`number#=number#/(10^t#)
`out=int(number#)
`endfunction out
function round(num#)
num$=str$(num#)
le=len(num$)
do
t=t+1
if t>le then exitfunction int(num#)
if mid$(num$,t)="." then exit
loop
for x=1 to t-2
out$=out$+mid$(num$,x)
next x
if val(mid$(num$,t+1))<5 then out$=out$+mid$(num$,t-1) else out$=out$+str$(val(mid$(num$,t-1))+1)
out=val(out$)
endfunction out
`Memblock functions removed
Quote: "I've seen the word programming and I'm not sure what it means. Anybody please explain?"
Quote: "We shouldn't sacrifice the truth to preserve "balance"."