Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

Color Blending Help

$
0
0

Hey guys! So I am wanting to blend two ARGB colors together. Now this is for a driver, so I don't have .Net calls, but I write in C#. So the equation I currently have is

byte alpha = (127 / 255);

Alpha being "127"

color1 * (1 - alpha) + color2 * alpha

So I want to blend these colors together but in the form a uint. Like 0xFFFFFF00 is yellow with a Alpha of 255.

And I then lets say I have 0xFF0000FF which is blue with a Alpha of 255. If you blend those two, it would result in the color of Yellow because you have the source alpha at 255. But what would be an equation to blend two colors where they are both in uint form but you have the alpha you want to blend them by? The above equation doesn't work as (127 / 255) is 0. I just found it online and tested it.

Thanks, Matt


Viewing all articles
Browse latest Browse all 31927

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>