I just made a read/write pixel to simulate a translucent sprite drawing but it is incrediblely slow! And if I add Lockbuffer/r/w fastpixel nothing is displayed.
Why? If it worked, would it be really faster?..
----------------------
Graphics(800,600,0,2)
SetBuffer BackBuffer()
bck=LoadImage("picture800x600.jpg",2)
img=LoadImage("sprite200x180.jpg",2)
bck_buf=ImageBuffer(bck)
img_buf=ImageBuffer(img)
While Not KeyHit(1)
x=MouseX()
y=MouseY()
DrawBlock(bck,0,0)
For j=0 To 179
For i=0 To 199
a=ReadPixel(x+i,y+j,bck_buf)
b=ReadPixel(i,j,img_buf)
WritePixel(x+i,y+j,a+b)
Next
Next
Flip()
Wend
FreeImage(bck)
FreeImage(img)
Why? If it worked, would it be really faster?..
----------------------
Graphics(800,600,0,2)
SetBuffer BackBuffer()
bck=LoadImage("picture800x600.jpg",2)
img=LoadImage("sprite200x180.jpg",2)
bck_buf=ImageBuffer(bck)
img_buf=ImageBuffer(img)
While Not KeyHit(1)
x=MouseX()
y=MouseY()
DrawBlock(bck,0,0)
For j=0 To 179
For i=0 To 199
a=ReadPixel(x+i,y+j,bck_buf)
b=ReadPixel(i,j,img_buf)
WritePixel(x+i,y+j,a+b)
Next
Next
Flip()
Wend
FreeImage(bck)
FreeImage(img)