QB64 Phoenix Edition
How to Color Mask? - Printable Version

+- QB64 Phoenix Edition (https://qb64phoenix.com/forum)
+-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1)
+--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3)
+---- Forum: Help Me! (https://qb64phoenix.com/forum/forumdisplay.php?fid=10)
+---- Thread: How to Color Mask? (/showthread.php?tid=3315)



How to Color Mask? - James D Jarvis - 12-24-2024

So how do we make color masks with the "newer" commands?   The old put and get method makes sense but I am clueless as to how to get it to work with _putimage. 

Alpha blending????  How's the color not overwrite the black pixels? Help!

Code: (Select All)
'How to mask?
a$ = Space$(4 + 100)
b$ = Space$(4 + 100)
i& = _NewImage(10, 10, 256)
i2& = _NewImage(10, 10, 256)

Screen 13
Locate 1, 1: Print "Base image"
Line (40, 40)-(49, 49), 15, B
Get (40, 40)-(49, 49), a$
_PutImage (0, 0)-(9, 9), 0, i&, (40, 40)-(49, 49)
Sleep
Locate 1, 1: Print "Color Mask"
Line (40, 40)-(49, 49), 12, BF
Get (40, 40)-(49, 49), b$
_PutImage (0, 0)-(9, 9), 0, i2&, (40, 40)-(49, 49)
Sleep
Cls
_PrintString (10, 10), "Put & And "
Put (200, 10), a$, PSet
Put (200, 10), b$, And
_PrintString (10, 50), "_Putimage & And "

_PutImage (200, 50), i&
Put (200, 50), b$, And

_PrintString (10, 100), "_Putimage & _Putimage "
_PutImage (200, 100), i&
_PutImage (200, 100), i2&
_PrintString (10, 150), "So how do you do a color mask"
_PrintString (10, 159), " with _putimage?"