public void CompressLuminance()
{
double max = Math.Max(Math.Max(Component1, Component2), Component3);
if (max > 1.0)
{
Component1 /= max;
Component2 /= max;
Component3 /= max;
}
}
private static void GenerateXyYPlane(Bitmap bitmap, double bigY) { for (int y = 0; y < bitmap.Height; y++) { for (int x = 0; x < bitmap.Width; x++) { double cx = (x + 0.5) / bitmap.Width; double cy = (y + 0.5) / bitmap.Height; ColorVector colorVector = new ColorVector(cx, cy, bigY); colorVector.ConvertXyyToLinearSRgb(); colorVector.CompressLuminance(); colorVector.ConvertLinearSRgbToSRgb(); bitmap.SetPixel(x, bitmap.Height - 1 - y, colorVector.ToColor()); } Console.WriteLine(y); } }