}
for (x=0; x < (ssize_t) image->columns; x++)
{
- MagickRealType
- intensity;
+ Quantum
+ pixel;
- intensity=0;
+ pixel=0;
+ if (((x >= region->x) && (x < (region->x+region->width))) &&
+ ((y >= region->y) && (y < (region->y+region->height))))
+ pixel=QuantumRange;
switch (type)
{
case WritePixelMask:
{
- SetPixelWriteMask(image,ClampToQuantum(QuantumRange-intensity),q);
+ SetPixelWriteMask(image,pixel,q);
break;
}
default:
{
- SetPixelReadMask(image,ClampToQuantum(QuantumRange-intensity),q);
+ SetPixelReadMask(image,pixel,q);
break;
}
}
{ "-recolor", 1L, ReplacedOptionFlag | SimpleOperatorFlag, MagickTrue },
{ "+red-primary", 0L, ImageInfoOptionFlag, MagickFalse },
{ "-red-primary", 1L, ImageInfoOptionFlag, MagickFalse },
- { "+region", 0L, NoImageOperatorFlag, MagickFalse },
- { "-region", 1L, NoImageOperatorFlag, MagickFalse },
+ { "+region", 0L, SimpleOperatorFlag, MagickFalse },
+ { "-region", 1L, SimpleOperatorFlag, MagickFalse },
{ "+remap", 0L, ListOperatorFlag | NeverInterpretArgsFlag | FireOptionFlag, MagickFalse },
{ "-remap", 1L, SimpleOperatorFlag | NeverInterpretArgsFlag, MagickFalse },
{ "+remote", 0L, NonMagickOptionFlag, MagickFalse },
(void) setlocale(LC_ALL,"");
(void) setlocale(LC_NUMERIC,"C");
GetPathComponent(argv[0],TailPath,client_name);
- SetClientName(client_name);
+ (void) SetClientName(client_name);
concurrent=MagickFalse;
duration=(-1.0);
iterations=1;
GeometryInfo
geometry_info;
- Image
- *region_image;
-
ImageInfo
*mogrify_info;
interpolate_method=UndefinedInterpolatePixel;
format=GetImageOption(mogrify_info,"format");
SetGeometry(*image,®ion_geometry);
- region_image=NewImageList();
/*
Transmogrify the image.
*/
}
if (LocaleCompare("region",option+1) == 0)
{
+ /*
+ Apply read mask as defined by a region geometry.
+ */
(void) SyncImageSettings(mogrify_info,*image,exception);
- if (region_image != (Image *) NULL)
+ if (*option == '+')
{
- /*
- Composite region.
- */
- (void) CompositeImage(region_image,*image,
- region_image->alpha_trait != UndefinedPixelTrait ?
- CopyCompositeOp : OverCompositeOp,MagickTrue,
- region_geometry.x,region_geometry.y,exception);
- *image=DestroyImage(*image);
- *image=region_image;
- region_image = (Image *) NULL;
+ (void) SetImageRegionMask(*image,ReadPixelMask,
+ (const RectangleInfo *) NULL,exception);
+ break;
}
- if (*option == '+')
- break;
- /*
- Apply transformations to a selected region of the image.
- */
- (void) ParseGravityGeometry(*image,argv[i+1],®ion_geometry,
- exception);
- mogrify_image=CropImage(*image,®ion_geometry,exception);
- if (mogrify_image == (Image *) NULL)
- break;
- region_image=(*image);
- *image=mogrify_image;
- mogrify_image=(Image *) NULL;
+ (void) ParseGravityGeometry(*image,argv[i+1],&geometry,exception);
+ (void) SetImageRegionMask(*image,ReadPixelMask,&geometry,exception);
break;
}
if (LocaleCompare("render",option+1) == 0)
ReplaceImageInListReturnLast(image,mogrify_image);
i+=count;
}
- if (region_image != (Image *) NULL)
- {
- /*
- Composite transformed region onto image.
- */
- (void) SyncImageSettings(mogrify_info,*image,exception);
- (void) CompositeImage(region_image,*image,
- region_image->alpha_trait != UndefinedPixelTrait ? CopyCompositeOp :
- OverCompositeOp,MagickTrue,region_geometry.x,region_geometry.y,
- exception);
- *image=DestroyImage(*image);
- *image=region_image;
- region_image = (Image *) NULL;
- }
/*
Free resources.
*/
}
case 'r':
{
- if (LocaleCompare("rotational-blur",option+1) == 0)
- {
- flags=ParseGeometry(arg1,&geometry_info);
- if ((flags & RhoValue) == 0)
- CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
- new_image=RotationalBlurImage(_image,geometry_info.rho,_exception);
- break;
- }
if (LocaleCompare("raise",option+1) == 0)
{
if (IsGeometry(arg1) == MagickFalse)
if (LocaleCompare("recolor",option+1) == 0)
{
CLIWandWarnReplaced("-color-matrix");
- (void) CLISimpleOperatorImage(cli_wand,"-color-matrix",arg1,NULL,exception);
+ (void) CLISimpleOperatorImage(cli_wand,"-color-matrix",arg1,NULL,
+ exception);
+ }
+ if (LocaleCompare("region",option+1) == 0)
+ {
+ if (IsGeometry(arg1) == MagickFalse)
+ CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
+ if (*option == '+')
+ {
+ (void) SetImageRegionMask(_image,ReadPixelMask,
+ (const RectangleInfo *) NULL,_exception);
+ break;
+ }
+ (void) ParseGravityGeometry(_image,arg1,&geometry,_exception);
+ (void) SetImageRegionMask(_image,ReadPixelMask,&geometry,_exception);
+ break;
}
if (LocaleCompare("remap",option+1) == 0)
{
new_image=RotateImage(_image,geometry_info.rho,_exception);
break;
}
+ if (LocaleCompare("rotational-blur",option+1) == 0)
+ {
+ flags=ParseGeometry(arg1,&geometry_info);
+ if ((flags & RhoValue) == 0)
+ CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
+ new_image=RotationalBlurImage(_image,geometry_info.rho,_exception);
+ break;
+ }
CLIWandExceptionBreak(OptionError,"UnrecognizedOption",option);
}
case 's':