From 87c02f455d992b02a5e4727bc75552d7d097c4fb Mon Sep 17 00:00:00 2001 From: cristy Date: Fri, 24 Feb 2012 00:19:10 +0000 Subject: [PATCH] --- MagickCore/option.c | 7 ++-- MagickWand/convert.c | 61 +++++++++++++++++++++++++++++++++ MagickWand/mogrify.c | 76 ++++++++++++++++++++++++++++++++++++++++++ MagickWand/operation.c | 23 ++++++++++--- utilities/convert.1.in | 9 +++++ utilities/mogrify.1.in | 8 +++++ 6 files changed, 178 insertions(+), 6 deletions(-) diff --git a/MagickCore/option.c b/MagickCore/option.c index 4030692c0..246bf0abc 100644 --- a/MagickCore/option.c +++ b/MagickCore/option.c @@ -158,8 +158,8 @@ static const OptionInfo CommandOptions[] = { /* WARNING: this must be sorted by name, then by switch character - So that it can be referanced using a binary search for speed. - See GetCommandOptionInfo() below for details. + So that it can be referenced using a binary search for speed. + See GetCommandOptionInfo() below for details. Check on sort... magick -list command > t1 @@ -239,6 +239,9 @@ static const OptionInfo { "-cdl", 1L, SimpleOperatorOptionFlag, MagickFalse }, { "+channel", 0L, ImageInfoOptionFlag | SimpleOperatorOptionFlag, MagickFalse }, { "-channel", 1L, ImageInfoOptionFlag | SimpleOperatorOptionFlag, MagickFalse }, + { "-channel-extract", 1L, SimpleOperatorOptionFlag, MagickFalse }, + { "-channel-inject", 0L, ListOperatorOptionFlag | FireOptionFlag, MagickTrue }, + { "-channel-swap", 1L, SimpleOperatorOptionFlag, MagickFalse }, { "+charcoal", 0L, DeprecateOptionFlag, MagickTrue }, { "-charcoal", 0L, SimpleOperatorOptionFlag, MagickFalse }, { "+chop", 1L, DeprecateOptionFlag, MagickTrue }, diff --git a/MagickWand/convert.c b/MagickWand/convert.c index a3d6c7315..fd6fc267e 100644 --- a/MagickWand/convert.c +++ b/MagickWand/convert.c @@ -135,6 +135,16 @@ static MagickBooleanType ConcatenateImages(int argc,char **argv, static MagickBooleanType ConvertUsage(void) { static const char + *channel_operators[]= + { + "-channel-extract channel-list", + " extract the channels in order", + "-channel-inject channel-list", + " inject the channels in order", + "-channel-swap channel,channel", + " swap channels", + (char *) NULL + }, *miscellaneous[]= { "-debug events display copious debugging information", @@ -441,6 +451,9 @@ static MagickBooleanType ConvertUsage(void) (void) printf("\nImage Operators:\n"); for (p=operators; *p != (char *) NULL; p++) (void) printf(" %s\n",*p); + (void) printf("\nImage Channel Operators:\n"); + for (p=channel_operators; *p != (char *) NULL; p++) + (void) printf(" %s\n",*p); (void) printf("\nImage Sequence Operators:\n"); for (p=sequence_operators; *p != (char *) NULL; p++) (void) printf(" %s\n",*p); @@ -877,6 +890,54 @@ WandExport MagickBooleanType ConvertImageCommand(ImageInfo *image_info, argv[i]); break; } + if (LocaleCompare("channel-extract",option+1) == 0) + { + ssize_t + channel; + + if (*option == '+') + break; + i++; + if (i == (ssize_t) (argc-1)) + ThrowConvertException(OptionError,"MissingArgument",option); + channel=ParseChannelOption(argv[i]); + if (channel < 0) + ThrowConvertException(OptionError,"UnrecognizedChannelType", + argv[i]); + break; + } + if (LocaleCompare("channel-inject",option+1) == 0) + { + ssize_t + channel; + + if (*option == '+') + break; + i++; + if (i == (ssize_t) (argc-1)) + ThrowConvertException(OptionError,"MissingArgument",option); + channel=ParseChannelOption(argv[i]); + if (channel < 0) + ThrowConvertException(OptionError,"UnrecognizedChannelType", + argv[i]); + break; + } + if (LocaleCompare("channel-swap",option+1) == 0) + { + ssize_t + channel; + + if (*option == '+') + break; + i++; + if (i == (ssize_t) (argc-1)) + ThrowConvertException(OptionError,"MissingArgument",option); + channel=ParseChannelOption(argv[i]); + if (channel < 0) + ThrowConvertException(OptionError,"UnrecognizedChannelType", + argv[i]); + break; + } if (LocaleCompare("charcoal",option+1) == 0) { if (*option == '+') diff --git a/MagickWand/mogrify.c b/MagickWand/mogrify.c index b3441ec1c..16baf3281 100644 --- a/MagickWand/mogrify.c +++ b/MagickWand/mogrify.c @@ -1037,6 +1037,16 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc, exception); break; } + if (LocaleCompare("channel-extract",option+1) == 0) + { + puts("stand by..."); + break; + } + if (LocaleCompare("channel-swap",option+1) == 0) + { + puts("stand by..."); + break; + } if (LocaleCompare("charcoal",option+1) == 0) { /* @@ -3255,6 +3265,16 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc, static MagickBooleanType MogrifyUsage(void) { static const char + *channel_operators[]= + { + "-channel-extract channel-list", + " extract the channels in order", + "-channel-inject channel-list", + " inject the channels in order", + "-channel-swap channel,channel", + " swap channels", + (char *) NULL + }, *miscellaneous[]= { "-debug events display copious debugging information", @@ -3560,6 +3580,9 @@ static MagickBooleanType MogrifyUsage(void) (void) printf("\nImage Operators:\n"); for (p=operators; *p != (char *) NULL; p++) (void) printf(" %s\n",*p); + (void) printf("\nImage Channel Operators:\n"); + for (p=channel_operators; *p != (char *) NULL; p++) + (void) printf(" %s\n",*p); (void) printf("\nImage Sequence Operators:\n"); for (p=sequence_operators; *p != (char *) NULL; p++) (void) printf(" %s\n",*p); @@ -4025,6 +4048,54 @@ WandExport MagickBooleanType MogrifyImageCommand(ImageInfo *image_info, argv[i]); break; } + if (LocaleCompare("channel-extract",option+1) == 0) + { + ssize_t + channel; + + if (*option == '+') + break; + i++; + if (i == (ssize_t) (argc-1)) + ThrowMogrifyException(OptionError,"MissingArgument",option); + channel=ParseChannelOption(argv[i]); + if (channel < 0) + ThrowMogrifyException(OptionError,"UnrecognizedChannelType", + argv[i]); + break; + } + if (LocaleCompare("channel-inject",option+1) == 0) + { + ssize_t + channel; + + if (*option == '+') + break; + i++; + if (i == (ssize_t) (argc-1)) + ThrowMogrifyException(OptionError,"MissingArgument",option); + channel=ParseChannelOption(argv[i]); + if (channel < 0) + ThrowMogrifyException(OptionError,"UnrecognizedChannelType", + argv[i]); + break; + } + if (LocaleCompare("channel-swap",option+1) == 0) + { + ssize_t + channel; + + if (*option == '+') + break; + i++; + if (i == (ssize_t) (argc-1)) + ThrowMogrifyException(OptionError,"MissingArgument",option); + channel=ParseChannelOption(argv[i]); + if (channel < 0) + ThrowMogrifyException(OptionError,"UnrecognizedChannelType", + argv[i]); + break; + } if (LocaleCompare("cdl",option+1) == 0) { if (*option == '+') @@ -7319,6 +7390,11 @@ WandExport MagickBooleanType MogrifyImageList(ImageInfo *image_info, } case 'c': { + if (LocaleCompare("channel-inject",option+1) == 0) + { + puts("stand by..."); + break; + } if (LocaleCompare("clut",option+1) == 0) { Image diff --git a/MagickWand/operation.c b/MagickWand/operation.c index 0db0bf651..34b33aa43 100644 --- a/MagickWand/operation.c +++ b/MagickWand/operation.c @@ -1771,6 +1771,16 @@ static void WandSimpleOperatorImage(MagickWand *wand, SetPixelChannelMapMask(image,image_info->channel); break; } + if (LocaleCompare("channel-extract",option) == 0) + { + puts("stand by..."); + break; + } + if (LocaleCompare("channel-swap",option) == 0) + { + puts("stand by..."); + break; + } if (LocaleCompare("charcoal",option) == 0) { flags=ParseGeometry(arg1,&geometry_info); @@ -3423,19 +3433,24 @@ WandExport void WandListOperatorImages(MagickWand *wand, } case 'c': { + if (LocaleCompare("channel-inject",option) == 0) + { + puts("stand by..."); + break; + } if (LocaleCompare("clut",option) == 0) { - /* FUTURE - make this a compose option (and thus layers compose ) - or perhaps compose last image over all other images. - */ Image *clut_image; + /* FUTURE - make this a compose option (and thus layers compose ) + or perhaps compose last image over all other images. + */ new_images=RemoveFirstImageFromList(&images); clut_image=RemoveLastImageFromList(&images); /* FUTURE - produce Exception, rather than silent fail */ if (clut_image == (Image *) NULL) - break; + break; (void) ClutImage(new_images,clut_image,images->interpolate,exception); clut_image=DestroyImage(clut_image); break; diff --git a/utilities/convert.1.in b/utilities/convert.1.in index dd0d02dea..ff76a523e 100644 --- a/utilities/convert.1.in +++ b/utilities/convert.1.in @@ -225,6 +225,15 @@ Image Operators: \-white-threshold value force all pixels above the threshold into white + +Image Channel Operators: + \-channel-extract channel-list + extract the channels in order + \-channel-inject channel-list + inject the channels in order + \-channel-swap channel,channel + swap the channels + Image Sequence Operators: \-affinity filename transform image colors to match this set of colors \-append append an image sequence top to bottom (use +append for left to right) diff --git a/utilities/mogrify.1.in b/utilities/mogrify.1.in index f0fdf4140..7ea8e1fd0 100644 --- a/utilities/mogrify.1.in +++ b/utilities/mogrify.1.in @@ -227,6 +227,14 @@ Image Operators: \-white-threshold value force all pixels above the threshold into white +Image Channel Operators: + \-channel-extract channel-list + extract the channels in order + \-channel-inject channel-list + inject the channels in order + \-channel-swap channel,channel + swap the channels + Image Sequence Operators: \-affinity filename transform image colors to match this set of colors \-append append an image sequence top to botto (use +append for left to right) -- 2.40.0