I don't know if it's possible using BMax to draw a white image mask of an image (for example in a shoot'em'up to give some feedback that an enemy is hit). So I've wrote a few lines of code to load in a image that will be converted to a white masked image and finally it works. ;)
Can someone please have a look at it if everthings ok with that code because I'm not very experienced with all that readpixel/writepixel stuff. If there is an easier way to get the same effect it would be nice if you share it with me :-)
Function LoadAnimImageMask:TImage(url:Object,w:Int, h:Int, firstcell:Int, count:Int)
Local img:TImage = LoadAnimImage(url,w,h,firstcell,count,DYNAMICIMAGE|MASKEDIMAGE|FILTEREDIMAGE)
For frame:Int = 0 To count-1
Local pmap:TPixmap = LockImage(img,frame)
For x:Int = 0 To PixmapWidth(pmap)-1
For y:Int = 0 To PixmapHeight(pmap)-1
Local pixel:Int = ReadPixel(pmap,x,y)
If (pixel <> %111111111111111111111111)
WritePixel(pmap,x,y,%11111111111111111111111111111111)
End If
Next
Next
UnlockImage(img,frame)
Next
Return img
End Function
|