; ID: 1739 ; Author: fredborg ; Date: 2006-06-24 21:11:01 ; Title: LoadMaskedTexture ; Description: Load a masked texture without black borders :) Function LoadMaskedTexture(file$,flags=0,threshold=200) If flags And 2 Then flags = flags Xor 2 If flags And 4 Then flags = flags Xor 4 tex = LoadTexture(file$,flags Or 2) If tex buff = TextureBuffer(tex) width = TextureWidth(tex) - 1 height = TextureHeight(tex) - 1 masktex = CreateTexture(width+1,height+1,flags Or 4) tbuff = TextureBuffer(masktex) amul# = 255.0/(255.0-threshold) LockBuffer buff LockBuffer tbuff For x = 0 To width For y = 0 To height argb = ReadPixelFast(x,y,buff) a = (argb Shr 24) And %11111111 If a