Would adding alpha to standard colors cause problems?

Everything else that doesn't fall into one of the other PB categories.
User avatar
jacdelad
Addict
Addict
Posts: 2027
Joined: Wed Feb 03, 2021 12:46 pm
Location: Riesa

Would adding alpha to standard colors cause problems?

Post 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)?
Good morning, that's a nice tnetennba!

PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
User avatar
idle
Always Here
Always Here
Posts: 6019
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: Would adding alpha to standard colors cause problems?

Post 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
User avatar
jacdelad
Addict
Addict
Posts: 2027
Joined: Wed Feb 03, 2021 12:46 pm
Location: Riesa

Re: Would adding alpha to standard colors cause problems?

Post 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.
Good morning, that's a nice tnetennba!

PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
User avatar
idle
Always Here
Always Here
Posts: 6019
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: Would adding alpha to standard colors cause problems?

Post by idle »

Yes it wouldn't hurt though I can't remember if the color constants are defined in Linux.
Post Reply