示例#1
0
        public void Adapt_Xyz_D65_To_D50_Bradford(float x1, float y1, float z1, float x2, float y2, float z2)
        {
            // Arrange
            var input    = new CieXyz(x1, y1, z1);
            var expected = new CieXyz(x2, y2, z2);
            var options  = new ColorSpaceConverterOptions {
                WhitePoint = Illuminants.D50
            };
            var converter = new ColorSpaceConverter(options);

            // Action
            CieXyz actual = converter.Adapt(input, Illuminants.D65);

            // Assert
            Assert.Equal(expected, actual, ColorSpaceComparer);
        }
示例#2
0
        public void Adapt_Lab_D65_To_D50(float l1, float a1, float b1, float l2, float a2, float b2)
        {
            // Arrange
            var input    = new CieLab(l1, a1, b1, Illuminants.D65);
            var expected = new CieLab(l2, a2, b2);
            var options  = new ColorSpaceConverterOptions {
                TargetLabWhitePoint = Illuminants.D50
            };
            var converter = new ColorSpaceConverter(options);

            // Action
            CieLab actual = converter.Adapt(input);

            // Assert
            Assert.Equal(expected, actual, ColorSpaceComparer);
        }
示例#3
0
        public void Adapt_RGB_SRGB_To_WideGamutRGB(float r1, float g1, float b1, float r2, float g2, float b2)
        {
            // Arrange
            var input    = new Rgb(r1, g1, b1, RgbWorkingSpaces.SRgb);
            var expected = new Rgb(r2, g2, b2, RgbWorkingSpaces.WideGamutRgb);
            var options  = new ColorSpaceConverterOptions {
                TargetRgbWorkingSpace = RgbWorkingSpaces.WideGamutRgb
            };
            var converter = new ColorSpaceConverter(options);

            // Action
            Rgb actual = converter.Adapt(input);

            // Assert
            Assert.Equal(expected.WorkingSpace, actual.WorkingSpace, ColorSpaceComparer);
            Assert.Equal(expected, actual, ColorSpaceComparer);
        }
示例#4
0
        public void Adapt_Lab_D50_To_D65(float l1, float a1, float b1, float l2, float a2, float b2)
        {
            // Arrange
            CieLab input                  = new CieLab(l1, a1, b1, Illuminants.D65);
            CieLab expectedOutput         = new CieLab(l2, a2, b2);
            ColorSpaceConverter converter = new ColorSpaceConverter {
                TargetLabWhitePoint = Illuminants.D50
            };

            // Action
            CieLab output = converter.Adapt(input);

            // Assert
            Assert.Equal(expectedOutput.L, output.L, FloatRoundingComparer);
            Assert.Equal(expectedOutput.A, output.A, FloatRoundingComparer);
            Assert.Equal(expectedOutput.B, output.B, FloatRoundingComparer);
        }
示例#5
0
        public void Adapt_CieLch_D65_To_D50_XyzScaling(float l1, float c1, float h1, float l2, float c2, float h2)
        {
            // Arrange
            var input    = new CieLch(l1, c1, h1, Illuminants.D65);
            var expected = new CieLch(l2, c2, h2);
            var options  = new ColorSpaceConverterOptions
            {
                ChromaticAdaptation = new VonKriesChromaticAdaptation(LmsAdaptationMatrix.XyzScaling),
                TargetLabWhitePoint = Illuminants.D50
            };
            var converter = new ColorSpaceConverter(options);

            // Action
            CieLch actual = converter.Adapt(input);

            // Assert
            Assert.Equal(expected, actual, ColorSpaceComparer);
        }
示例#6
0
        public void Adapt_Xyz_D65_To_D50_Bradford(float x1, float y1, float z1, float x2, float y2, float z2)
        {
            // Arrange
            CieXyz input                  = new CieXyz(x1, y1, z1);
            CieXyz expectedOutput         = new CieXyz(x2, y2, z2);
            ColorSpaceConverter converter = new ColorSpaceConverter
            {
                WhitePoint = Illuminants.D50
            };

            // Action
            CieXyz output = converter.Adapt(input, Illuminants.D65);

            // Assert
            Assert.Equal(expectedOutput.X, output.X, FloatRoundingComparer);
            Assert.Equal(expectedOutput.Y, output.Y, FloatRoundingComparer);
            Assert.Equal(expectedOutput.Z, output.Z, FloatRoundingComparer);
        }
示例#7
0
        public void Adapt_RGB_SRGB_To_WideGamutRGB(float r1, float g1, float b1, float r2, float g2, float b2)
        {
            // Arrange
            Rgb input                     = new Rgb(r1, g1, b1, RgbWorkingSpaces.SRgb);
            Rgb expectedOutput            = new Rgb(r2, g2, b2, RgbWorkingSpaces.WideGamutRgb);
            ColorSpaceConverter converter = new ColorSpaceConverter {
                TargetRgbWorkingSpace = RgbWorkingSpaces.WideGamutRgb
            };

            // Action
            Rgb output = converter.Adapt(input);

            // Assert
            Assert.Equal(expectedOutput.WorkingSpace, output.WorkingSpace);
            Assert.Equal(expectedOutput.R, output.R, FloatRoundingComparer);
            Assert.Equal(expectedOutput.G, output.G, FloatRoundingComparer);
            Assert.Equal(expectedOutput.B, output.B, FloatRoundingComparer);
        }
示例#8
0
        public void Adapt_Xyz_D65_To_D50_XyzScaling(float x1, float y1, float z1, float x2, float y2, float z2)
        {
            // Arrange
            var input    = new CieXyz(x1, y1, z1);
            var expected = new CieXyz(x2, y2, z2);
            var options  = new ColorSpaceConverterOptions
            {
                ChromaticAdaptation = new VonKriesChromaticAdaptation(LmsAdaptationMatrix.XyzScaling),
                WhitePoint          = Illuminants.D50
            };

            var converter = new ColorSpaceConverter(options);

            // Action
            CieXyz actual = converter.Adapt(input, Illuminants.D65);

            // Assert
            Assert.Equal(expected, actual, ColorSpaceComparer);
        }
示例#9
0
        public void Adapt_Xyz_D65_To_D50_XyzScaling(float x1, float y1, float z1, float x2, float y2, float z2)
        {
            // Arrange
            CieXyz input                  = new CieXyz(x1, y1, z1);
            CieXyz expectedOutput         = new CieXyz(x2, y2, z2);
            ColorSpaceConverter converter = new ColorSpaceConverter
            {
                ChromaticAdaptation = new VonKriesChromaticAdaptation(LmsAdaptationMatrix.XyzScaling),
                WhitePoint          = Illuminants.D50
            };

            // Action
            CieXyz output = converter.Adapt(input, Illuminants.D65);

            // Assert
            Assert.Equal(expectedOutput.X, output.X, FloatRoundingComparer);
            Assert.Equal(expectedOutput.Y, output.Y, FloatRoundingComparer);
            Assert.Equal(expectedOutput.Z, output.Z, FloatRoundingComparer);
        }
示例#10
0
 internal Rgb ColorSpaceConvert()
 {
     return(ColorSpaceConverter.Adapt(Rgb));
 }
示例#11
0
 public Rgb ColorSpaceConvert()
 {
     return(ColorSpaceConverter.Adapt(Rgb));
 }