コード例 #1
0
ファイル: Colour.cs プロジェクト: Evellex/Eldrinth
        static Colour()
        {
            RGBDefinition sRGB = new RGBDefinition();
            sRGB.r = new Double2(0.64, 0.33);
            sRGB.g = new Double2(0.3, 0.6);
            sRGB.b = new Double2(0.15, 0.06);
            sRGB.w = new Double3(0.3127, 0.329, 1);
            sRGB.gamma = 2.2;
            BuildConversionMatrices(sRGB);
            rgbSpaces.Add(RGBSpace.sRGB, sRGB);

            RGBDefinition AdobeRGB = new RGBDefinition();
            AdobeRGB.r = new Double2(0.64, 0.33);
            AdobeRGB.g = new Double2(0.21, 0.71);
            AdobeRGB.b = new Double2(0.15, 0.06);
            AdobeRGB.w = new Double3(0.3127, 0.329, 1);
            AdobeRGB.gamma = 563.0 / 256.0;
            BuildConversionMatrices(AdobeRGB);
            rgbSpaces.Add(RGBSpace.AdobeRGB, AdobeRGB);
        }
コード例 #2
0
ファイル: Colour.cs プロジェクト: Evellex/Eldrinth
 private static void BuildConversionMatrices(RGBDefinition definition)
 {
     RGBDefinition d = definition;
     Double3 R = new Double3(d.r.x / d.r.y, 1.0, (1.0 - d.r.x - d.r.y) / d.r.y);
     Double3 G = new Double3(d.g.x / d.g.y, 1.0, (1.0 - d.g.x - d.g.y) / d.g.y);
     Double3 B = new Double3(d.b.x / d.b.y, 1.0, (1.0 - d.b.x - d.b.y) / d.b.y);
     Double3 W = new Double3(d.w.x / d.w.y, 1.0, (1.0 - d.w.x - d.w.y) / d.w.y);
     Double3x3 altMat = new Double3x3(R.x, G.x, B.x, R.y, G.y, B.y, R.z, G.z, B.z);
     Double3 s = Double3x3.Inverse(altMat) * W;
     d.toXYZ = new Double3x3(s.x * R.x, s.y * G.x, s.z * B.x, s.x * R.y, s.y * G.y, s.z * B.y, s.x * R.z, s.y * G.z, s.z * B.z);
     d.fromXYZ = Double3x3.Inverse(d.toXYZ);
 }