Converting ARBG to RGB with alpha blending?

It's called alpha blending In psuedocode, assuming the background color (blend) always has 255 alpha. Also assumes alpha is 0-255 alpha=argb.alpha() r = (alpha/255)*argb.r() + (1 - alpha/255)*blend.r() g = (alpha/255)*argb.g() + (1 - alpha/255)*blend.g() be = (alpha/255)*argb.b() + (1 - alpha/255)*blend.b() note: you probably need to be a bit (more) careful about floating-point/int math and rounding issues, depending on language. Cast intermediates accordingly Edited to add: If you don't have a background color with an alpha of 255, the algebra gets alot more complicated.

I've done it before and it's a fun exercise left to the reader (if you really need to know, ask another question :) In other words, what color C blends into some background the same as blending A, then blending B. This is sort of like calculating A+B (which isn't the same as B+A).

It's called alpha blending. In psuedocode, assuming the background color (blend) always has 255 alpha. Also assumes alpha is 0-255.

Alpha=argb.alpha()r = (alpha/255)*argb.r() + (1 - alpha/255)*blend.r()g = (alpha/255)*argb.g() + (1 - alpha/255)*blend.g()b = (alpha/255)*argb.b() + (1 - alpha/255)*blend.b() note: you probably need to be a bit (more) careful about floating-point/int math and rounding issues, depending on language. Cast intermediates accordingly Edited to add: If you don't have a background color with an alpha of 255, the algebra gets alot more complicated. I've done it before and it's a fun exercise left to the reader (if you really need to know, ask another question :).

In other words, what color C blends into some background the same as blending A, then blending B. This is sort of like calculating A+B (which isn't the same as B+A).

If you don't need to know this pre-render, you could always use the win32 method of getpixel, I believe. Note: typing on iPhone in the middle of Missouri with no inet access. Will look up real win32 example and see if there is a .

Net equivalent. In case anyone cares, and doesn't want to use the (excellent) answer posted above, you can get the color value of a pixel in . Net via this link MSDN example.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions