Exemplo n.º 1
0
        public void AdobeRGB1998IsRGB()
        {
            var icc = Path.Combine(PathToImages, "AdobeRGB1998.icc");

            var colorspace = SKColorSpace.CreateIcc(File.ReadAllBytes(icc));

            Assert.Equal(SKNamedGamma.TwoDotTwoCurve, colorspace.NamedGamma);
            Assert.Equal(SKColorSpaceType.Rgb, colorspace.Type);

            var fnValues = new[] { 2.2f, 1f, 0f, 0f, 0f, 0f, 0f };

            Assert.True(colorspace.GetNumericalTransferFunction(out var fn));
            Assert.Equal(fnValues, fn.Values);

            var toXYZ = new[]
            {
                0.60974f, 0.20528f, 0.14919f, 0f,
                0.31111f, 0.62567f, 0.06322f, 0f,
                0.01947f, 0.06087f, 0.74457f, 0f,
                0f, 0f, 0f, 1f,
            };

            AssertMatrix(toXYZ, colorspace.ToXyzD50());

            var fromXYZ = new[]
            {
                1.96253f, -0.61068f, -0.34137f, 0f,
                -0.97876f, 1.91615f, 0.03342f, 0f,
                0.02869f, -0.14067f, 1.34926f, 0f,
                0f, 0f, 0f, 1f,
            };

            AssertMatrix(fromXYZ, colorspace.FromXyzD50());
        }
Exemplo n.º 2
0
 public SKColorSpace GetSKColorSpace()
 {
     if (skColorSpace == null)
     {
         skColorSpace = SKColorSpace.CreateIcc(Profile.GetBody(true).ToByteArray());
         xyzD50       = skColorSpace.FromXyzD50();
         skColorSpace.GetNumericalTransferFunction(out var spaceTransfer);
         transfer = spaceTransfer.Invert();
     }
     return(skColorSpace);
 }
Exemplo n.º 3
0
 public SKColorSpace GetSKColorSpace()
 {
     if (skColorSpace == null)
     {
         skColorSpace = SKColorSpace.CreateIcc(Profile.GetBody(true).GetBuffer());
         if (skColorSpace != null)
         {
             skColorSpace.GetNumericalTransferFunction(out var spaceTransfer);
             transfer = spaceTransfer.Invert();
         }
     }
     return(skColorSpace);
 }
Exemplo n.º 4
0
        public void USWebCoatedSWOPIsUnsupportedCMYK()
        {
            var path = Path.Combine(PathToImages, "USWebCoatedSWOP.icc");
            var data = File.ReadAllBytes(path);

            var icc = SKColorSpaceIccProfile.Create(data);

            Assert.NotNull(icc);

            var colorspace = SKColorSpace.CreateIcc(icc);

            Assert.Null(colorspace);
        }
Exemplo n.º 5
0
        public void USWebCoatedSWOPIsCMYK()
        {
            var icc = Path.Combine(PathToImages, "USWebCoatedSWOP.icc");

            var colorspace = SKColorSpace.CreateIcc(File.ReadAllBytes(icc));

            Assert.Equal(SKNamedGamma.NonStandard, colorspace.NamedGamma);
            Assert.Equal(SKColorSpaceType.Cmyk, colorspace.Type);

            var fnValues = new[] { 0f, 0f, 0f, 0f, 0f, 0f, 0f };

            Assert.False(colorspace.GetNumericalTransferFunction(out var fn));
            Assert.Equal(fnValues, fn.Values);

            Assert.Null(colorspace.ToXyzD50());
        }