为使用 ICC 配置文件的颜色转换编写了一个小测试。转换功能的工作速度要慢 1,000 倍!
有什么问题?
Uri iccUri = new Uri("C:\\temp\\AdobeRGB1998.icc");
private Color AdobeColor(int r, int g, int b)
{
float[] colorValues = new float[3];
colorValues[0] = (float)r / 255.0f;
colorValues[1] = (float)g/255.0f;
colorValues[2] = (float)b/255.0f;
return Color.FromValues(colorValues,iccUri);
}
public void Test()
{
Stopwatch sw = new Stopwatch();
sw.Start();
for (int n = 0; n < 10; n++)
{
Color a = AdobeColor(n, n, n);//very very slow
//Color a = Color.FromRgb((byte)n, (byte)n, (byte)n);//very fast
}
sw.Stop();
TimeSpan ts;
ts = sw.Elapsed;
Console.WriteLine("result: {0}\n", ts.Seconds);
}