"Reverse Transparency"
BlitzMax Forums/BlitzMax Beginners Area/"Reverse Transparency"
| ||
Hello, I was wondering if BlitzMax has a function or if one can be created that makes all of the colors in an image transparent except for one in a sort of "reverse transparency." Any ideas? |
| ||
It has no function for that as far as I know. But you can always code your own... ;) Here's the idea: 1. Mask the image with the color to be excluded 2. Draw the resulting image to a temp one of the same size and with a plain bg color of 255,0,255 for instance. 3. Compare each pixel of the temp image with the original one. If the pixel of the temp image doesn't match 255,0,255 then copy the pixel from the original image over to the temp image. 4. Finally mask the new temp image with 255,0,255 and you have your image. |
| ||
Soemthing like...Local keppColour = $FF0000 Local pixmap:TPixmap = image.Lock(frame, True, True) For Local x=0 Until pixmap.width For Local y=0 Until pixmap.height Local argb = ReadPixel(pixmap, x, y) If argb & $FFFFFF = keepColour WritePixel(pixmap, x, y, argb) Else WritePixel(pixmap, x, y, argb & $FFFFFF) EndIf Next Next?? |
| ||
OT: Grisu, shouldn't your Steve Irwin tribute read "greatest hunter" rather than "greastest"? |
| ||
@Yan: Yepp, something like that I meant... ;) @Luke: Yeah, but I wanted to give my sig a personal touch, i.e. Grisu => Greasy => Greastest. Was lame ok ok. :) |