Pinta.ImageManipulation.ColorBgra.Blend C# (CSharp) Method

Blend() public static method

Smoothly blends between two colors.
public static Blend ( ColorBgra ca, ColorBgra cb, byte cbAlpha ) : ColorBgra
ca ColorBgra
cb ColorBgra
cbAlpha byte
return ColorBgra
		public static ColorBgra Blend (ColorBgra ca, ColorBgra cb, byte cbAlpha)
		{
			uint caA = (uint)Utility.FastScaleByteByByte ((byte)(255 - cbAlpha), ca.A);
			uint cbA = (uint)Utility.FastScaleByteByByte (cbAlpha, cb.A);
			uint cbAT = caA + cbA;

			uint r;
			uint g;
			uint b;

			if (cbAT == 0) {
				r = 0;
				g = 0;
				b = 0;
			} else {
				r = ((ca.R * caA) + (cb.R * cbA)) / cbAT;
				g = ((ca.G * caA) + (cb.G * cbA)) / cbAT;
				b = ((ca.B * caA) + (cb.B * cbA)) / cbAT;
			}

			return ColorBgra.FromBgra ((byte)b, (byte)g, (byte)r, (byte)cbAT);
		}

Same methods

ColorBgra::Blend ( ColorBgra colors, int count ) : ColorBgra