public YCbCr_Color(int Y, int Cb, int Cr) { this.Y = Y; this.Cb = Cb; this.Cr = Cr; Pb = (this.Cb - 128) / 224.0; Pr = (this.Cr - 128) / 224.0; U = Pb / x; V = Pr / y; Y_Apostrophe = (this.Y - 16) / 219.0; //LinearGammaCorrected_Red = V + this.Y_Apostrophe; //LinearGammaCorrected_Blue = U + this.Y_Apostrophe; //LinearGammaCorrected_Green = (Y_Apostrophe - 0.299 * LinearGammaCorrected_Red - 0.114 * LinearGammaCorrected_Blue) / 0.587; LinearGammaCorrected_Red = Y_Apostrophe + 1.403 * Pr; LinearGammaCorrected_Blue = Y_Apostrophe + 1.770 * Pb; LinearGammaCorrected_Green = Y_Apostrophe - 0.344 * Pb - 0.714 * Pr; A = 255; R = Math.Min(Math.Max(BaseExtensions.GetComponentValue(LinearGammaCorrected_Red), 0), 255); G = Math.Min(Math.Max(BaseExtensions.GetComponentValue(LinearGammaCorrected_Green), 0), 255); B = Math.Min(Math.Max(BaseExtensions.GetComponentValue(LinearGammaCorrected_Blue), 0), 255); color = Color.FromArgb(A, R, G, B); }
public CMY_Color(int C, int M, int Y) { this.C = C; this.M = M; this.Y = Y; A = 255; R = BaseExtensions.GetComponentValue(1 - GrayCalculatorExtensions.GetNonLinearGammaCorrectedValue(C)); G = BaseExtensions.GetComponentValue(1 - GrayCalculatorExtensions.GetNonLinearGammaCorrectedValue(M)); B = BaseExtensions.GetComponentValue(1 - GrayCalculatorExtensions.GetNonLinearGammaCorrectedValue(Y)); color = Color.FromArgb(A, R, G, B); }
public CMY_Color(Color color) { A = color.A; R = color.R; G = color.G; B = color.B; this.color = color; C = BaseExtensions.GetComponentValue(1 - GrayCalculatorExtensions.GetNonLinearGammaCorrectedValue(R)); M = BaseExtensions.GetComponentValue(1 - GrayCalculatorExtensions.GetNonLinearGammaCorrectedValue(G)); Y = BaseExtensions.GetComponentValue(1 - GrayCalculatorExtensions.GetNonLinearGammaCorrectedValue(B)); }