Function do_mask(texture,maskr=0,maskg=0,maskb=0) maskcol=(maskr Shl 16)+(maskg Shl 8)+maskb LockBuffer TextureBuffer(texture) For x=0 To TextureWidth(texture)-1 For y=0 To TextureWidth(texture)-1 pix=ReadPixelFast(x,y) If (pix And $FFFFFF)=maskcol WritePixelFast x,y,(pix Or $FF000000) Else WritePixelFast x,y,0 Next Next UnlockBuffer TextureBuffer(texture) End Function
Another alternative -
create texture, draw to it, then send it to the above function specifying the (r,g,b) value you want to be c-thru
(defaults to black 0,0,0)