Drawing only 1 color.

BlitzMax Forums/BlitzMax Beginners Area/Drawing only 1 color.

Polan(Posted 2010) [#1]
We have setmaskcolor, that "delete" 1 color from image. But is there a way to make something like that other way, where we delete every color expect one?
EDIT:
Way to do that without using another picture to mask unwanted out. I want to avoid mass loading (390 images I would like to split in 5, so 1950 images to load. Or 5 large sprite sheets).


Kryzon(Posted 2010) [#2]
Perhaps just inverting the alpha-setting parts of the MaskPixmap function in BRL.Pixmap.mod?

(untested)

Copy this to your gamecode.

Use it like so:

testImage:TImage = LoadImage([...],MASKEDIMAGE)

testImage.PixMaps[0] = MaskPixmap2(testImage.PixMaps[0])

SetBlend MASKBLEND

DrawImage [...]
This is not elegant at all (and it doesn't support animated images, since you need to add a call to MaskPixmap2 at the SetPixmap method in TImage).
Nothing stops you from extending the official modules to add an INVERTMASKEDIMAGE flag, and calling the modified function in the SetPixmap method inside TImage.


ImaginaryHuman(Posted 2010) [#3]
Or use the alpha channel like a 256-color mask and draw the image with MASKBLEND and set a threshold so that the alpha must = a given amount in order to be drawn.