示例#1
0
        public static Profile CreateAbstract(int nLUTPoints,
                                             double Exposure,
                                             double Bright,
                                             double Contrast,
                                             double Hue,
                                             double Saturation,
                                             ToneCurve [] tables,
                                             ColorCIExyY srcWp,
                                             ColorCIExyY destWp)
        {
            if (tables == null)
            {
                ToneCurve gamma = new ToneCurve(Math.Pow(10, -Bright / 100));
                ToneCurve line  = new ToneCurve(1.0);
                tables = new ToneCurve [] { gamma, line, line };
            }

            /*
             * System.Console.WriteLine ("e {0}", Exposure);
             * System.Console.WriteLine ("b {0}", Bright);
             * System.Console.WriteLine ("c {0}", Contrast);
             * System.Console.WriteLine ("h {0}", Hue);
             * System.Console.WriteLine ("s {0} {1} {2}", Saturation, srcWp, destWp);
             */
            return(new Profile(NativeMethods.FCmsCreateBCHSWabstractProfile(nLUTPoints,
                                                                            Exposure,
                                                                            0.0,  //Bright,
                                                                            Contrast,
                                                                            Hue,
                                                                            Saturation,
                                                                            ref srcWp,
                                                                            ref destWp,
                                                                            CopyHandles(tables))));
        }
示例#2
0
        public static Profile CreateGray(ColorCIExyY whitePoint, ToneCurve transfer)
        {
            if (transfer == null)
            {
                return(new Profile(NativeMethods.CmsCreateGrayProfile(ref whitePoint, new ToneCurve(2.2).Handle)));
            }

            return(new Profile(NativeMethods.CmsCreateGrayProfile(ref whitePoint, transfer.Handle)));
        }
示例#3
0
        public static Profile CreateAlternateRgb()
        {
            // FIXME I'm basing this off the values set in the camera
            // exif data when the adobe profile is selected.  They could
            // easily be off
            var wp        = new ColorCIExyY(.3127, .329, 1.0);
            var primaries = new ColorCIExyYTriple(
                new ColorCIExyY(.64, .33, 1.0),
                new ColorCIExyY(.21, .71, 1.0),
                new ColorCIExyY(.15, .06, 1.0));
            var tc  = new ToneCurve(2.2);
            var tcs = new ToneCurve [] { tc, tc, tc, tc };

            return(new Profile(wp, primaries, tcs));
        }
示例#4
0
        public static Profile CreateAbstract(int nLUTPoints, double Exposure, double Bright, double Contrast, double Hue,
                                             double Saturation, int TempSrc, int TempDest)
        {
#if true
            var gamma  = new ToneCurve(Math.Pow(10, -Bright / 100));
            var line   = new ToneCurve(1.0);
            var tables = new ToneCurve [] { gamma, line, line };
            return(CreateAbstract(nLUTPoints, Exposure, 0.0, Contrast, Hue, Saturation, tables,
                                  ColorCIExyY.WhitePointFromTemperature(TempSrc),
                                  ColorCIExyY.WhitePointFromTemperature(TempDest)));
#else
            GammaTable [] tables = null;
            return(CreateAbstract(nLUTPoints, Exposure, Bright, Contrast, Hue, Saturation, tables,
                                  ColorCIExyY.WhitePointFromTemperature(TempSrc),
                                  ColorCIExyY.WhitePointFromTemperature(TempDest)));
#endif
        }
示例#5
0
 public Profile(ColorCIExyY whitepoint, ColorCIExyYTriple primaries, ToneCurve [] gamma)
 {
     Handle = new HandleRef (this, NativeMethods.CmsCreateRGBProfile (out whitepoint, out primaries, CopyHandles (gamma)));
 }
示例#6
0
 public Profile(IccColorSpace color_space, ToneCurve [] gamma)
 {
     Handle = new HandleRef (this, NativeMethods.CmsCreateLinearizationDeviceLink (color_space, CopyHandles (gamma)));
 }
示例#7
0
        private static HandleRef[] CopyHandles(ToneCurve [] gamma)
        {
            if (gamma == null)
                return null;

            HandleRef [] gamma_handles = new HandleRef [gamma.Length];
            for (int i = 0; i < gamma_handles.Length; i++)
                gamma_handles [i] = gamma [i].Handle;

            return gamma_handles;
        }
示例#8
0
        public static Profile CreateGray(ColorCIExyY whitePoint, ToneCurve transfer)
        {
            if (transfer == null)
                return new Profile (NativeMethods.CmsCreateGrayProfile (ref whitePoint, new ToneCurve (2.2).Handle));

            return new Profile (NativeMethods.CmsCreateGrayProfile (ref whitePoint, transfer.Handle));
        }
示例#9
0
        public static Profile CreateAlternateRgb()
        {
            // FIXME I'm basing this off the values set in the camera
            // exif data when the adobe profile is selected.  They could
            // easily be off
            ColorCIExyY wp = new ColorCIExyY (.3127, .329, 1.0);
            ColorCIExyYTriple primaries = new ColorCIExyYTriple (
                new ColorCIExyY (.64, .33, 1.0),
                new ColorCIExyY (.21, .71, 1.0),
                new ColorCIExyY (.15, .06, 1.0));
            ToneCurve tc = new ToneCurve (2.2);
            ToneCurve [] tcs = new ToneCurve [] { tc, tc, tc, tc};

            return new Profile (wp, primaries, tcs);
        }
示例#10
0
        public static Profile CreateAbstract(int nLUTPoints,
						      double Exposure,
						      double Bright,
						      double Contrast,
						      double Hue,
						      double Saturation,
						      ToneCurve [] tables,
						      ColorCIExyY srcWp,
						      ColorCIExyY destWp)
        {
            if (tables == null) {
                ToneCurve gamma = new ToneCurve (Math.Pow (10, -Bright/100));
                ToneCurve line = new ToneCurve (1.0);
                tables = new ToneCurve [] { gamma, line, line };
            }

            /*
            System.Console.WriteLine ("e {0}", Exposure);
            System.Console.WriteLine ("b {0}", Bright);
            System.Console.WriteLine ("c {0}", Contrast);
            System.Console.WriteLine ("h {0}", Hue);
            System.Console.WriteLine ("s {0} {1} {2}", Saturation, srcWp, destWp);
            */
            return new Profile (NativeMethods.FCmsCreateBCHSWabstractProfile (nLUTPoints,
                                         Exposure,
                                         0.0, //Bright,
                                         Contrast,
                                         Hue,
                                         Saturation,
                                         ref srcWp,
                                         ref destWp,
                                         CopyHandles (tables)));
        }
示例#11
0
        public static Profile CreateAbstract(int nLUTPoints,
						      double Exposure,
						      double Bright,
						      double Contrast,
						      double Hue,
						      double Saturation,
						      int TempSrc,
						      int TempDest)
        {
            #if true
            ToneCurve gamma = new ToneCurve (Math.Pow (10, -Bright/100));
            ToneCurve line = new ToneCurve (1.0);
            ToneCurve [] tables = new ToneCurve [] { gamma, line, line };
            return CreateAbstract (nLUTPoints, Exposure, 0.0, Contrast, Hue, Saturation, tables,
                           ColorCIExyY.WhitePointFromTemperature (TempSrc),
                           ColorCIExyY.WhitePointFromTemperature (TempDest));
            #else
            GammaTable [] tables = null;
            return CreateAbstract (nLUTPoints, Exposure, Bright, Contrast, Hue, Saturation, tables,
                           ColorCIExyY.WhitePointFromTemperature (TempSrc),
                           ColorCIExyY.WhitePointFromTemperature (TempDest));
            #endif
        }