MixImages function help

BlitzPlus Forums/BlitzPlus Programming/MixImages function help

Hello, I was re=reading your original code. The following three lines are incorrect, I think:
b1=ImageBuffer(ima1) 
b2=ImageBuffer(ima2) 
bm=ImageBuffer(mix) 


The docs show imagebuffer as a command to use with setbuffer, as in:
Setbuffer Imagebuffer(handle)


From the code
 Function MixImages(mix,ima1,ima2) 
I assume that you are supplying the Function with image handles. Therefore, if I understand the command properly, the proper way to use it inside your function would be like this:
;arrays are global, so they will be seen inside your function
Global Const Screen_Width=640
Global Const Screen_Height=480
dim b1array(Screen_Width-1,Screen_Height-1) 
dim b2array(Screen_Width-1,Screen_Height-1)
;arrays are dimensioned minus one, because they start
;counting at 0, ie (0 to 639) x (0 to 479) for 640x480
;
Function MixImages(bm,b1,b2)
;where bm,b1 and b2 are the graphic images handles 
;you are mixing together.
LockBuffer Imagebuffer(b1)
For y=0 To Screen_Height-1 
  For x=0 To Screen_Width-1 
    b1array(x,y)=ReadPixelFast(x,y) 
  Next 
Next 
unLockBuffer Imagebuffer(b1)

LockBuffer Imagebuffer(b2)
For y=0 To Screen_Height-1 
  For x=0 To Screen_Width-1 
    b2array(x,y)=ReadPixelFast(x,y) 
  Next 
Next 
unLockBuffer Imagebuffer(b2)
 
LockBuffer Imagebuffer(bm)
For y=0 To Screen_Height-1 
  For x=0 To Screen_Width-1 
    WritePixelFast x,y,(b1array(x,y) OR b2array(x,y)) 
  Next 
Next 
unLockBuffer Imagebuffer(bm)
End Function