Changeset 7214
- Timestamp:
- 03/24/12 09:43:04 (15 months ago)
- File:
-
- 1 edited
-
ImageMagick/trunk/MagickWand/operation.c (modified) (31 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ImageMagick/trunk/MagickWand/operation.c
r7213 r7214 1076 1076 { 1077 1077 /* SyncImageSettings() used to set per-image attribute. */ 1078 (void) SetImageOption(_image_info,option+1,ArgOption("none")); 1079 _draw_info->gravity=(GravityType) ParseCommandOption( 1080 MagickGravityOptions,MagickFalse,ArgOption("none")); 1078 arg1 = ArgOption("none"); 1079 parse = ParseCommandOption(MagickGravityOptions,MagickFalse,arg1); 1080 if (parse < 0) 1081 CLIWandExceptArgBreak(OptionError,"UnrecognizedGravityType", 1082 option,arg1); 1083 (void) SetImageOption(_image_info,option+1,arg1); 1084 _draw_info->gravity=(GravityType) parse; 1081 1085 break; 1082 1086 } … … 1087 1091 Used directly by many coders 1088 1092 */ 1093 if (IfSetOption && IsGeometry(arg1) == MagickFalse) 1094 CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1); 1089 1095 (void) SetImageOption(_image_info,option+1,ArgOption("0.0")); 1090 1096 break; … … 1100 1106 SyncImageSettings() used to set per-image attribute. 1101 1107 */ 1102 (void) SetImageOption(_image_info,option+1,ArgOption("undefined")); 1108 arg1 = ArgOption("indefined"); 1109 parse = ParseCommandOption(MagickIntentOptions,MagickFalse,arg1); 1110 if (parse < 0) 1111 CLIWandExceptArgBreak(OptionError,"UnrecognizedIntentType", 1112 option,arg1); 1113 (void) SetImageOption(_image_info,option+1,arg1); 1103 1114 break; 1104 1115 } … … 1108 1119 SyncImageSettings() used to set per-image attribute. 1109 1120 */ 1110 (void) SetImageOption(_image_info,option+1,ArgOption("undefined")); 1111 _image_info->interlace=(InterlaceType) ParseCommandOption( 1112 MagickInterlaceOptions,MagickFalse,ArgOption("undefined")); 1121 arg1 = ArgOption("undefined"); 1122 parse = ParseCommandOption(MagickInterlaceOptions,MagickFalse,arg1); 1123 if (parse < 0) 1124 CLIWandExceptArgBreak(OptionError,"UnrecognizedInterlaceType", 1125 option,arg1); 1126 _image_info->interlace=(InterlaceType) parse; 1127 (void) SetImageOption(_image_info,option+1,arg1); 1113 1128 break; 1114 1129 } 1115 1130 if (LocaleCompare("interline-spacing",option+1) == 0) 1116 1131 { 1132 if (IfSetOption && IsGeometry(arg1) == MagickFalse) 1133 CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1); 1117 1134 (void) SetImageOption(_image_info,option+1, ArgOption(NULL)); 1118 1135 _draw_info->interline_spacing=StringToDouble(ArgOption("0"), … … 1123 1140 { 1124 1141 /* SyncImageSettings() used to set per-image attribute. */ 1125 (void) SetImageOption(_image_info,option+1,ArgOption("undefined")); 1142 arg1 = ArgOption("undefined"); 1143 parse = ParseCommandOption(MagickInterpolateOptions,MagickFalse,arg1); 1144 if (parse < 0) 1145 CLIWandExceptArgBreak(OptionError,"UnrecognizedInterpolateMethod", 1146 option,arg1); 1147 (void) SetImageOption(_image_info,option+1,arg1); 1126 1148 break; 1127 1149 } 1128 1150 if (LocaleCompare("interword-spacing",option+1) == 0) 1129 1151 { 1152 if (IfSetOption && IsGeometry(arg1) == MagickFalse) 1153 CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1); 1130 1154 (void) SetImageOption(_image_info,option+1, ArgOption(NULL)); 1131 1155 _draw_info->interword_spacing=StringToDouble(ArgOption("0"),(char **) NULL); … … 1138 1162 if (LocaleCompare("kerning",option+1) == 0) 1139 1163 { 1164 if (IfSetOption && IsGeometry(arg1) == MagickFalse) 1165 CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1); 1140 1166 (void) SetImageOption(_image_info,option+1,ArgOption(NULL)); 1141 1167 _draw_info->kerning=StringToDouble(ArgOption("0"),(char **) NULL); … … 1154 1180 if (LocaleCompare("log",option+1) == 0) 1155 1181 { 1156 if (IfSetOption) 1182 if (IfSetOption) { 1183 if ((strchr(arg1,'%') == (char *) NULL)) 1184 CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1); 1157 1185 (void) SetLogFormat(arg1); 1186 } 1158 1187 break; 1159 1188 } … … 1161 1190 { 1162 1191 /* SyncImageSettings() used to set per-image attribute. */ 1163 (void) SetImageOption(_image_info,option+1,ArgOption("0")); 1192 arg1=ArgOption("0"); 1193 if (IsGeometry(arg1) == MagickFalse) 1194 CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1); 1195 (void) SetImageOption(_image_info,option+1,arg1); 1164 1196 break; 1165 1197 } … … 1325 1357 SyncImageSettings() used to set per-image attribute. 1326 1358 */ 1359 if (IfSetOption && IsGeometry(arg1) == MagickFalse) 1360 CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1); 1327 1361 (void) SetImageOption(_image_info,option+1,ArgOption("0.0")); 1328 1362 break; … … 1722 1756 if (LocaleCompare("adaptive-resize",option+1) == 0) 1723 1757 { 1758 /* FUTURE: Roll into a resize special operator */ 1724 1759 if (IsGeometry(arg1) == MagickFalse) 1725 1760 CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1); … … 2229 2264 ** Convert that to an appropriate distortion argument array. 2230 2265 ** FUTURE: make a separate special resize operator 2231 */2266 Roll into a resize special operator */ 2232 2267 if (IsGeometry(arg2) == MagickFalse) 2233 2268 CLIWandExceptArgBreak(OptionError,"InvalidGeometry", … … 2498 2533 if (LocaleCompare("gamma",option+1) == 0) 2499 2534 { 2535 if (IsGeometry(arg1) == MagickFalse) 2536 CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1); 2500 2537 if (IfNormalOp) 2501 2538 (void) GammaImage(_image,StringToDouble(arg1,(char **) NULL), … … 2508 2545 (LocaleCompare("gaussian",option+1) == 0)) 2509 2546 { 2547 if (IsGeometry(arg1) == MagickFalse) 2548 CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1); 2510 2549 flags=ParseGeometry(arg1,&geometry_info); 2511 2550 if ((flags & SigmaValue) == 0) … … 2519 2558 /* 2520 2559 Record Image offset for composition. (A Setting) 2521 Resize last _image. (ListOperator) 2560 Resize last _image. (ListOperator) -- DEPRECIATE 2522 2561 FUTURE: Why if no 'offset' does this resize ALL images? 2523 2562 Also why is the setting recorded in the IMAGE non-sense! … … 2529 2568 break; 2530 2569 } 2570 if (IsGeometry(arg1) == MagickFalse) 2571 CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1); 2531 2572 flags=ParseRegionGeometry(_image,arg1,&geometry,_exception); 2532 2573 if (((flags & XValue) != 0) || ((flags & YValue) != 0)) … … 2573 2614 if (LocaleCompare("implode",option+1) == 0) 2574 2615 { 2616 if (IsGeometry(arg1) == MagickFalse) 2617 CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1); 2575 2618 (void) ParseGeometry(arg1,&geometry_info); 2576 2619 new_image=ImplodeImage(_image,geometry_info.rho, … … 2580 2623 if (LocaleCompare("interpolative-resize",option+1) == 0) 2581 2624 { 2625 /* FUTURE: New to IMv7 2626 Roll into a resize special operator */ 2627 if (IsGeometry(arg1) == MagickFalse) 2628 CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1); 2582 2629 (void) ParseRegionGeometry(_image,arg1,&geometry,_exception); 2583 2630 new_image=InterpolativeResizeImage(_image,geometry.width, … … 2591 2638 if (LocaleCompare("lat",option+1) == 0) 2592 2639 { 2640 if (IsGeometry(arg1) == MagickFalse) 2641 CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1); 2593 2642 flags=ParseGeometry(arg1,&geometry_info); 2594 2643 if ((flags & PercentValue) != 0) … … 2609 2658 flags; 2610 2659 2660 if (IsGeometry(arg1) == MagickFalse) 2661 CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1); 2611 2662 flags=ParseGeometry(arg1,&geometry_info); 2612 2663 black_point=geometry_info.rho; … … 2678 2729 flags; 2679 2730 2731 if (IsGeometry(arg1) == MagickFalse) 2732 CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1); 2680 2733 flags=ParseGeometry(arg1,&geometry_info); 2681 2734 black_point=geometry_info.rho; … … 2696 2749 if (LocaleCompare("liquid-rescale",option+1) == 0) 2697 2750 { 2751 /* FUTURE: Roll into a resize special operator */ 2752 if (IsGeometry(arg1) == MagickFalse) 2753 CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1); 2698 2754 flags=ParseRegionGeometry(_image,arg1,&geometry,_exception); 2699 2755 if ((flags & XValue) == 0) … … 3105 3161 if (LocaleCompare("sample",option+1) == 0) 3106 3162 { 3163 /* FUTURE: Roll into a resize special operator */ 3107 3164 (void) ParseRegionGeometry(_image,arg1,&geometry,_exception); 3108 3165 new_image=SampleImage(_image,geometry.width,geometry.height, … … 3112 3169 if (LocaleCompare("scale",option+1) == 0) 3113 3170 { 3171 /* FUTURE: Roll into a resize special operator */ 3114 3172 (void) ParseRegionGeometry(_image,arg1,&geometry,_exception); 3115 3173 new_image=ScaleImage(_image,geometry.width,geometry.height, … … 3557 3615 % o arg1, arg2: optional argument strings to the operation 3558 3616 % 3559 % NOTE: only "limit" currentlyuses two arguments.3617 % NOTE: only "limit" uses two arguments. 3560 3618 % 3561 3619 % Example usage... … … 3856 3914 index; 3857 3915 3916 if (IfNormalOp && IsGeometry(arg1) == MagickFalse) 3917 CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1); 3858 3918 index=0; 3859 3919 insert_image=RemoveLastImageFromList(&_images); … … 3869 3929 index_image=GetImageFromList(_images,index-1); 3870 3930 if (index_image == (Image *) NULL) 3871 { 3872 (void) ThrowMagickException(_exception,GetMagickModule(), 3873 OptionError,"NoSuchImage","'%s'",arg1); 3874 break; 3875 } 3931 CLIWandExceptArgBreak(OptionError,"NoSuchImage",option,arg1); 3876 3932 InsertImageInList(&index_image,insert_image); 3877 3933 } … … 3885 3941 if (LocaleCompare("layers",option+1) == 0) 3886 3942 { 3887 ImageLayerMethod 3888 method; 3889 3890 method=(ImageLayerMethod) ParseCommandOption(MagickLayerOptions, 3891 MagickFalse,arg1); 3892 switch (method) 3943 parse=ParseCommandOption(MagickLayerOptions,MagickFalse,arg1); 3944 if ( parse < 0 ) 3945 CLIWandExceptArgBreak(OptionError,"UnrecognizedLayerMethod", 3946 option,arg1); 3947 switch ((ImageLayerMethod) parse) 3893 3948 { 3894 3949 case CoalesceLayer: … … 3902 3957 default: 3903 3958 { 3904 new_images=CompareImagesLayers(_images,method,_exception); 3959 new_images=CompareImagesLayers(_images,(ImageLayerMethod) parse, 3960 _exception); 3905 3961 break; 3906 3962 } … … 3910 3966 case TrimBoundsLayer: 3911 3967 { 3912 new_images=MergeImageLayers(_images,method,_exception); 3968 new_images=MergeImageLayers(_images,(ImageLayerMethod) parse, 3969 _exception); 3913 3970 break; 3914 3971 } … … 4030 4087 limit; 4031 4088 4032 ResourceType4033 type;4034 4035 type=(ResourceType) ParseCommandOption(MagickResourceOptions,4036 MagickFalse,arg1);4037 4089 limit=MagickResourceInfinity; 4090 parse= ParseCommandOption(MagickResourceOptions,MagickFalse,arg1); 4091 if ( parse < 0 ) 4092 CLIWandExceptArgBreak(OptionError,"UnrecognizedResourceType", 4093 option,arg1); 4038 4094 if (LocaleCompare("unlimited",arg2) != 0) 4039 4095 limit=(MagickSizeType) SiPrefixToDoubleInterval(arg2,100.0); 4040 (void) SetMagickResourceLimit( type,limit);4096 (void) SetMagickResourceLimit((ResourceType)parse,limit); 4041 4097 break; 4042 4098 } … … 4524 4580 4525 4581 list=ParseCommandOption(MagickListOptions,MagickFalse, arg1); 4582 if ( list < 0 ) { 4583 CLIWandExceptionArg(OptionError,"UnrecognizedListType",option,arg1); 4584 return; 4585 } 4526 4586 switch (list) 4527 4587 {
Note: See TracChangeset
for help on using the changeset viewer.
