public fakeColor GetFromARGB(fakeColor background) { if (A == 255) { return(new fakeColor(R, G, B)); } var alpha = A / 255.0; var diff = 1.0 - alpha; return(new fakeColor(255, (byte)(R * alpha + background.R * diff), (byte)(G * alpha + background.G * diff), (byte)(B * alpha + background.B * diff))); }
public static fakeColor GetFromARGB(fakeColor background, fakeColor foreground) { if (foreground.A == 255) { return(foreground); } var alpha = foreground.A / 255.0; var diff = 1.0 - alpha; return(new fakeColor(255, (byte)(foreground.R * alpha + background.R * diff), (byte)(foreground.G * alpha + background.G * diff), (byte)(foreground.B * alpha + background.B * diff))); }