internal static IRgb ToColor(IHunterLab item) { var x = (item.A / 17.5) * (item.L / 10.0); var y = Math.Pow(item.L / 10.0, 2); var z = item.B / 7.0 * item.L / 10.0; var xyz = new Xyz { X = (x + y) / 1.02, Y = y, Z = -(z - y) / .847 }; return(xyz.To <Rgb>()); }
internal static IRgb ToColor(IHunterLab item) { var x = (item.A / 17.5) * (item.L / 10.0); var itemL_10 = item.L / 10.0; var y = itemL_10 * itemL_10; var z = item.B / 7.0 * item.L / 10.0; var xyz = new Xyz { X = (x + y) / 1.02, Y = y, Z = -(z - y) / .847 }; return xyz.To<Rgb>(); }
internal void XYZtoRGB() { for (int y = 0; y < Height; ++y) { for (int x = 0; x < Width; ++x) { double X = Bitplane[2].GetPixel(x, y); double Y = Bitplane[1].GetPixel(x, y); double Z = Bitplane[0].GetPixel(x, y); Xyz myXYZ = new Xyz(X, Y, Z); Rgb myRGB = myXYZ.To <Rgb>(); Bitplane[2].SetPixel(x, y, myRGB.R); Bitplane[1].SetPixel(x, y, myRGB.G); Bitplane[0].SetPixel(x, y, myRGB.B); } } }