If you want to mask of a colour in a texture, use this function:
;--------------------------------------------------------------------- ; This function will mask the passed across RGB of the texture also | ; passed across. Do NOT pass across a value for flag if you only | ; want to mask an exact colour. | ;--------------------------------------------------------------------- ;parameters = texture : the texture you wish to clear alpha information from ; = r1 : the red value to mask ; = g1 : the green value to mask ; = b1 : the blue value to mask ; = tolerance : the tolerance value. If set to 0, then the function will only mask the ; EXACT colours passed across. Higher value will mask values close to the colour. Function texture_mask_colour(texture,r1,g1,b1,tolerance=0) LockBuffer TextureBuffer(texture) For loop=0 To TextureWidth(texture) For loop1=0 To TextureHeight(texture) RGB1=ReadPixelFast(loop,loop1,TextureBuffer(texture)) ; read the RGB value from the texture r=(RGB1 And $FF0000)shr 16;separate out the red g=(RGB1 And $FF00) shr 8;green b=RGB1 And $FF;and blue parts of the color a=(RGB1 And $FF000000)Shr 24 ; extract the alpha If r>=r1-tolerance And r=<r1+tolerance And g=>g1-tolerance And g=<g1+tolerance And b=>b1-tolerance And b=<b1+tolerance Then; check RGB lies with the tolerance ;temp=((Abs(r-r1)+Abs(g-g1)+Abs(b-b1))/3.0)*4.0 ; alpha the values based on the tolerance value a=0;temp End If newrgb= (a shl 24) or (r shl 16) or (g shl 8) or b ; combine the ARGB back into one value WritePixelFast(loop,loop1,newrgb,TextureBuffer(texture)); write back to the texture Next Next UnlockBuffer TextureBuffer(texture) End Function