0

I have a base color with an alpha channel. I need to create two separate colors based on this color, so when I mix them together I get the initial color (for example, when I fill the screen with the first color and then the second, I get the initial color).

So far I was being able to calculate just a 50% color. Apparently, taking the alpha channel and dividing it by whatever ratio doesn't work. I came up with the formula for getting a 50% alpha: 1 - sqrt(1 - alpha) (based on this article on Wikipedia https://en.wikipedia.org/wiki/Alpha_compositing). It does work, but I also need to get a 10% alpha or any other percent. I know, there must be a way to calculate it.

serg66
  • 1,148
  • 1
  • 17
  • 31
  • I'm not sure but you can give it a try: `color=(1-alpha)*x + (alpha)*x` – Ami Hollander Jun 30 '16 at 09:34
  • It is additive to my limited knowledge: 0.25*c + 075*c = fully opaque for 25%, 75%. The sole problem laying them on a white background (0.75*1.0 + 0.25*c), (0.25*1.0 + 075*c) and later taking the component value from them. – Joop Eggen Jun 30 '16 at 09:36

0 Answers0