(GetImageVirtualPixelMethod(image) != EdgeVirtualPixelMethod))
return(MagickFalse);
- /* check if the image has read / write mask */
- if (image->read_mask != MagickFalse || image->write_mask != MagickFalse)
+ /* check if the image has mask */
+ if (image->composite_mask != MagickFalse ||
+ image->read_mask != MagickFalse ||
+ image->write_mask != MagickFalse)
return(MagickFalse);
if (image->number_channels > 4)
register ssize_t
i;
- if (GetPixelWriteMask(image,p) <= (QuantumRange/2))
- {
- p+=GetPixelChannels(image);
- continue;
- }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
PixelChannel channel = GetPixelChannelChannel(image,i);
register ssize_t
i;
- if (GetPixelWriteMask(image,p) <= (QuantumRange/2))
- {
- p+=GetPixelChannels(image);
- continue;
- }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
PixelChannel
register ssize_t
i;
- if (GetPixelWriteMask(image,q) <= (QuantumRange/2))
- {
- q+=GetPixelChannels(image);
- continue;
- }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
PixelChannel
register ssize_t
i;
- if (GetPixelWriteMask(image,q) <= (QuantumRange/2))
- {
- q+=GetPixelChannels(image);
- continue;
- }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
PixelChannel
MagickCLCacheInfo
opencl;
+
+ MagickBooleanType
+ composite_mask;
} CacheInfo;
extern MagickPrivate Cache
*QueueAuthenticPixelsCache(Image *,const ssize_t,const ssize_t,const size_t,
const size_t,ExceptionInfo *),
*SetPixelCacheNexusPixels(const CacheInfo *,const MapMode,
- const RectangleInfo *,NexusInfo *,ExceptionInfo *) magick_hot_spot;
+ const RectangleInfo *,const MagickBooleanType,NexusInfo *,
+ ExceptionInfo *) magick_hot_spot;
#if defined(MAGICKCORE_OPENCL_SUPPORT)
static void
if (cache_info->number_threads == 0)
cache_info->number_threads=1;
cache_info->nexus_info=AcquirePixelCacheNexus(cache_info->number_threads);
+ if (cache_info->nexus_info == (NexusInfo **) NULL)
+ ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
value=GetEnvironmentValue("MAGICK_SYNCHRONIZE");
if (value != (const char *) NULL)
{
% %
% %
% %
++ C l i p P i x e l C a c h e N e x u s %
+% %
+% %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% ClipPixelCacheNexus() clips the cache nexus as defined by the image clip
+% mask. The method returns MagickTrue if the pixel region is clipped,
+% otherwise MagickFalse.
+%
+% The format of the ClipPixelCacheNexus() method is:
+%
+% MagickBooleanType ClipPixelCacheNexus(Image *image,NexusInfo *nexus_info,
+% ExceptionInfo *exception)
+%
+% A description of each parameter follows:
+%
+% o image: the image.
+%
+% o nexus_info: the cache nexus to clip.
+%
+% o exception: return any errors or warnings in this structure.
+%
+*/
+static MagickBooleanType ClipPixelCacheNexus(Image *image,
+ NexusInfo *nexus_info,ExceptionInfo *exception)
+{
+ CacheInfo
+ *magick_restrict cache_info;
+
+ MagickSizeType
+ number_pixels;
+
+ NexusInfo
+ **magick_restrict image_nexus;
+
+ register Quantum
+ *magick_restrict p,
+ *magick_restrict q;
+
+ register ssize_t
+ n;
+
+ /*
+ Apply clip mask.
+ */
+ if (image->debug != MagickFalse)
+ (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
+ if (image->write_mask == MagickFalse)
+ return(MagickTrue);
+ cache_info=(CacheInfo *) image->cache;
+ if (cache_info == (Cache) NULL)
+ return(MagickFalse);
+ image_nexus=AcquirePixelCacheNexus(1);
+ p=GetAuthenticPixelCacheNexus(image,nexus_info->region.x,nexus_info->region.y,
+ nexus_info->region.width,nexus_info->region.height,image_nexus[0],
+ exception);
+ q=nexus_info->pixels;
+ number_pixels=(MagickSizeType) nexus_info->region.width*
+ nexus_info->region.height;
+ for (n=0; n < (ssize_t) number_pixels; n++)
+ {
+ double
+ mask_alpha;
+
+ register ssize_t
+ i;
+
+ if (p == (Quantum *) NULL)
+ break;
+ mask_alpha=QuantumScale*GetPixelWriteMask(image,p);
+ if (fabs(mask_alpha) >= MagickEpsilon)
+ for (i=0; i < (ssize_t) image->number_channels; i++)
+ {
+ PixelChannel channel = GetPixelChannelChannel(image,i);
+ PixelTrait traits = GetPixelChannelTraits(image,channel);
+ if ((traits & UpdatePixelTrait) == 0)
+ continue;
+ q[i]=MagickOver_(p[i],mask_alpha*GetPixelAlpha(image,p),q[i],
+ GetPixelAlpha(image,q));
+ }
+ p+=GetPixelChannels(image);
+ q+=GetPixelChannels(image);
+ }
+ image_nexus=DestroyPixelCacheNexus(image_nexus,1);
+ if (n < (ssize_t) number_pixels)
+ return(MagickFalse);
+ return(MagickTrue);
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% %
+% %
+ C l o n e P i x e l C a c h e %
% %
% %
region.height=1;
region.x=0;
region.y=y;
- pixels=SetPixelCacheNexusPixels(cache_info,ReadMode,®ion,
+ pixels=SetPixelCacheNexusPixels(cache_info,ReadMode,®ion,MagickFalse,
cache_nexus[id],exception);
if (pixels == (Quantum *) NULL)
continue;
if (status == MagickFalse)
continue;
region.width=clone_info->columns;
- pixels=SetPixelCacheNexusPixels(clone_info,WriteMode,®ion,
+ pixels=SetPixelCacheNexusPixels(clone_info,WriteMode,®ion,MagickFalse,
clone_nexus[id],exception);
if (pixels == (Quantum *) NULL)
continue;
region.height=1;
region.x=0;
region.y=y;
- pixels=SetPixelCacheNexusPixels(cache_info,ReadMode,®ion,
+ pixels=SetPixelCacheNexusPixels(cache_info,ReadMode,®ion,MagickFalse,
cache_nexus[id],exception);
if (pixels == (Quantum *) NULL)
continue;
continue;
region.width=clone_info->columns;
pixels=SetPixelCacheNexusPixels(clone_info,WriteMode,®ion,
- clone_nexus[id],exception);
+ MagickFalse,clone_nexus[id],exception);
if (pixels == (Quantum *) NULL)
continue;
if ((clone_nexus[id]->metacontent != (void *) NULL) &&
if ((image->storage_class != cache_info->storage_class) ||
(image->colorspace != cache_info->colorspace) ||
(image->alpha_trait != cache_info->alpha_trait) ||
+ (image->composite_mask != cache_info->composite_mask) ||
(image->read_mask != cache_info->read_mask) ||
(image->write_mask != cache_info->write_mask) ||
(image->columns != cache_info->columns) ||
assert(cache_info->signature == MagickCoreSignature);
(void) memset(pixel,0,MaxPixelChannels*sizeof(*pixel));
if (cache_info->methods.get_one_authentic_pixel_from_handler != (GetOneAuthenticPixelFromHandler) NULL)
- return(cache_info->methods.get_one_authentic_pixel_from_handler(image,x,y,
- pixel,exception));
+ return(cache_info->methods.get_one_authentic_pixel_from_handler(image,x,y,pixel,exception));
q=GetAuthenticPixelsCache(image,x,y,1UL,1UL,exception);
return(CopyPixel(image,q,pixel));
}
cache_info=(CacheInfo *) image->cache;
assert(cache_info->signature == MagickCoreSignature);
(void) memset(pixel,0,MaxPixelChannels*sizeof(*pixel));
- if (cache_info->methods.get_one_virtual_pixel_from_handler != (GetOneVirtualPixelFromHandler) NULL)
+ if (cache_info->methods.get_one_virtual_pixel_from_handler !=
+ (GetOneVirtualPixelFromHandler) NULL)
return(cache_info->methods.get_one_virtual_pixel_from_handler(image,
GetPixelCacheVirtualMethod(image),x,y,pixel,exception));
assert(id < (int) cache_info->number_threads);
region.y=y;
region.width=columns;
region.height=rows;
- pixels=SetPixelCacheNexusPixels(cache_info,ReadMode,®ion,nexus_info,
- exception);
+ pixels=SetPixelCacheNexusPixels(cache_info,ReadMode,®ion,image->write_mask,
+ nexus_info,exception);
if (pixels == (Quantum *) NULL)
return((const Quantum *) NULL);
q=pixels;
% %
% %
% %
++ M a s k P i x e l C a c h e N e x u s %
+% %
+% %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% MaskPixelCacheNexus() masks the cache nexus as defined by the image mask.
+% The method returns MagickTrue if the pixel region is masked, otherwise
+% MagickFalse.
+%
+% The format of the MaskPixelCacheNexus() method is:
+%
+% MagickBooleanType MaskPixelCacheNexus(Image *image,
+% NexusInfo *nexus_info,ExceptionInfo *exception)
+%
+% A description of each parameter follows:
+%
+% o image: the image.
+%
+% o nexus_info: the cache nexus to clip.
+%
+% o exception: return any errors or warnings in this structure.
+%
+*/
+static MagickBooleanType MaskPixelCacheNexus(Image *image,NexusInfo *nexus_info,
+ ExceptionInfo *exception)
+{
+ CacheInfo
+ *magick_restrict cache_info;
+
+ MagickSizeType
+ number_pixels;
+
+ NexusInfo
+ **magick_restrict image_nexus;
+
+ register Quantum
+ *magick_restrict p,
+ *magick_restrict q;
+
+ register ssize_t
+ n;
+
+ /*
+ Apply clip mask.
+ */
+ if (image->debug != MagickFalse)
+ (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
+ if (image->composite_mask == MagickFalse)
+ return(MagickTrue);
+ cache_info=(CacheInfo *) image->cache;
+ if (cache_info == (Cache) NULL)
+ return(MagickFalse);
+ image_nexus=AcquirePixelCacheNexus(1);
+ p=GetAuthenticPixelCacheNexus(image,nexus_info->region.x,nexus_info->region.y,
+ nexus_info->region.width,nexus_info->region.height,image_nexus[0],
+ exception);
+ q=nexus_info->pixels;
+ number_pixels=(MagickSizeType) nexus_info->region.width*
+ nexus_info->region.height;
+ for (n=0; n < (ssize_t) number_pixels; n++)
+ {
+ double
+ mask_alpha;
+
+ register ssize_t
+ i;
+
+ if (p == (Quantum *) NULL)
+ break;
+ mask_alpha=QuantumScale*GetPixelCompositeMask(image,p);
+ for (i=0; i < (ssize_t) image->number_channels; i++)
+ {
+ PixelChannel channel = GetPixelChannelChannel(image,i);
+ PixelTrait traits = GetPixelChannelTraits(image,channel);
+ if ((traits & UpdatePixelTrait) == 0)
+ continue;
+ q[i]=MagickOver_(p[i],mask_alpha*GetPixelAlpha(image,p),q[i],
+ GetPixelAlpha(image,q));
+ }
+ p+=GetPixelChannels(image);
+ q+=GetPixelChannels(image);
+ }
+ image_nexus=DestroyPixelCacheNexus(image_nexus,1);
+ if (n < (ssize_t) number_pixels)
+ return(MagickFalse);
+ return(MagickTrue);
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% %
+% %
+ O p e n P i x e l C a c h e %
% %
% %
cache_info->storage_class=image->storage_class;
cache_info->colorspace=image->colorspace;
cache_info->alpha_trait=image->alpha_trait;
+ cache_info->composite_mask=image->composite_mask;
cache_info->read_mask=image->read_mask;
cache_info->write_mask=image->write_mask;
cache_info->rows=image->rows;
clone_info->storage_class=cache_info->storage_class;
clone_info->colorspace=cache_info->colorspace;
clone_info->alpha_trait=cache_info->alpha_trait;
+ clone_info->composite_mask=cache_info->composite_mask;
clone_info->read_mask=cache_info->read_mask;
clone_info->write_mask=cache_info->write_mask;
clone_info->columns=cache_info->columns;
region.y=y;
region.width=columns;
region.height=rows;
- pixels=SetPixelCacheNexusPixels(cache_info,WriteMode,®ion,nexus_info,
- exception);
+ pixels=SetPixelCacheNexusPixels(cache_info,WriteMode,®ion,
+ image->write_mask,nexus_info,exception);
return(pixels);
}
\f
cache_methods->get_authentic_metacontent_from_handler;
get_one_virtual_pixel_from_handler=
cache_info->methods.get_one_virtual_pixel_from_handler;
- if (get_one_virtual_pixel_from_handler != (GetOneVirtualPixelFromHandler) NULL)
+ if (get_one_virtual_pixel_from_handler !=
+ (GetOneVirtualPixelFromHandler) NULL)
cache_info->methods.get_one_virtual_pixel_from_handler=
cache_methods->get_one_virtual_pixel_from_handler;
get_one_authentic_pixel_from_handler=
% The format of the SetPixelCacheNexusPixels() method is:
%
% Quantum SetPixelCacheNexusPixels(const CacheInfo *cache_info,
-% const MapMode mode,const RectangleInfo *region,NexusInfo *nexus_info,
+% const MapMode mode,const RectangleInfo *region,
+% const MagickBooleanType buffered,NexusInfo *nexus_info,
% ExceptionInfo *exception)
%
% A description of each parameter follows:
% o region: A pointer to the RectangleInfo structure that defines the
% region of this particular cache nexus.
%
+% o buffered: if true, nexus pixels are buffered.
+%
% o nexus_info: the cache nexus to set.
%
% o exception: return any errors or warnings in this structure.
}
static Quantum *SetPixelCacheNexusPixels(const CacheInfo *cache_info,
- const MapMode mode,const RectangleInfo *region,NexusInfo *nexus_info,
+ const MapMode mode,const RectangleInfo *region,
+ const MagickBooleanType buffered,NexusInfo *nexus_info,
ExceptionInfo *exception)
{
MagickBooleanType
nexus_info->region.height;
if (number_pixels == 0)
return((Quantum *) NULL);
- if ((cache_info->type == MemoryCache) || (cache_info->type == MapCache))
+ if (((cache_info->type == MemoryCache) || (cache_info->type == MapCache)) &&
+ (buffered == MagickFalse))
{
ssize_t
x,
assert(cache_info->signature == MagickCoreSignature);
if (cache_info->type == UndefinedCache)
return(MagickFalse);
+ if ((image->write_mask != MagickFalse) &&
+ (ClipPixelCacheNexus(image,nexus_info,exception) == MagickFalse))
+ return(MagickFalse);
+ if ((image->composite_mask != MagickFalse) &&
+ (MaskPixelCacheNexus(image,nexus_info,exception) == MagickFalse))
+ return(MagickFalse);
if (nexus_info->authentic_pixel_cache != MagickFalse)
{
image->taint=MagickTrue;
register ssize_t
i;
- if (GetPixelWriteMask(image,p) <= (QuantumRange/2))
- {
- SetPixelBackgoundColor(separate_image,q);
- p+=GetPixelChannels(image);
- q+=GetPixelChannels(separate_image);
- continue;
- }
SetPixelChannel(separate_image,GrayPixelChannel,0,q);
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
register ssize_t
i;
- if (GetPixelWriteMask(image,q) <= (QuantumRange/2))
- {
- q+=GetPixelChannels(image);
- continue;
- }
gamma=QuantumScale*GetPixelAlpha(image,q);
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
register ssize_t
i;
- if (GetPixelWriteMask(image,q) <= (QuantumRange/2))
- {
- q+=GetPixelChannels(image);
- continue;
- }
Sa=QuantumScale*GetPixelAlpha(image,q);
gamma=PerceptibleReciprocal(Sa);
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
register ssize_t
i;
- if (GetPixelWriteMask(image,p) <= (QuantumRange/2))
- {
- p+=GetPixelChannels(image);
- q+=GetPixelChannels(reconstruct_image);
- continue;
- }
difference=MagickFalse;
distance=0.0;
Sa=QuantumScale*GetPixelAlpha(image,p);
register ssize_t
i;
- if (GetPixelWriteMask(image,p) <= (QuantumRange/2))
- {
- p+=GetPixelChannels(image);
- q+=GetPixelChannels(reconstruct_image);
- continue;
- }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
double
register ssize_t
i;
- if (GetPixelWriteMask(image,p) <= (QuantumRange/2))
- {
- p+=GetPixelChannels(image);
- q+=GetPixelChannels(reconstruct_image);
- continue;
- }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
double
}
if (metric == PerceptualHashErrorMetric)
similarity=MagickMin(0.01*similarity,1.0);
- if (GetPixelWriteMask(similarity_image,q) <= (QuantumRange/2))
- {
- SetPixelBackgoundColor(similarity_image,q);
- q+=GetPixelChannels(similarity_image);
- continue;
- }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
PixelChannel channel = GetPixelChannelChannel(image,i);
*/
(void) GetOneVirtualPixel(source_image,x-x_offset,y-y_offset,source,
exception);
- if (GetPixelWriteMask(image,q) <= (QuantumRange/2))
- {
- q+=GetPixelChannels(image);
- continue;
- }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
MagickRealType
Sa=QuantumScale*GetPixelAlpha(source_image,p);
Da=QuantumScale*GetPixelAlpha(image,q);
alpha=Sa+Da-Sa*Da;
- if (GetPixelWriteMask(image,q) <= (QuantumRange/2))
- {
- p+=GetPixelChannels(source_image);
- q+=GetPixelChannels(image);
- continue;
- }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
MagickRealType
*/
(void) GetOneVirtualPixel(source_image,x-x_offset,y-y_offset,source,
exception);
- if (GetPixelWriteMask(image,q) <= (QuantumRange/2))
- {
- q+=GetPixelChannels(image);
- continue;
- }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
MagickRealType
break;
}
}
- if (GetPixelWriteMask(image,q) <= (QuantumRange/2))
- {
- p+=GetPixelChannels(source_image);
- q+=GetPixelChannels(image);
- continue;
- }
switch (compose)
{
case ColorizeCompositeOp:
register ssize_t
i;
- if (GetPixelWriteMask(image,q) <= (QuantumRange/2))
- {
- p+=GetPixelChannels(texture_image);
- q+=GetPixelChannels(image);
- continue;
- }
for (i=0; i < (ssize_t) GetPixelChannels(texture_image); i++)
{
PixelChannel channel = GetPixelChannelChannel(texture_image,i);
}
for (x=0; x < y; x++)
{
- if (GetPixelWriteMask(image,q) <= (QuantumRange/2))
- {
- q+=GetPixelChannels(image);
- continue;
- }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
PixelChannel channel = GetPixelChannelChannel(image,i);
}
for ( ; x < (ssize_t) (image->columns-y); x++)
{
- if (GetPixelWriteMask(image,q) <= (QuantumRange/2))
- {
- q+=GetPixelChannels(image);
- continue;
- }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
PixelChannel channel = GetPixelChannelChannel(image,i);
}
for ( ; x < (ssize_t) image->columns; x++)
{
- if (GetPixelWriteMask(image,q) <= (QuantumRange/2))
- {
- q+=GetPixelChannels(image);
- continue;
- }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
PixelChannel channel = GetPixelChannelChannel(image,i);
}
for (x=0; x < (ssize_t) raise_info->width; x++)
{
- if (GetPixelWriteMask(image,q) <= (QuantumRange/2))
- {
- q+=GetPixelChannels(image);
- continue;
- }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
PixelChannel channel = GetPixelChannelChannel(image,i);
q+=GetPixelChannels(image);
for ( ; x < (ssize_t) image->columns; x++)
{
- if (GetPixelWriteMask(image,q) <= (QuantumRange/2))
- {
- q+=GetPixelChannels(image);
- continue;
- }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
PixelChannel channel = GetPixelChannelChannel(image,i);
}
for (x=0; x < (ssize_t) (image->rows-y); x++)
{
- if (GetPixelWriteMask(image,q) <= (QuantumRange/2))
- {
- q+=GetPixelChannels(image);
- continue;
- }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
PixelChannel channel = GetPixelChannelChannel(image,i);
}
for ( ; x < (ssize_t) image->columns; x++)
{
- if (GetPixelWriteMask(image,q) <= (QuantumRange/2))
- {
- q+=GetPixelChannels(image);
- continue;
- }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
PixelChannel channel = GetPixelChannelChannel(image,i);
const char *id,const char *clip_path,ExceptionInfo *exception)
{
Image
- *clip_mask;
+ *clip_mask,
+ *separate_mask;
DrawInfo
*clone_info;
clone_info->alpha=OpaqueAlpha;
clone_info->clip_path=MagickTrue;
status=DrawImage(clip_mask,clone_info,exception);
- (void) CompositeImage(clip_mask,clip_mask,AlphaCompositeOp,MagickTrue,0,0,
- exception);
clone_info=DestroyDrawInfo(clone_info);
- if (status == MagickFalse)
- clip_mask=DestroyImage(clip_mask);
+ separate_mask=SeparateImage(clip_mask,AlphaChannel,exception);
+ if (separate_mask != (Image *) NULL)
+ {
+ clip_mask=DestroyImage(clip_mask);
+ clip_mask=separate_mask;
+ status=NegateImage(clip_mask,MagickFalse,exception);
+ if (status == MagickFalse)
+ clip_mask=DestroyImage(clip_mask);
+ }
if (image->debug != MagickFalse)
(void) LogMagickEvent(DrawEvent,GetMagickModule(),"end clip-path");
return(clip_mask);
const char *id,const char *mask_path,ExceptionInfo *exception)
{
Image
- *composite_mask;
+ *composite_mask,
+ *separate_mask;
DrawInfo
*clone_info;
exception);
if (composite_mask == (Image *) NULL)
return((Image *) NULL);
- (void) SetImageMask(composite_mask,ReadPixelMask,(Image *) NULL,exception);
- (void) SetImageMask(composite_mask,WritePixelMask,(Image *) NULL,exception);
+ (void) SetImageMask(composite_mask,CompositePixelMask,(Image *) NULL,
+ exception);
(void) QueryColorCompliance("#0000",AllCompliance,
&composite_mask->background_color,exception);
composite_mask->background_color.alpha=(MagickRealType) TransparentAlpha;
clone_info->stroke_width=0.0;
clone_info->alpha=OpaqueAlpha;
status=DrawImage(composite_mask,clone_info,exception);
- (void) CompositeImage(composite_mask,composite_mask,AlphaCompositeOp,
- MagickTrue,0,0,exception);
clone_info=DestroyDrawInfo(clone_info);
- if (status == MagickFalse)
- composite_mask=DestroyImage(composite_mask);
+ separate_mask=SeparateImage(composite_mask,AlphaChannel,exception);
+ if (separate_mask != (Image *) NULL)
+ {
+ composite_mask=DestroyImage(composite_mask);
+ composite_mask=separate_mask;
+ status=NegateImage(composite_mask,MagickFalse,exception);
+ if (status == MagickFalse)
+ composite_mask=DestroyImage(composite_mask);
+ }
if (image->debug != MagickFalse)
(void) LogMagickEvent(DrawEvent,GetMagickModule(),"end mask-path");
return(composite_mask);
offset*=PerceptibleReciprocal(length);
for (x=bounding_box.x; x < (ssize_t) bounding_box.width; x++)
{
- if (GetPixelWriteMask(image,q) <= (QuantumRange/2))
- {
- q+=GetPixelChannels(image);
- continue;
- }
GetPixelInfoPixel(image,q,&pixel);
switch (gradient->spread)
{
graphic_context[n],token,mask_path,exception);
mask_path=DestroyString(mask_path);
if (draw_info->compliance != SVGCompliance)
- status=SetImageMask(image,WritePixelMask,
+ status=SetImageMask(image,CompositePixelMask,
graphic_context[n]->composite_mask,exception);
}
break;
status=MagickFalse;
break;
}
- if ((primitive_info[j+1].point.x-primitive_info[j].point.x) < 0.0)
- {
- status=MagickFalse;
- break;
- }
- if ((primitive_info[j+1].point.y-primitive_info[j].point.y) < 0.0)
- {
- status=MagickFalse;
- break;
- }
TraceRectangle(primitive_info+j,primitive_info[j].point,
primitive_info[j+1].point);
i=(ssize_t) (j+primitive_info[j].coordinates);
{
double
fill_alpha,
- mask_alpha,
stroke_alpha;
PixelInfo
fill_alpha=fill_alpha > 0.25 ? 1.0 : 0.0;
stroke_alpha=stroke_alpha > 0.25 ? 1.0 : 0.0;
}
- mask_alpha=QuantumScale*GetPixelWriteMask(image,q);
GetFillColor(draw_info,x-start_x,y-start_y,&fill_color,exception);
- CompositePixelOver(image,&fill_color,mask_alpha*fill_alpha*
- fill_color.alpha,q,(double) GetPixelAlpha(image,q),q);
+ CompositePixelOver(image,&fill_color,fill_alpha*fill_color.alpha,q,
+ (double) GetPixelAlpha(image,q),q);
GetStrokeColor(draw_info,x-start_x,y-start_y,&stroke_color,exception);
- CompositePixelOver(image,&stroke_color,mask_alpha*stroke_alpha*
- stroke_color.alpha,q,(double) GetPixelAlpha(image,q),q);
+ CompositePixelOver(image,&stroke_color,stroke_alpha*stroke_color.alpha,q,
+ (double) GetPixelAlpha(image,q),q);
q+=GetPixelChannels(image);
}
if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
(void) SetImageColorspace(image,sRGBColorspace,exception);
status=MagickTrue;
if (draw_info->compliance == SVGCompliance)
- status=SetImageMask(image,WritePixelMask,draw_info->clipping_mask,
- exception);
+ {
+ status=SetImageMask(image,WritePixelMask,draw_info->clipping_mask,
+ exception);
+ status&=SetImageMask(image,CompositePixelMask,draw_info->composite_mask,
+ exception);
+ }
x=(ssize_t) ceil(primitive_info->point.x-0.5);
y=(ssize_t) ceil(primitive_info->point.y-0.5);
image_view=AcquireAuthenticCacheView(image,exception);
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
- if (GetPixelWriteMask(image,q) <= (QuantumRange/2))
- {
- q+=GetPixelChannels(image);
- continue;
- }
GetPixelInfoPixel(image,q,&pixel);
if (IsFuzzyEquivalencePixelInfo(&pixel,&target) == MagickFalse)
{
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
- if (GetPixelWriteMask(image,q) <= (QuantumRange/2))
- {
- q+=GetPixelChannels(image);
- continue;
- }
GetFillColor(draw_info,x,y,&pixel,exception);
SetPixelAlpha(image,ClampToQuantum(pixel.alpha),q);
q+=GetPixelChannels(image);
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
- if (GetPixelWriteMask(image,q) <= (QuantumRange/2))
- {
- q+=GetPixelChannels(image);
- continue;
- }
GetPixelInfoPixel(image,q,&pixel);
if (IsFuzzyEquivalencePixelInfo(&pixel,&target) == MagickFalse)
{
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
- if (GetPixelWriteMask(image,q) <= (QuantumRange/2))
- {
- q+=GetPixelChannels(image);
- continue;
- }
GetFillColor(draw_info,x,y,&pixel,exception);
SetPixelViaPixelInfo(image,&pixel,q);
q+=GetPixelChannels(image);
}
image_view=DestroyCacheView(image_view);
if (draw_info->compliance == SVGCompliance)
- status&=SetImageMask(image,WritePixelMask,(Image *) NULL,exception);
+ {
+ status&=SetImageMask(image,WritePixelMask,(Image *) NULL,exception);
+ status&=SetImageMask(image,CompositePixelMask,(Image *) NULL,exception);
+ }
if (image->debug != MagickFalse)
(void) LogMagickEvent(DrawEvent,GetMagickModule()," end draw-primitive");
return(status != 0 ? MagickTrue : MagickFalse);
do
{
GetNextToken(p,&p,MagickPathExtent,token);
- if (*token == ',')
+ if ((i != 0) && (*token == ','))
GetNextToken(p,&p,MagickPathExtent,token);
x=StringToDouble(token,&next_token);
if (token == next_token)
if ((traits == UndefinedPixelTrait) ||
(blur_traits == UndefinedPixelTrait))
continue;
- if (((blur_traits & CopyPixelTrait) != 0) ||
- (GetPixelWriteMask(image,p+center) <= (QuantumRange/2)))
+ if ((blur_traits & CopyPixelTrait) != 0)
{
SetPixelChannel(blur_image,channel,p[center+i],q);
continue;
if ((traits == UndefinedPixelTrait) ||
(sharp_traits == UndefinedPixelTrait))
continue;
- if (((sharp_traits & CopyPixelTrait) != 0) ||
- (GetPixelWriteMask(image,p+center) <= (QuantumRange/2)))
+ if ((sharp_traits & CopyPixelTrait) != 0)
{
SetPixelChannel(sharp_image,channel,p[center+i],q);
continue;
if ((traits == UndefinedPixelTrait) ||
(blur_traits == UndefinedPixelTrait))
continue;
- if (((blur_traits & CopyPixelTrait) != 0) ||
- (GetPixelWriteMask(image,p) <= (QuantumRange/2)))
+ if ((blur_traits & CopyPixelTrait) != 0)
{
SetPixelChannel(blur_image,channel,p[i],q);
continue;
if ((traits == UndefinedPixelTrait) ||
(blur_traits == UndefinedPixelTrait))
continue;
- if (((blur_traits & CopyPixelTrait) != 0) ||
- (GetPixelWriteMask(image,p) <= (QuantumRange/2)))
+ if ((blur_traits & CopyPixelTrait) != 0)
{
SetPixelChannel(blur_image,channel,p[i],q);
continue;
if ((traits == UndefinedPixelTrait) ||
(blur_traits == UndefinedPixelTrait))
continue;
- if (((blur_traits & CopyPixelTrait) != 0) ||
- (GetPixelWriteMask(image,p+center) <= (QuantumRange/2)))
+ if ((blur_traits & CopyPixelTrait) != 0)
{
SetPixelChannel(blur_image,channel,p[center+i],q);
continue;
if ((traits == UndefinedPixelTrait) ||
(shade_traits == UndefinedPixelTrait))
continue;
- if (((shade_traits & CopyPixelTrait) != 0) ||
- (GetPixelWriteMask(linear_image,center) <= (QuantumRange/2)))
+ if ((shade_traits & CopyPixelTrait) != 0)
{
SetPixelChannel(shade_image,channel,center[i],q);
continue;
if ((traits == UndefinedPixelTrait) ||
(unsharp_traits == UndefinedPixelTrait))
continue;
- if (((unsharp_traits & CopyPixelTrait) != 0) ||
- (GetPixelWriteMask(image,p) <= (QuantumRange/2)))
+ if ((unsharp_traits & CopyPixelTrait) != 0)
{
SetPixelChannel(unsharp_image,channel,p[i],q);
continue;
PixelTrait
traits;
- if (GetPixelWriteMask(image,q) <= (QuantumRange/2))
- {
- q+=GetPixelChannels(image);
- continue;
- }
GetPixelInfoPixel(image,q,&pixel);
traits=GetPixelChannelTraits(image,RedPixelChannel);
if ((traits & UpdatePixelTrait) != 0)
register ssize_t
j;
- if (GetPixelWriteMask(image,q) <= (QuantumRange/2))
- {
- q+=GetPixelChannels(image);
- continue;
- }
for (j=0; j < (ssize_t) GetPixelChannels(image); j++)
{
PixelChannel channel = GetPixelChannelChannel(image,j);
register const Quantum
*magick_restrict r;
- if (GetPixelWriteMask(image,p) <= (QuantumRange/2))
- {
- SetPixelBackgoundColor(enhance_image,q);
- p+=GetPixelChannels(image);
- q+=GetPixelChannels(enhance_image);
- continue;
- }
GetPixelInfo(image,&aggregate);
total_weight=0.0;
GetPixelInfoPixel(image,p+center,&pixel);
register ssize_t
j;
- if (GetPixelWriteMask(image,q) <= (QuantumRange/2))
- {
- q+=GetPixelChannels(image);
- continue;
- }
for (j=0; j < (ssize_t) GetPixelChannels(image); j++)
{
PixelChannel channel = GetPixelChannelChannel(image,j);
register ssize_t
j;
- if (GetPixelWriteMask(image,q) <= (QuantumRange/2))
- {
- q+=GetPixelChannels(image);
- continue;
- }
for (j=0; j < (ssize_t) GetPixelChannels(image); j++)
{
PixelChannel channel = GetPixelChannelChannel(image,j);
red,
intensity;
- if (GetPixelWriteMask(image,q) <= (QuantumRange/2))
- {
- q+=GetPixelChannels(image);
- continue;
- }
red=(MagickRealType) GetPixelRed(image,q);
green=(MagickRealType) GetPixelGreen(image,q);
blue=(MagickRealType) GetPixelBlue(image,q);
register ssize_t
j;
- if (GetPixelWriteMask(image,q) <= (QuantumRange/2))
- {
- q+=GetPixelChannels(image);
- continue;
- }
for (j=0; j < (ssize_t) GetPixelChannels(image); j++)
{
PixelChannel channel = GetPixelChannelChannel(image,j);
register ssize_t
j;
- if (GetPixelWriteMask(image,q) <= (QuantumRange/2))
- {
- q+=GetPixelChannels(image);
- continue;
- }
for (j=0; j < (ssize_t) GetPixelChannels(image); j++)
{
PixelChannel channel = GetPixelChannelChannel(image,j);
green,
red;
- if (GetPixelWriteMask(image,q) <= (QuantumRange/2))
- {
- q+=GetPixelChannels(image);
- continue;
- }
red=(double) GetPixelRed(image,q);
green=(double) GetPixelGreen(image,q);
blue=(double) GetPixelBlue(image,q);
register ssize_t
j;
- if ((GetPixelWriteMask(image,q) <= (QuantumRange/2)) ||
- IsPixelGray(image,q) != MagickFalse)
+ if (IsPixelGray(image,q) != MagickFalse)
{
q+=GetPixelChannels(image);
continue;
register ssize_t
j;
- if (GetPixelWriteMask(image,q) <= (QuantumRange/2))
- {
- q+=GetPixelChannels(image);
- continue;
- }
for (j=0; j < (ssize_t) GetPixelChannels(image); j++)
{
PixelChannel channel = GetPixelChannelChannel(image,j);
register ssize_t
i;
- if (GetPixelWriteMask(image,q) <= (QuantumRange/2))
- {
- q+=GetPixelChannels(image);
- continue;
- }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
PixelChannel channel = GetPixelChannelChannel(image,i);
if ((traits == UndefinedPixelTrait) ||
(noise_traits == UndefinedPixelTrait))
continue;
- if (((noise_traits & CopyPixelTrait) != 0) ||
- (GetPixelWriteMask(image,p) <= (QuantumRange/2)))
+ if ((noise_traits & CopyPixelTrait) != 0)
{
SetPixelChannel(noise_image,channel,p[i],q);
continue;
(PixelChannel) i);
if (traits == UndefinedPixelTrait)
continue;
- if (((traits & CopyPixelTrait) != 0) ||
- (GetPixelWriteMask(colorize_image,q) <= (QuantumRange/2)))
+ if ((traits & CopyPixelTrait) != 0)
continue;
SetPixelChannel(colorize_image,(PixelChannel) i,ClampToQuantum(
Colorize(q[i],GetPixelInfoChannel(&blend_percentage,(PixelChannel) i),
if ((traits == UndefinedPixelTrait) ||
(fx_traits == UndefinedPixelTrait))
continue;
- if (((fx_traits & CopyPixelTrait) != 0) ||
- (GetPixelWriteMask(image,p) <= (QuantumRange/2)))
+ if ((fx_traits & CopyPixelTrait) != 0)
{
SetPixelChannel(fx_image,channel,p[i],q);
continue;
/*
Determine if the pixel is within an ellipse.
*/
- if (GetPixelWriteMask(canvas,p) <= (QuantumRange/2))
- {
- SetPixelBackgoundColor(implode_image,q);
- p+=GetPixelChannels(canvas);
- q+=GetPixelChannels(implode_image);
- continue;
- }
delta.x=scale.x*(double) (x-center.x);
distance=delta.x*delta.x+delta.y*delta.y;
if (distance >= (radius*radius))
if ((traits == UndefinedPixelTrait) ||
(morph_traits == UndefinedPixelTrait))
continue;
- if (((morph_traits & CopyPixelTrait) != 0) ||
- (GetPixelWriteMask(morph_images,p) <= (QuantumRange/2)))
+ if ((morph_traits & CopyPixelTrait) != 0)
{
SetPixelChannel(morph_image,channel,p[i],q);
continue;
register ssize_t
i;
- if (GetPixelWriteMask(random_image,q) <= (QuantumRange/2))
- {
- q+=GetPixelChannels(random_image);
- continue;
- }
value=GetPseudoRandomValue(random_info[id]);
for (i=0; i < (ssize_t) GetPixelChannels(random_image); i++)
{
register ssize_t
i;
- if (GetPixelWriteMask(image,q) <= (QuantumRange/2))
- {
- q+=GetPixelChannels(image);
- continue;
- }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
PixelChannel channel = GetPixelChannelChannel(image,i);
/*
Determine if the pixel is within an ellipse.
*/
- if (GetPixelWriteMask(canvas,p) <= (QuantumRange/2))
- {
- SetPixelBackgoundColor(swirl_image,q);
- p+=GetPixelChannels(canvas);
- q+=GetPixelChannels(swirl_image);
- continue;
- }
delta.x=scale.x*(double) (x-center.x);
distance=delta.x*delta.x+delta.y*delta.y;
if (distance >= (radius*radius))
weight;
GetPixelInfo(image,&pixel);
- if (GetPixelWriteMask(image,p) <= (QuantumRange/2))
- {
- SetPixelViaPixelInfo(tint_image,&pixel,q);
- p+=GetPixelChannels(image);
- q+=GetPixelChannels(tint_image);
- continue;
- }
weight=QuantumScale*GetPixelRed(image,p)-0.5;
pixel.red=(MagickRealType) GetPixelRed(image,p)+color_vector.red*
(1.0-(4.0*(weight*weight)));
GetPixelInfo(next,&pixel);
for (x=0; x < (ssize_t) next->columns; x++)
{
- if (GetPixelWriteMask(next,p) <= (QuantumRange/2))
- {
- SetPixelBackgoundColor(append_image,q);
- p+=GetPixelChannels(next);
- q+=GetPixelChannels(append_image);
- continue;
- }
GetPixelInfoPixel(next,p,&pixel);
SetPixelViaPixelInfo(append_image,&pixel,q);
p+=GetPixelChannels(next);
{
switch (type)
{
+ case ReadPixelMask:
+ {
+ SetPixelGray(mask_image,GetPixelReadMask(image,p),q);
+ break;
+ }
case WritePixelMask:
{
SetPixelGray(mask_image,GetPixelWriteMask(image,p),q);
}
default:
{
- SetPixelGray(mask_image,GetPixelReadMask(image,p),q);
+ SetPixelGray(mask_image,GetPixelCompositeMask(image,p),q);
break;
}
}
register ssize_t
i;
- if (GetPixelWriteMask(image,p) <= (QuantumRange/2))
- {
- p+=GetPixelChannels(image);
- continue;
- }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
double
}
for (x=0; x < (ssize_t) image->columns; x++)
{
- if (GetPixelWriteMask(image,q) > (QuantumRange/2))
- SetPixelAlpha(image,alpha,q);
- else if (set_opaque != MagickFalse)
+ if (set_opaque != MagickFalse)
SetPixelAlpha(image,OpaqueAlpha,q);
q+=GetPixelChannels(image);
}
{
switch (type)
{
+ case ReadPixelMask: image->read_mask=MagickFalse; break;
case WritePixelMask: image->write_mask=MagickFalse; break;
- default: image->read_mask=MagickFalse; break;
+ default: image->composite_mask=MagickFalse; break;
}
return(SyncImagePixelCache(image,exception));
}
switch (type)
{
+ case ReadPixelMask: image->read_mask=MagickTrue; break;
case WritePixelMask: image->write_mask=MagickTrue; break;
- default: image->read_mask=MagickTrue; break;
+ default: image->composite_mask=MagickTrue; break;
}
if (SyncImagePixelCache(image,exception) == MagickFalse)
return(MagickFalse);
intensity=GetPixelIntensity(mask,p);
switch (type)
{
+ case ReadPixelMask:
+ {
+ SetPixelReadMask(image,ClampToQuantum(intensity),q);
+ break;
+ }
case WritePixelMask:
{
SetPixelWriteMask(image,ClampToQuantum(intensity),q);
}
default:
{
- SetPixelReadMask(image,ClampToQuantum(intensity),q);
+ SetPixelCompositeMask(image,ClampToQuantum(intensity),q);
break;
}
}
{
switch (type)
{
+ case ReadPixelMask: image->read_mask=MagickFalse; break;
case WritePixelMask: image->write_mask=MagickFalse; break;
- default: image->read_mask=MagickFalse; break;
+ default: image->composite_mask=MagickFalse; break;
}
return(SyncImagePixelCache(image,exception));
}
switch (type)
{
+ case ReadPixelMask: image->read_mask=MagickTrue; break;
case WritePixelMask: image->write_mask=MagickTrue; break;
- default: image->read_mask=MagickTrue; break;
+ default: image->composite_mask=MagickTrue; break;
}
if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse)
return(MagickFalse);
pixel=QuantumRange;
switch (type)
{
+ case ReadPixelMask:
+ {
+ SetPixelReadMask(image,pixel,q);
+ break;
+ }
case WritePixelMask:
{
SetPixelWriteMask(image,pixel,q);
}
default:
{
- SetPixelReadMask(image,pixel,q);
+ SetPixelCompositeMask(image,pixel,q);
break;
}
}
PixelInfo
matte_color; /* current mattecolor attribute */
+
+ MagickBooleanType
+ composite_mask;
};
/*
if ((traits == UndefinedPixelTrait) ||
(morphology_traits == UndefinedPixelTrait))
continue;
- if (((traits & CopyPixelTrait) != 0) ||
- (GetPixelWriteMask(image,p+center) <= (QuantumRange/2)))
+ if ((traits & CopyPixelTrait) != 0)
{
SetPixelChannel(morphology_image,channel,p[center+i],q);
continue;
if ((traits == UndefinedPixelTrait) ||
(morphology_traits == UndefinedPixelTrait))
continue;
- if (((traits & CopyPixelTrait) != 0) ||
- (GetPixelWriteMask(image,p+center) <= (QuantumRange/2)))
+ if ((traits & CopyPixelTrait) != 0)
{
SetPixelChannel(morphology_image,channel,p[center+i],q);
continue;
register ssize_t
x;
- ssize_t
- center;
-
/*
Read virtual pixels, and authentic pixels, from the same image! We read
using virtual to get virtual pixel handling, but write back into the same
status=MagickFalse;
continue;
}
- center=(ssize_t) (GetPixelChannels(image)*width*offset.y+
- GetPixelChannels(image)*offset.x);
for (x=0; x < (ssize_t) image->columns; x++)
{
register ssize_t
traits=GetPixelChannelTraits(image,channel);
if (traits == UndefinedPixelTrait)
continue;
- if (((traits & CopyPixelTrait) != 0) ||
- (GetPixelWriteMask(image,p+center) <= (QuantumRange/2)))
+ if ((traits & CopyPixelTrait) != 0)
continue;
pixels=p;
pixel=(double) QuantumRange;
register ssize_t
x;
- ssize_t
- center;
-
/*
Read virtual pixels, and authentic pixels, from the same image. We
read using virtual to get virtual pixel handling, but write back
}
p+=(image->columns-1)*GetPixelChannels(image);
q+=(image->columns-1)*GetPixelChannels(image);
- center=(ssize_t) (offset.x*GetPixelChannels(image));
for (x=(ssize_t) image->columns-1; x >= 0; x--)
{
register ssize_t
traits=GetPixelChannelTraits(image,channel);
if (traits == UndefinedPixelTrait)
continue;
- if (((traits & CopyPixelTrait) != 0) ||
- (GetPixelWriteMask(image,p+center) <= (QuantumRange/2)))
+ if ((traits & CopyPixelTrait) != 0)
continue;
pixels=p;
pixel=(double) QuantumRange;
{ "Blue", BluePixelChannel, UndefinedOptionFlag, MagickFalse },
{ "Cb", CbPixelChannel, UndefinedOptionFlag, MagickFalse },
{ "Composite", CompositePixelChannel, UndefinedOptionFlag, MagickFalse },
+ { "CompositeMask", CompositeMaskPixelChannel, UndefinedOptionFlag, MagickFalse },
{ "C", CyanPixelChannel, UndefinedOptionFlag, MagickFalse },
{ "Cr", CrPixelChannel, UndefinedOptionFlag, MagickFalse },
{ "Cyan", CyanPixelChannel, UndefinedOptionFlag, MagickFalse },
if ((traits == UndefinedPixelTrait) ||
(paint_traits == UndefinedPixelTrait))
continue;
- if (((paint_traits & CopyPixelTrait) != 0) ||
- (GetPixelWriteMask(linear_image,p) <= (QuantumRange/2)))
+ if ((paint_traits & CopyPixelTrait) != 0)
{
SetPixelChannel(paint_image,channel,p[center+i],q);
continue;
pixel=zero;
for (x=0; x < (ssize_t) image->columns; x++)
{
- if (GetPixelWriteMask(image,q) <= (QuantumRange/2))
- {
- q+=GetPixelChannels(image);
- continue;
- }
GetPixelInfoPixel(image,q,&pixel);
if (IsFuzzyEquivalencePixelInfo(&pixel,&conform_target) != invert)
{
pixel=zero;
for (x=0; x < (ssize_t) image->columns; x++)
{
- if (GetPixelWriteMask(image,q) <= (QuantumRange/2))
- {
- q+=GetPixelChannels(image);
- continue;
- }
GetPixelInfoPixel(image,q,&pixel);
if (IsFuzzyEquivalencePixelInfo(&pixel,target) != invert)
SetPixelAlpha(image,opacity,q);
GetPixelInfo(image,&pixel);
for (x=0; x < (ssize_t) image->columns; x++)
{
- if (GetPixelWriteMask(image,q) <= (QuantumRange/2))
- {
- q+=GetPixelChannels(image);
- continue;
- }
GetPixelInfoPixel(image,q,&pixel);
match=((pixel.red >= low->red) && (pixel.red <= high->red) &&
(pixel.green >= low->green) && (pixel.green <= high->green) &&
return(image->number_channels);
}
+static inline Quantum GetPixelCompositeMask(const Image *magick_restrict image,
+ const Quantum *magick_restrict pixel)
+{
+ if (image->channel_map[CompositeMaskPixelChannel].traits == UndefinedPixelTrait)
+ return((Quantum) QuantumRange);
+ return(pixel[image->channel_map[CompositeMaskPixelChannel].offset]);
+}
+
static inline Quantum GetPixelCr(const Image *magick_restrict image,
const Quantum *magick_restrict pixel)
{
image->channel_map[channel].traits=traits;
}
+static inline void SetPixelCompositeMask(const Image *magick_restrict image,
+ const Quantum mask,Quantum *magick_restrict pixel)
+{
+ if (image->channel_map[CompositeMaskPixelChannel].traits != UndefinedPixelTrait)
+ pixel[image->channel_map[CompositeMaskPixelChannel].offset]=mask;
+}
+
static inline void SetPixelCr(const Image *magick_restrict image,
const Quantum cr,Quantum *magick_restrict pixel)
{
SetPixelChannelAttributes(image,ReadMaskPixelChannel,CopyPixelTrait,n++);
if (image->write_mask != MagickFalse)
SetPixelChannelAttributes(image,WriteMaskPixelChannel,CopyPixelTrait,n++);
+ if (image->composite_mask != MagickFalse)
+ SetPixelChannelAttributes(image,CompositeMaskPixelChannel,CopyPixelTrait,
+ n++);
image->number_channels=(size_t) n;
(void) SetPixelChannelMask(image,image->channel_mask);
}
IndexChannel = 0x0020, /* Color Index Table? */
ReadMaskChannel = 0x0040, /* Pixel is Not Readable? */
WriteMaskChannel = 0x0080, /* Pixel is Write Protected? */
- MetaChannel = 0x0100, /* ???? */
+ MetaChannel = 0x0100, /* not used */
+ CompositeMaskChannel = 0x0200, /* SVG mask */
CompositeChannels = 0x001F,
AllChannels = 0x7ffffff,
/*
ReadMaskPixelChannel = 6,
WriteMaskPixelChannel = 7,
MetaPixelChannel = 8,
+ CompositeMaskPixelChannel = 9,
IntensityPixelChannel = MaxPixelChannels, /* ???? */
CompositePixelChannel = MaxPixelChannels, /* ???? */
SyncPixelChannel = MaxPixelChannels+1 /* not a real channel */
{
UndefinedPixelMask = 0x000000,
ReadPixelMask = 0x000001,
- WritePixelMask = 0x000002
+ WritePixelMask = 0x000002,
+ CompositePixelMask = 0x000004
} PixelMask;
typedef enum
register ssize_t
i;
- if (GetPixelWriteMask(image,q) <= (QuantumRange/2))
- {
- q+=GetPixelChannels(image);
- continue;
- }
Sa=QuantumScale*GetPixelAlpha(image,q);
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
register ssize_t
i;
- if (GetPixelWriteMask(image,q) <= (QuantumRange/2))
- {
- q+=GetPixelChannels(image);
- continue;
- }
Sa=QuantumScale*GetPixelAlpha(image,q);
gamma=PerceptibleReciprocal(Sa);
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
register ssize_t
i;
- if (GetPixelWriteMask(resize_image,q) <= (QuantumRange/2))
- {
- q+=GetPixelChannels(resize_image);
- continue;
- }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
PixelChannel
register ssize_t
i;
- if (GetPixelWriteMask(image,tile_pixels) <= (QuantumRange/2))
- {
- tile_pixels-=width*GetPixelChannels(image);
- q+=GetPixelChannels(rotate_image);
- continue;
- }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
PixelChannel channel = GetPixelChannelChannel(image,i);
i;
q-=GetPixelChannels(rotate_image);
- if (GetPixelWriteMask(image,p) <= (QuantumRange/2))
- {
- p+=GetPixelChannels(image);
- continue;
- }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
PixelChannel channel = GetPixelChannelChannel(image,i);
register ssize_t
i;
- if (GetPixelWriteMask(image,tile_pixels) <= (QuantumRange/2))
- {
- tile_pixels+=width*GetPixelChannels(image);
- q+=GetPixelChannels(rotate_image);
- continue;
- }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
PixelChannel channel = GetPixelChannelChannel(image,i);
register ssize_t
i;
- if (GetPixelWriteMask(next,p) <= (QuantumRange/2))
- {
- p+=GetPixelChannels(next);
- continue;
- }
for (i=0; i < (ssize_t) GetPixelChannels(next); i++)
{
PixelChannel channel = GetPixelChannelChannel(image,i);
register ssize_t
i;
- if (GetPixelWriteMask(image,q) <= (QuantumRange/2))
- {
- q+=GetPixelChannels(image);
- continue;
- }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
PixelChannel channel = GetPixelChannelChannel(image,i);
PixelTrait traits = GetPixelChannelTraits(image,channel);
if (traits == UndefinedPixelTrait)
continue;
- if (((traits & CopyPixelTrait) != 0) ||
- (GetPixelWriteMask(image,q) <= (QuantumRange/2)))
+ if ((traits & CopyPixelTrait) != 0)
continue;
if ((traits & UpdatePixelTrait) == 0)
continue;
register ssize_t
i;
- if (GetPixelWriteMask(image,q) <= (QuantumRange/2))
- {
- q+=GetPixelChannels(image);
- continue;
- }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
PixelChannel channel = GetPixelChannelChannel(image,i);
register ssize_t
i;
- if (GetPixelWriteMask(image,p) <= (QuantumRange/2))
- {
- p+=GetPixelChannels(image);
- continue;
- }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
PixelChannel channel = GetPixelChannelChannel(image,i);
register ssize_t
i;
- if (GetPixelWriteMask(image,p) <= (QuantumRange/2))
- {
- p+=GetPixelChannels(image);
- continue;
- }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
PixelChannel channel = GetPixelChannelChannel(image,i);
register ssize_t
i;
- if (GetPixelWriteMask(image,p) <= (QuantumRange/2))
- {
- p+=GetPixelChannels(image);
- continue;
- }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
PixelChannel channel = GetPixelChannelChannel(image,i);
register ssize_t
i;
- if (GetPixelWriteMask(image,p) <= (QuantumRange/2))
- {
- p+=GetPixelChannels(image);
- continue;
- }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
PixelChannel channel = GetPixelChannelChannel(image,i);
register ssize_t
i;
- if (GetPixelWriteMask(next,p) <= (QuantumRange/2))
- {
- p+=GetPixelChannels(next);
- continue;
- }
for (i=0; i < (ssize_t) GetPixelChannels(next); i++)
{
MagickRealType
register ssize_t
i;
- if (GetPixelWriteMask(image,q) <= (QuantumRange/2))
- {
- q+=GetPixelChannels(image);
- continue;
- }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
PixelChannel channel = GetPixelChannelChannel(image,i);
if ((traits == UndefinedPixelTrait) ||
(threshold_traits == UndefinedPixelTrait))
continue;
- if (((threshold_traits & CopyPixelTrait) != 0) ||
- (GetPixelWriteMask(image,p) <= (QuantumRange/2)))
+ if ((threshold_traits & CopyPixelTrait) != 0)
{
SetPixelChannel(threshold_image,channel,p[center+i],q);
continue;
if ((traits == UndefinedPixelTrait) ||
(threshold_traits == UndefinedPixelTrait))
continue;
- if (((threshold_traits & CopyPixelTrait) != 0) ||
- (GetPixelWriteMask(image,p) <= (QuantumRange/2)))
+ if ((threshold_traits & CopyPixelTrait) != 0)
{
SetPixelChannel(threshold_image,channel,p[center+i],q);
continue;
register ssize_t
i;
- if (GetPixelWriteMask(image,q) <= (QuantumRange/2))
- {
- q+=GetPixelChannels(image);
- continue;
- }
pixel=GetPixelIntensity(image,q);
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
register ssize_t
i;
- if (GetPixelWriteMask(image,q) <= (QuantumRange/2))
- {
- q+=GetPixelChannels(image);
- continue;
- }
pixel=GetPixelIntensity(image,q);
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
register ssize_t
i;
- if (GetPixelWriteMask(image,q) <= (QuantumRange/2))
- {
- q+=GetPixelChannels(image);
- continue;
- }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
PixelChannel channel = GetPixelChannelChannel(image,i);
n;
n=0;
- if (GetPixelWriteMask(image,q) <= (QuantumRange/2))
- {
- q+=GetPixelChannels(image);
- continue;
- }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
ssize_t
register ssize_t
i;
- if (GetPixelWriteMask(image,q) <= (QuantumRange/2))
- {
- q+=GetPixelChannels(image);
- continue;
- }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
PixelChannel channel = GetPixelChannelChannel(image,i);
register ssize_t
i;
- if (GetPixelWriteMask(image,q) <= (QuantumRange/2))
- {
- q+=GetPixelChannels(image);
- continue;
- }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
double
register ssize_t
i;
- if (GetPixelWriteMask(image,q) <= (QuantumRange/2))
- {
- q+=GetPixelChannels(image);
- continue;
- }
pixel=GetPixelIntensity(image,q);
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
register ssize_t
i;
- if (GetPixelWriteMask(image,p) <= (QuantumRange/2))
- {
- SetPixelBackgoundColor(crop_image,q);
- p+=GetPixelChannels(image);
- q+=GetPixelChannels(crop_image);
- continue;
- }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
PixelChannel channel = GetPixelChannelChannel(image,i);
register ssize_t
i;
- if (GetPixelWriteMask(image,p) <= (QuantumRange/2))
- {
- SetPixelBackgoundColor(excerpt_image,q);
- p+=GetPixelChannels(image);
- q+=GetPixelChannels(excerpt_image);
- continue;
- }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
PixelChannel channel = GetPixelChannelChannel(image,i);
register ssize_t
i;
- if (GetPixelWriteMask(image,p) <= (QuantumRange/2))
- {
- SetPixelBackgoundColor(flip_image,q);
- p+=GetPixelChannels(image);
- q+=GetPixelChannels(flip_image);
- continue;
- }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
PixelChannel channel = GetPixelChannelChannel(image,i);
i;
q-=GetPixelChannels(flop_image);
- if (GetPixelWriteMask(image,p) <= (QuantumRange/2))
- {
- p+=GetPixelChannels(image);
- continue;
- }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
PixelChannel channel = GetPixelChannelChannel(image,i);
register ssize_t
i;
- if (GetPixelWriteMask(source,p) <= (QuantumRange/2))
- {
- SetPixelBackgoundColor(destination,q);
- p+=GetPixelChannels(source);
- q+=GetPixelChannels(destination);
- continue;
- }
for (i=0; i < (ssize_t) GetPixelChannels(source); i++)
{
PixelChannel channel = GetPixelChannelChannel(source,i);
register ssize_t
i;
- if (GetPixelWriteMask(image,p) <= (QuantumRange/2))
- {
- SetPixelBackgoundColor(splice_image,q);
- p+=GetPixelChannels(image);
- q+=GetPixelChannels(splice_image);
- continue;
- }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
PixelChannel channel = GetPixelChannelChannel(image,i);
register ssize_t
i;
- if (GetPixelWriteMask(image,p) <= (QuantumRange/2))
- {
- SetPixelBackgoundColor(splice_image,q);
- p+=GetPixelChannels(image);
- q+=GetPixelChannels(splice_image);
- continue;
- }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
PixelChannel channel = GetPixelChannelChannel(image,i);
register ssize_t
i;
- if (GetPixelWriteMask(image,q) <= (QuantumRange/2))
- {
- SetPixelBackgoundColor(splice_image,q);
- p+=GetPixelChannels(image);
- q+=GetPixelChannels(splice_image);
- continue;
- }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
PixelChannel channel = GetPixelChannelChannel(image,i);
register ssize_t
i;
- if (GetPixelWriteMask(image,q) <= (QuantumRange/2))
- {
- SetPixelBackgoundColor(splice_image,q);
- p+=GetPixelChannels(image);
- q+=GetPixelChannels(splice_image);
- continue;
- }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
PixelChannel channel = GetPixelChannelChannel(image,i);
register ssize_t
i;
- if (GetPixelWriteMask(image,q) <= (QuantumRange/2))
- {
- SetPixelBackgoundColor(transpose_image,q);
- p+=GetPixelChannels(image);
- q+=GetPixelChannels(transpose_image);
- continue;
- }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
PixelChannel channel = GetPixelChannelChannel(image,i);
i;
q-=GetPixelChannels(transverse_image);
- if (GetPixelWriteMask(image,p) <= (QuantumRange/2))
- {
- p+=GetPixelChannels(image);
- continue;
- }
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
PixelChannel channel = GetPixelChannelChannel(image,i);
}
if (LocaleCompare("clip-mask",option+1) == 0)
{
- CacheView
- *mask_view;
-
Image
- *mask_image;
-
- register Quantum
- *magick_restrict q;
-
- register ssize_t
- x;
-
- ssize_t
- y;
+ *clip_mask;
(void) SyncImageSettings(mogrify_info,*image,exception);
if (*option == '+')
/*
Remove a mask.
*/
- (void) SetImageMask(*image,ReadPixelMask,(Image *) NULL,
+ (void) SetImageMask(*image,WritePixelMask,(Image *) NULL,
exception);
break;
}
/*
Set the image mask.
- FUTURE: This Should Be a SetImageAlphaChannel() call, Or two.
*/
- mask_image=GetImageCache(mogrify_info,argv[i+1],exception);
- if (mask_image == (Image *) NULL)
+ clip_mask=GetImageCache(mogrify_info,argv[i+1],exception);
+ if (clip_mask == (Image *) NULL)
break;
- if (SetImageStorageClass(mask_image,DirectClass,exception) == MagickFalse)
- return(MagickFalse);
- mask_view=AcquireAuthenticCacheView(mask_image,exception);
- for (y=0; y < (ssize_t) mask_image->rows; y++)
- {
- q=GetCacheViewAuthenticPixels(mask_view,0,y,mask_image->columns,1,
- exception);
- if (q == (Quantum *) NULL)
- break;
- for (x=0; x < (ssize_t) mask_image->columns; x++)
- {
- if (mask_image->alpha_trait == UndefinedPixelTrait)
- SetPixelAlpha(mask_image,(Quantum)
- GetPixelIntensity(mask_image,q),q);
- SetPixelRed(mask_image,GetPixelAlpha(mask_image,q),q);
- SetPixelGreen(mask_image,GetPixelAlpha(mask_image,q),q);
- SetPixelBlue(mask_image,GetPixelAlpha(mask_image,q),q);
- q+=GetPixelChannels(mask_image);
- }
- if (SyncCacheViewAuthenticPixels(mask_view,exception) == MagickFalse)
- break;
- }
- mask_view=DestroyCacheView(mask_view);
- mask_image->alpha_trait=BlendPixelTrait;
- (void) SetImageMask(*image,ReadPixelMask,mask_image,exception);
+ (void) SetImageMask(*image,WritePixelMask,clip_mask,exception);
+ clip_mask=DestroyImage(clip_mask);
break;
}
if (LocaleCompare("clip-path",option+1) == 0)
}
if (LocaleCompare("clip-mask",option+1) == 0)
{
- /* Note: arguments do not have percent escapes expanded */
- CacheView
- *mask_view;
-
Image
- *mask_image;
-
- register Quantum
- *magick_restrict q;
-
- register ssize_t
- x;
-
- ssize_t
- y;
+ *clip_mask;
if (IfPlusOp) {
/* use "+clip-mask" Remove the write mask for -clip-path */
- (void) SetImageMask(_image,ReadPixelMask,(Image *) NULL,_exception);
+ (void) SetImageMask(_image,WritePixelMask,(Image *) NULL,_exception);
break;
}
- mask_image=GetImageCache(_image_info,arg1,_exception);
- if (mask_image == (Image *) NULL)
+ clip_mask=GetImageCache(_image_info,arg1,_exception);
+ if (clip_mask == (Image *) NULL)
break;
- if (SetImageStorageClass(mask_image,DirectClass,_exception) == MagickFalse)
- break;
- /* Create a write mask from cli_wand mask image */
- /* FUTURE: use Alpha operations instead and create a Grey Image */
- mask_view=AcquireAuthenticCacheView(mask_image,_exception);
- for (y=0; y < (ssize_t) mask_image->rows; y++)
- {
- q=GetCacheViewAuthenticPixels(mask_view,0,y,mask_image->columns,1,
- _exception);
- if (q == (Quantum *) NULL)
- break;
- for (x=0; x < (ssize_t) mask_image->columns; x++)
- {
- if (mask_image->alpha_trait == UndefinedPixelTrait)
- SetPixelAlpha(mask_image,(Quantum)
- GetPixelIntensity(mask_image,q),q);
- SetPixelGray(mask_image,GetPixelAlpha(mask_image,q),q);
- q+=GetPixelChannels(mask_image);
- }
- if (SyncCacheViewAuthenticPixels(mask_view,_exception) == MagickFalse)
- break;
- }
- /* clean up and set the write mask */
- mask_view=DestroyCacheView(mask_view);
- mask_image->alpha_trait=BlendPixelTrait;
- (void) SetImageColorspace(_image,GRAYColorspace,_exception);
- (void) SetImageMask(_image,ReadPixelMask,mask_image,_exception);
- mask_image=DestroyImage(mask_image);
+ (void) SetImageMask(_image,WritePixelMask,clip_mask,_exception);
+ clip_mask=DestroyImage(clip_mask);
break;
}
if (LocaleCompare("clip-path",option+1) == 0)