コード例 #1
0
        public static void RegisterCliOptions()
        {
            if (GetInstance()._isRegistered)
            {
                return;
            }

            CliArgs.Register(new List <string> {
                "-leS", "--levels-hsv-saturation"
            }, LevelsHsvSaturation, 5,
                             desc:
                             "Adjusts levels of HSV saturation. Takes five parameters: input black (0..1), input white (0..1), gamma (0.01..9.99), output black (0..1), output white (0..1)");

            CliArgs.Register(new List <string> {
                "-ipc"
            },
                             InvertPerceivedLightnessWithCorrection, 0, 1,
                             paramList: "[=<corr>]",
                             desc: "Inverts perceived brightness with correction parameter.",
                             paramDesc:
                             "<corr> is value between 0..1, 0 is safest conversion, 1 is closest to truth but also causes clipping of some colors.");

            CliArgs.Register(new List <string> {
                "-ilv"
            }, InvertMixedLightnessAndValue, 0, 1,
                             paramList: "=<mix>",
                             desc: "Inverts colors using both lightness and value, by mixing the result by parameter (0..1)",
                             paramDesc: "<mix> is mix parameter 0..1, 0 is full lightness inversion, 1 is full value inversion.");

            CliArgs.Register(new List <string> {
                "-ipm"
            },
                             InvertMixedPerceivedLightnessAndValue, 0, 1,
                             paramList: "=<mix>",
                             desc: "Inverts colors using both lightness and value, by mixing the result by parameter (0..1)",
                             paramDesc: "<mix> is mix parameter 0..1, 0 is full lightness inversion, 1 is full value inversion.");

            CliArgs.Register(new List <string> {
                "-b2l", "--brightness-to-lightness"
            }, BrightnessToLightness, 0, 0,
                             desc: "Translates perceived brightness to lightness."
                             );

            CliArgs.Register(new List <string> {
                "-b2v", "--brightness-to-value"
            }, BrightnessToValue, 0, 0,
                             desc: "Translates perceived brightness to value."
                             );

            CliArgs.Register(new List <string> {
                "-cS", "--contrast-hsv-sat"
            }, ContrastHsvSaturation, 1, 2,
                             paramList: "=<contrast>[,<ip>]",
                             desc:
                             "Applies contrast curve to HSV saturation.",
                             paramDesc:
                             "<contrast> is curvature strength in range of -1..1 (0), <ip> is inflection point in range of 0..1 (0.5)");


            CliArgs.Register(new List <string> {
                "-gaS", "--gamma-hsv-sat"
            }, GammaHsvSaturation, 1,
                             paramList: "=<gamma>",
                             desc: "Adjusts gamma of HSV saturation.",
                             paramDesc: "<gamma> is value in range of 0.01..9.99 (1.0)");


            CliArgs.Register(new List <string> {
                "-S", "--hsv-saturation"
            }, GainHsvSaturation, 1,
                             paramList: "=<value>",
                             desc: "HSV saturation gain.",
                             paramDesc: "<value> is multiplier in range of 0..10 (1.0)");

            CliArgs.Register(new List <string> {
                "--tolight"
            }, ToLight, 0, 0,
                             desc: "A preset with multiple filters to convert dark scheme to light");

            CliArgs.Register(new List <string> {
                "-ipv", "--invert-per-value"
            }, InvertPerceivedValue, 0, 0,
                             desc: "Inverts perceived brightness.");

            // CliArgs.Register(new List<string> {"--bypass"}, ByBass, 0);

            GetInstance()._isRegistered = true;
        }
コード例 #2
0
        public static void RegisterCliOptions()
        {
            if (GetInstance()._isRegistered)
            {
                return;
            }

            CliArgs.Register(new CliArgBuilder()
                             .Filter(ShiftHslHue)
                             .AddOptions("-h", "--hue")
                             .Params(1)
                             .ParamString("=<offset>")
                             .Description("Hue shift.")
                             .ParamDescription("<offset> is hue offset in range of -360..360 (0)")
                             );

            CliArgs.Register(new List <string> {
                "-s", "--saturation"
            }, GainHslSaturation, 1,
                             paramList: "=<gain>",
                             desc: "Saturation gain.",
                             paramDesc: "<gain> is multiplier in range of 0..10 (1.0)");

            CliArgs.Register(new List <string> {
                "-g", "--gain"
            }, GainRgb, 1,
                             paramList: "=<gain>",
                             desc: "RGB gain.",
                             paramDesc: "<gain> is multiplier in range of 0..10 (1.0)");

            CliArgs.Register(new List <string> {
                "-l", "--lightness"
            }, GainLightness, 1,
                             paramList: "=<gain>",
                             desc: "Lightness gain.",
                             paramDesc: "<gain> is multiplier in range of 0..10 (1.0)");

            CliArgs.Register(new List <string> {
                "-v", "--value"
            }, GainValue, 1,
                             paramList: "=<gain>",
                             desc: "Value gain.",
                             paramDesc: "<gain> is multiplier in range of 0..10 (1.0)");

            CliArgs.Register(new List <string> {
                "-c", "--contrast"
            }, ContrastRgb, 1, 2,
                             paramList: "=<contrast>[,<ip>]",
                             desc: "Adjusts contrast by S-spline curve.",
                             paramDesc:
                             "<contrast> is curvature strength in range of -1..1 (0.0), <ip> is inflection point in range of 0..1 (0.5)");

            CliArgs.Register(new List <string> {
                "-cl", "--contrast-lightness"
            }, ContrastLightness, 1, 2,
                             paramList: "=<contrast>[,<ip>]",
                             desc:
                             "Applies contrast curve to lightness.",
                             paramDesc:
                             "<contrast> is curvature strength in range of -1..1 (0), <ip> is inflection point in range of 0..1 (0.5)");

            CliArgs.Register(new List <string> {
                "-cv", "--contrast-value"
            }, ContrastValue, 1, 2,
                             paramList: "=<contrast>[,<ip>]",
                             desc:
                             "Applies contrast curve to value.",
                             paramDesc:
                             "<contrast> is curvature strength in range of -1..1 (0), <ip> is inflection point in range of 0..1 (0.5)");

            CliArgs.Register(new List <string> {
                "-cs", "--contrast-saturation"
            }, ContrastHslSaturation, 1, 2,
                             paramList: "=<contrast>[,<ip>]",
                             desc:
                             "Applies contrast curve to saturation.",
                             paramDesc:
                             "<contrast> is curvature strength in range of -1..1 (0), <ip> is inflection point in range of 0..1 (0.5)");

            CliArgs.Register(new List <string> {
                "-ga", "--gamma"
            }, GammaRgb, 1, 1,
                             paramList: "=<gamma>",
                             desc: "Gamma correction for all RGB channels equally.",
                             paramDesc: "<gamma> is value in range of 0.01..9.99 (1.0)");

            CliArgs.Register(new List <string> {
                "-gar", "--gamma-red"
            }, GammaRed, 1,
                             paramList: "=<gamma>",
                             desc: "Adjusts gamma of red channel.",
                             paramDesc: "<gamma> is value in range of 0.01..9.99 (1.0)");

            CliArgs.Register(new List <string> {
                "-gag", "--gamma-green"
            }, GammaGreen, 1,
                             paramList: "=<gamma>",
                             desc: "Adjusts gamma of green channel.",
                             paramDesc: "<gamma> is value in range of 0.01..9.99 (1.0)");

            CliArgs.Register(new List <string> {
                "-gab", "--gamma-blue"
            }, GammaBlue, 1,
                             paramList: "=<gamma>",
                             desc: "Adjusts gamma of blue channel.",
                             paramDesc: "<gamma> is value in range of 0.01..9.99 (1.0)");

            CliArgs.Register(new List <string> {
                "-gal", "--gamma-lightness"
            }, GammaLightness, 1,
                             paramList: "=<gamma>",
                             desc: "Adjusts gamma of lightness.",
                             paramDesc: "<gamma> is value in range of 0.01..9.99 (1.0)");

            CliArgs.Register(new List <string> {
                "-gav", "--gamma-value"
            }, GammaValue, 1,
                             paramList: "=<gamma>",
                             desc: "Adjusts gamma of value.",
                             paramDesc: "<gamma> is value in range of 0.01..9.99 (1.0)");

            CliArgs.Register(new List <string> {
                "-gas", "--gamma-saturation"
            }, GammaHslSaturation, 1,
                             paramList: "=<gamma>",
                             desc: "Adjusts gamma of saturation.",
                             paramDesc: "<gamma> is value in range of 0.01..9.99 (1.0)");

            CliArgs.Register(new List <string> {
                "-le", "--levels"
            }, LevelsRgb, 5, 5,
                             paramList: "=<ib>,<iw>,<g>,<ob>,<ow>",
                             desc:
                             "Adjusts levels of all RGB channels.",
                             paramDesc:
                             "<ib> is input black 0..1 (0), <iw> is input white 0..1 (1), <g> is gamma 0.01..9.99 (1), <ob> is output black 0..1 (0), <ow> is output white 0..1 (1)");

            CliArgs.Register(new List <string> {
                "-ler", "--levels-red"
            }, LevelsRed, 5, 5,
                             paramList: "=<ib>,<iw>,<g>,<ob>,<ow>",
                             desc:
                             "Adjusts levels of red channel.",
                             paramDesc:
                             "<ib> is input black 0..1 (0), <iw> is input white 0..1 (1), <g> is gamma 0.01..9.99 (1), <ob> is output black 0..1 (0), <ow> is output white 0..1 (1)");

            CliArgs.Register(new List <string> {
                "-leg", "--levels-green"
            }, LevelsGreen, 5, 5,
                             paramList: "=<ib>,<iw>,<g>,<ob>,<ow>",
                             desc:
                             "Adjusts levels of red channel.",
                             paramDesc:
                             "<ib> is input black 0..1 (0), <iw> is input white 0..1 (1), <g> is gamma 0.01..9.99 (1), <ob> is output black 0..1 (0), <ow> is output white 0..1 (1)");

            CliArgs.Register(new List <string> {
                "-leb", "--levels-blue"
            }, LevelsBlue, 5, 5,
                             paramList: "=<ib>,<iw>,<g>,<ob>,<ow>",
                             desc:
                             "Adjusts levels of red channel.",
                             paramDesc:
                             "<ib> is input black 0..1 (0), <iw> is input white 0..1 (1), <g> is gamma 0.01..9.99 (1), <ob> is output black 0..1 (0), <ow> is output white 0..1 (1)");

            CliArgs.Register(new List <string> {
                "-al", "--auto-levels"
            }, AutoLevelsRgb, 0, 3,
                             paramList: "=<min>,<max>,<g>",
                             desc:
                             "Auto levels RGB channels by normalizing them by HSV values to full scale between given minimum and maximum.",
                             paramDesc: "<min> is output min 0..1 (0), <max> is output max 0..1 (1), <g> is gamma 0.01..9.99 (1)");

            CliArgs.Register(new List <string> {
                "-all", "--auto-levels-lightness"
            }, AutoLevelsLightness, 0, 3,
                             paramList: "=<min>,<max>,<g>",
                             desc:
                             "Auto levels lightness by normalizing values to full scale between given minimum and maximum.",
                             paramDesc: "<min> is output min 0..1 (0), <max> is output max 0..1 (1), <g> is gamma 0.01..9.99 (1)");

            CliArgs.Register(new List <string> {
                "-lel", "--levels-lightness"
            }, LevelsLightness, 5,
                             paramList: "=<ib>,<iw>,<g>,<ob>,<ow>",
                             desc:
                             "Adjusts levels of lightness.",
                             paramDesc:
                             "<ib> is input black 0..1 (0), <iw> is input white 0..1 (1), <g> is gamma 0.01..9.99 (1), <ob> is output black 0..1 (0), <ow> is output white 0..1 (1)");

            CliArgs.Register(new List <string> {
                "-lev", "--levels-value"
            }, LevelsValue, 5,
                             paramList: "=<ib>,<iw>,<g>,<ob>,<ow>",
                             desc:
                             "Adjusts levels of value.",
                             paramDesc:
                             "<ib> is input black 0..1 (0), <iw> is input white 0..1 (1), <g> is gamma 0.01..9.99 (1), <ob> is output black 0..1 (0), <ow> is output white 0..1 (1)");

            CliArgs.Register(new List <string> {
                "-les", "--levels-saturation"
            }, LevelsHslSaturation, 5, 5,
                             paramList: "=<ib>,<iw>,<g>,<ob>,<ow>",
                             desc: "Adjusts levels of saturation.",
                             paramDesc:
                             "<ib> is input black 0..1 (0), <iw> is input white (1), <g> is gamma 0.01..9.99 (1), <ob> is output black 0..1 (0), <ow> is output white 0..1 (1)");

            CliArgs.Register(new List <string> {
                "-i", "--invert-rgb"
            }, InvertRgb, 0, 0,
                             desc: "Inverts RGB channels.");

            CliArgs.Register(new List <string> {
                "-il", "--invert-lightness"
            }, InvertLightness, 0, 0,
                             desc: "Inverts lightness.");

            CliArgs.Register(new List <string> {
                "-iv", "--invert-value"
            }, InvertValue, 0, 0,
                             desc: "Inverts value.");

            CliArgs.Register(new List <string> {
                "-ipl", "--invert-per-lightness"
            }, InvertPerceivedLightness, 0, 0,
                             desc: "Inverts perceived lightness.");

            CliArgs.Register(new List <string> {
                "-gsb", "--grayscale-brightness"
            }, BrightnessToGrayScale, 0, 0,
                             desc: "Converts to gray scale based on perceived brightness.");

            CliArgs.Register(new List <string> {
                "-gsl", "--grayscale-ligthness"
            }, LightnessToGrayScale, 0, 0,
                             desc: "Converts to gray scale based on lightness.");

            CliArgs.Register(new List <string> {
                "-gsv", "--grayscale-value"
            }, ValueToGrayScale, 0, 0,
                             desc: "Converts to gray scale based on HSV value.");

            CliArgs.Register(new List <string> {
                "--min-lightness"
            }, MinLightness, 1, 1,
                             paramList: "=<min>",
                             desc: "Limits lower end of lightness.",
                             paramDesc: "<min> minimum lightness"
                             );

            CliArgs.Register(new List <string> {
                "--max-lightness"
            }, MaxLightness, 1, 1,
                             paramList: "=<max>",
                             desc: "Limits higher end of lightness.",
                             paramDesc: "<max> max lightness"
                             );

            CliArgs.Register(new List <string> {
                "--min-value"
            }, MinValue, 1, 1,
                             paramList: "=<min>",
                             desc: "Limits lower end of HSV value.",
                             paramDesc: "<min> minimum lightness"
                             );

            CliArgs.Register(new List <string> {
                "--max-value"
            }, MaxValue, 1, 1,
                             paramList: "=<max>",
                             desc: "Limits higher end of value.",
                             paramDesc: "<max> max HSV value"
                             );

            CliArgs.Register(new List <string> {
                "--max-saturation"
            }, MaxHslSaturation, 1, 1,
                             paramList: "=<max>",
                             desc: "Limits higher end of saturation.",
                             paramDesc: "<max> max saturation"
                             );

            CliArgs.Register(new List <string> {
                "--max-saturation-hsv"
            }, MaxHsvSaturation, 1, 1,
                             paramList: "=<max>",
                             desc: "Limits higher end of HSV saturation.",
                             paramDesc: "<max> max saturation"
                             );

            CliArgs.Register(new List <string> {
                "--clamp"
            }, Clamp, 0, 0,
                             desc:
                             "Clamps color values to normal range of 0..1. Tries to preserve hue. This is automatically applied as last filter.");

            GetInstance()._isRegistered = true;
        }