Page 1 of 1

Would adding alpha to standard colors cause problems?

Posted: Fri Jul 26, 2024 10:24 pm
by jacdelad
Hello,
I'm currently working partly with the 2D library and partly with the vector library. The vector library expects colors with an alpha channel; the 2D library can make use of them, but not always. Without opening a discussion about the alpha channel and such: Would it cause problems if the build in colors, like #Red/#Blue/#White..., would already contain the alphachannel (set to opaque, so red would be #Red|$FF000000 and so on)? I mean, could this cause havoc on other libraries (like the console, which doesn't use alpha at all)?

Re: Would adding alpha to standard colors cause problems?

Posted: Sat Jul 27, 2024 1:35 am
by idle
if a function wants a 24 bit color it will ignore the alpha channel so no harm in adding the alpha
though there might still be a layout different between Linux and Windows BGRA vs RGBA

So you could define cross platform constants as

Code: Select all

#RedAlpha = #Red | (255<<24)
Debug Hex(#Red) 
Debug Hex(#redA) 


it shouldn't effect have any negative effects then

Re: Would adding alpha to standard colors cause problems?

Posted: Sat Jul 27, 2024 2:59 am
by jacdelad
Ah ok. So asking to change build in constants into alpha channel containing ones could make sense? I regularly stumble against the problem of forgetting the alpha channel when using the vector library.

Re: Would adding alpha to standard colors cause problems?

Posted: Sat Jul 27, 2024 3:23 am
by idle
Yes it wouldn't hurt though I can't remember if the color constants are defined in Linux.