Maskimage for textures?

Blitz3D Forums/Blitz3D Programming/Maskimage for textures?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

you can write your own texture masking function easily.

eg:
function MaskTexture(tex,r,g,b)
 setbuffer texturebuffer(tex)
 lockbuffer()
 for j=0 to textureheight(tex)-1
  for i=0 to texturewidth(tex)-1
   rgb=readpixelfast(i,j) and $FFFFFF
   r2=rgb shr 16
   g2=(rgb shr 8) and $FF
   b2=rgb and $FF
   if (r=r2) and (g=g2) and (b=b2)
    alpha=0
   else
    alpha=$FF ;(=255)
   endif
   writepixelfast i,j,(alpha shl 24) or rgb
  next
 next
 unlockbuffer()
 setbuffer backbuffer()
end function

(not tested, just out of my head)

of course, instead of checking for exact matching you can also use a color range, or a certain brightness range, or only the blue tone, or whatever.