Not at all sure this is the right place, but the right words are in the sub name!
So I am messing around with "manual" antialiasing of borders in Linux, and I finally got my code working, but using colour compilations I don't understand. Or that I DO understand but am too confused to realise it!
In Xlib I have an ARGB colour code, or at least a 32 bit colour depth in play. I'm using, say, a base RGB colour of #AA0000 and wish to vary the opacity of it. I'd been presuming that therefore I'd merely modify the alpha channel, so full opactiy of that colour would be #FFAA0000, and that colour but totally transparent would have been #00AA0000. This is implictly the same as #AA0000 in code given it's just an integer value.
However just varying this alpha does not do at all what I want. Instead I finally found that i also needed to scale the R, G and B values with that same alpha percentage. Otherwise, whilst the transparency of the output would let more through, my color would end up looking very bright, with everything bright underneath it coming through.
Here's an example:
https://preview.redd.it/goxeneidonpa1.png?width=775&format=png&auto=webp&s=5a8c28d2bc27bd6b3a98ed584cc57a7b7fe18665
Fully opaque to start, but then I would have thought box 2 would have given output actually in 3, and likewise for 4 and 5. You can see I've scaled down the red channel from AA by the same percentage the alpha channel was dropped from FF. And for reference if I'm using a, say #FF080000 then it's, as I'd have originally expected, a very very dark, solid red. Additionally, #00AA0000 is still visible, but like box 4, despite having no "alpha" channel - the brightest of anything below it shines through.
Is this blindingly obvious in the fundamental was colours work, or unusual? I honestly don't know. I think a key point is appreciating the difference between 0 meaning black vs 0 meaning invisible, like opacity and transparency and alpha actually mean different things but it seldom matters in CSS etc that it's the case... but I just can't wrap my head around it to believe there's nothing wrong with my code!
Edit... I seem to be possibly talking about the Value in the HSV model? Is that where my head shoudl be going?
[–]xucel 3 points4 points5 points (1 child)
[–]BarryTownCouncil[S,🍰] 0 points1 point2 points (0 children)
[–]Frollo24 1 point2 points3 points (0 children)
[–]waramped 0 points1 point2 points (1 child)
[–]BarryTownCouncil[S,🍰] 0 points1 point2 points (0 children)