06-14-2023, 04:38 AM
I think you're mixing up the behavior of `_SetAlpha` with `Color`. `_SetAlpha` is a command that changes the Current contents of an image at the time you run the command, it does not change anything about what happens to the image after that point, and each pixel of the image has its own alpha value. Thus doing `_SetAlpha 100, 0, S2` only changes the current black pixels to have 100 alpha, it has no impact on any black pixels created after that point (such as the ones from `Print`) and they are free to have any alpha value they want.
When you `Print` on a 32-bit image, the entire RGBA values used for the foreground and background colors come from the current `Color` setting, so any existing alpha value for those pixels will be overridden by those RGBA colors. If you try the below code that adds a `Color` line, I believe you get the behavior you're looking for:
Alternatively, like mnrvovrfc mentioned using _PrintMode is generally an easier way to do this, it allows you to just simply turn off the background color of `Print` all together. If you do that then your usage of `_SetAlpha` will work like you were expecting because `Print` just won't touch the existing black pixels that already have 100 alpha due to `_SetAlpha`.
When you `Print` on a 32-bit image, the entire RGBA values used for the foreground and background colors come from the current `Color` setting, so any existing alpha value for those pixels will be overridden by those RGBA colors. If you try the below code that adds a `Color` line, I believe you get the behavior you're looking for:
Code: (Select All)
Dim Shared S1 As Long, S2 As Long
S1 = _NewImage(1200, 900, 32)
S2 = _NewImage(1200, 300, 32)
_SetAlpha 100, 0, S2
Screen S1
Paint (1, 1), _RGBA32(0, 100, 100, 256)
_Delay 1
_Dest S2
Color , _RGBA32(0, 0, 0, 100) ' Make the background color black with 100 alpha
Print "If you see color back to this text all is ok"
_PutImage (1, 600), S2, S1
Alternatively, like mnrvovrfc mentioned using _PrintMode is generally an easier way to do this, it allows you to just simply turn off the background color of `Print` all together. If you do that then your usage of `_SetAlpha` will work like you were expecting because `Print` just won't touch the existing black pixels that already have 100 alpha due to `_SetAlpha`.