if (filteredImageBuffer == (cl_mem) NULL)
goto cleanup;
- blurCenter.s[0]=(float) (image->columns-1)/2.0;
- blurCenter.s[1]=(float) (image->rows-1)/2.0;
+ blurCenter.x=(float) (image->columns-1)/2.0;
+ blurCenter.y=(float) (image->rows-1)/2.0;
blurRadius=hypot(blurCenter.x,blurCenter.y);
cossin_theta_size=(unsigned int) fabs(4.0*DegreesToRadians(angle)*sqrt(
(double) blurRadius)+2UL);
n;
digit=MagickFalse;
- width=0;
q=draw_info->text;
s=(char *) NULL;
for (p=(*caption); GetUTFCode(p) != 0; p+=GetUTFOctets(p))
q=draw_info->text;
s=(char *) NULL;
}
- if (width > image->columns)
- {
- char
- *text;
-
- /*
- No convenient break point, force one.
- */
- text=AcquireString(draw_info->text);
- q=draw_info->text;
- s=(char *) NULL;
- for (p=(*caption); GetUTFCode(p) != 0; p+=GetUTFOctets(p))
- {
- if (IsUTFSpace(GetUTFCode(p)) != MagickFalse)
- s=p;
- if (GetUTFCode(p) == '\n')
- q=draw_info->text;
- for (i=0; i < (ssize_t) GetUTFOctets(p); i++)
- *q++=(*(p+i));
- *q='\0';
- status=GetTypeMetrics(image,draw_info,metrics,exception);
- if (status == MagickFalse)
- break;
- width=(size_t) floor(metrics->width+draw_info->stroke_width+0.5);
- if ((width <= image->columns) || (strcmp(text,draw_info->text) == 0))
- continue;
- (void) strcpy(text,draw_info->text);
- if ((s != (char *) NULL) && (GetUTFOctets(s) == 1))
- {
- *s='\n';
- p=s;
- }
- else
- if ((s != (char *) NULL) || (split != MagickFalse))
- {
- char
- *target;
-
- /*
- No convenient line breaks-- insert newline.
- */
- target=AcquireString(*caption);
- n=p-(*caption);
- CopyMagickString(target,*caption,n+1);
- ConcatenateMagickString(target,"\n",strlen(*caption)+1);
- ConcatenateMagickString(target,p,strlen(*caption)+2);
- (void) DestroyString(*caption);
- *caption=target;
- p=(*caption)+n;
- }
- q=draw_info->text;
- s=(char *) NULL;
- }
- text=DestroyString(text);
- }
n=0;
for (p=(*caption); GetUTFCode(p) != 0; p+=GetUTFOctets(p))
if (GetUTFCode(p) == '\n')
continue;
for (x=0; x < (ssize_t) image->columns; x++)
{
- if (GetPixelWriteMask(image,p) == QuantumRange)
+ if (GetPixelReadMask(image,p) == 0)
{
p+=GetPixelChannels(image);
continue;
continue;
for (x=0; x < (ssize_t) image->columns; x++)
{
- if (GetPixelWriteMask(image,p) == QuantumRange)
+ if (GetPixelReadMask(image,p) == 0)
{
p+=GetPixelChannels(image);
continue;
type=UndefinedType;
break;
}
- if ((type == BilevelType) && (IsPixelMonochrome(image,p) == MagickFalse))
+ if ((type == BilevelType) &&
+ (IsPixelMonochrome(image,p) == MagickFalse))
type=GrayscaleType;
p+=GetPixelChannels(image);
}
register ssize_t
i;
- if (GetPixelWriteMask(image,q) == QuantumRange)
+ if (GetPixelReadMask(image,q) == 0)
{
q+=GetPixelChannels(image);
continue;
register ssize_t
i;
- if (GetPixelWriteMask(image,q) == QuantumRange)
+ if (GetPixelReadMask(image,q) == 0)
{
q+=GetPixelChannels(image);
continue;
{
case UndefinedColorspace:
case sRGBColorspace:
- {
+ {
if (GetImageListLength(image) > 3)
combine_image->alpha_trait=BlendPixelTrait;
break;
break;
}
case CMYKColorspace:
- {
+ {
if (GetImageListLength(image) > 4)
combine_image->alpha_trait=BlendPixelTrait;
break;
register ssize_t
i;
- if (GetPixelWriteMask(image,p) == QuantumRange)
+ if (GetPixelReadMask(image,p) == 0)
{
SetPixelBackgoundColor(separate_image,q);
p+=GetPixelChannels(image);
{
double
gamma;
-
+
register ssize_t
i;
-
- if (GetPixelWriteMask(image,q) == QuantumRange)
+
+ if (GetPixelReadMask(image,q) == 0)
{
q+=GetPixelChannels(image);
continue;
return(status);
}
case CopyAlphaChannel:
+ case ShapeAlphaChannel:
{
/*
Copy pixel intensity to the alpha channel.
*/
- image->alpha_trait=BlendPixelTrait;
+ image->alpha_trait=UpdatePixelTrait;
status=CompositeImage(image,image,IntensityCompositeOp,MagickTrue,0,0,
exception);
+ if (alpha_type == ShapeAlphaChannel)
+ (void) LevelImageColors(image,&image->background_color,
+ &image->background_color,MagickTrue,exception);
break;
}
case DeactivateAlphaChannel:
for (x=0; x < (ssize_t) image->columns; x++)
{
double
- gamma,
+ gamma,
Sa;
register ssize_t
i;
- if (GetPixelWriteMask(image,q) == QuantumRange)
+ if (GetPixelReadMask(image,q) == 0)
{
q+=GetPixelChannels(image);
continue;
status=SetImageAlpha(image,OpaqueAlpha,exception);
break;
}
- case ShapeAlphaChannel:
- {
- PixelInfo
- background;
-
- /*
- Shape alpha channel.
- */
- image->alpha_trait=BlendPixelTrait;
- status=SetImageStorageClass(image,DirectClass,exception);
- if (status == MagickFalse)
- break;
- ConformPixelInfo(image,&image->background_color,&background,exception);
- status=MagickTrue;
- image_view=AcquireAuthenticCacheView(image,exception);
- for (y=0; y < (ssize_t) image->rows; y++)
- {
- register Quantum
- *magick_restrict q;
-
- register ssize_t
- x;
-
- if (status == MagickFalse)
- continue;
- q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,
- exception);
- if (q == (Quantum *) NULL)
- {
- status=MagickFalse;
- continue;
- }
- for (x=0; x < (ssize_t) image->columns; x++)
- {
- if (GetPixelWriteMask(image,q) == QuantumRange)
- {
- q+=GetPixelChannels(image);
- continue;
- }
- if (fabs(GetPixelIntensity(image,q)) > MagickEpsilon)
- SetPixelViaPixelInfo(image,&background,q);
- q+=GetPixelChannels(image);
- }
- if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
- status=MagickFalse;
- }
- image_view=DestroyCacheView(image_view);
- break;
- }
case TransparentAlphaChannel:
{
status=SetImageAlpha(image,TransparentAlpha,exception);
double
area,
- gamma,
maximum_error,
mean_error;
}
reconstruct_view=DestroyCacheView(reconstruct_view);
image_view=DestroyCacheView(image_view);
- gamma=PerceptibleReciprocal(area);
- image->error.mean_error_per_pixel=gamma*distortion[CompositePixelChannel];
- image->error.normalized_mean_error=gamma*QuantumScale*QuantumScale*mean_error;
+ image->error.mean_error_per_pixel=distortion[CompositePixelChannel]/area;
+ image->error.normalized_mean_error=QuantumScale*QuantumScale*mean_error/area;
image->error.normalized_maximum_error=QuantumScale*maximum_error;
return(status);
}
double
area,
- gamma,
maximum_error,
mean_error,
mean_error_per_pixel;
}
reconstruct_view=DestroyCacheView(reconstruct_view);
image_view=DestroyCacheView(image_view);
- gamma=PerceptibleReciprocal(area);
- image->error.mean_error_per_pixel=gamma*mean_error_per_pixel;
- image->error.normalized_mean_error=gamma*QuantumScale*QuantumScale*mean_error;
- image->error.normalized_maximum_error=(double) QuantumScale*maximum_error;
+ image->error.mean_error_per_pixel=(double) (mean_error_per_pixel/area);
+ image->error.normalized_mean_error=(double) (QuantumScale*QuantumScale*
+ mean_error/area);
+ image->error.normalized_maximum_error=(double) (QuantumScale*maximum_error);
status=image->error.mean_error_per_pixel == 0.0 ? MagickTrue : MagickFalse;
return(status);
}
*luma=QuantumScale*(0.298839*r+0.586811*g+0.114350*b);
}
+static MagickBooleanType CompositeOverImage(Image *image,
+ const Image *source_image,const MagickBooleanType clip_to_self,
+ const ssize_t x_offset,const ssize_t y_offset,ExceptionInfo *exception)
+{
+#define CompositeImageTag "Composite/Image"
+
+ CacheView
+ *image_view,
+ *source_view;
+
+ const char
+ *value;
+
+ MagickBooleanType
+ clamp,
+ status;
+
+ MagickOffsetType
+ progress;
+
+ ssize_t
+ y;
+
+ /*
+ Composite image.
+ */
+ status=MagickTrue;
+ progress=0;
+ clamp=MagickTrue;
+ value=GetImageArtifact(image,"compose:clamp");
+ if (value != (const char *) NULL)
+ clamp=IsStringTrue(value);
+ source_view=AcquireVirtualCacheView(source_image,exception);
+ image_view=AcquireAuthenticCacheView(image,exception);
+#if defined(MAGICKCORE_OPENMP_SUPPORT)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ magick_threads(source_image,image,image->rows,1)
+#endif
+ for (y=0; y < (ssize_t) image->rows; y++)
+ {
+ const Quantum
+ *pixels;
+
+ register const Quantum
+ *magick_restrict p;
+
+ register Quantum
+ *magick_restrict q;
+
+ register ssize_t
+ x;
+
+ size_t
+ channels;
+
+ if (status == MagickFalse)
+ continue;
+ if (clip_to_self != MagickFalse)
+ {
+ if (y < y_offset)
+ continue;
+ if ((y-y_offset) >= (ssize_t) source_image->rows)
+ continue;
+ }
+ /*
+ If pixels is NULL, y is outside overlay region.
+ */
+ pixels=(Quantum *) NULL;
+ p=(Quantum *) NULL;
+ if ((y >= y_offset) && ((y-y_offset) < (ssize_t) source_image->rows))
+ {
+ p=GetCacheViewVirtualPixels(source_view,0,y-y_offset,
+ source_image->columns,1,exception);
+ if (p == (const Quantum *) NULL)
+ {
+ status=MagickFalse;
+ continue;
+ }
+ pixels=p;
+ if (x_offset < 0)
+ p-=x_offset*GetPixelChannels(source_image);
+ }
+ q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,exception);
+ if (q == (Quantum *) NULL)
+ {
+ status=MagickFalse;
+ continue;
+ }
+ for (x=0; x < (ssize_t) image->columns; x++)
+ {
+ MagickRealType
+ Da,
+ Dc,
+ Dca,
+ gamma,
+ Sa,
+ Sc,
+ Sca;
+
+ register ssize_t
+ i;
+
+ if (clip_to_self != MagickFalse)
+ {
+ if (x < x_offset)
+ {
+ q+=GetPixelChannels(image);
+ continue;
+ }
+ if ((x-x_offset) >= (ssize_t) source_image->columns)
+ break;
+ }
+ if ((pixels == (Quantum *) NULL) || (x < x_offset) ||
+ ((x-x_offset) >= (ssize_t) source_image->columns))
+ {
+ Quantum
+ source[MaxPixelChannels];
+
+ /*
+ Virtual composite:
+ Sc: source color.
+ Dc: canvas color.
+ */
+ if (GetPixelReadMask(image,q) == 0)
+ {
+ q+=GetPixelChannels(image);
+ continue;
+ }
+ (void) GetOneVirtualPixel(source_image,x-x_offset,y-y_offset,
+ source,exception);
+ for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
+ {
+ PixelChannel channel=GetPixelChannelChannel(image,i);
+ PixelTrait traits=GetPixelChannelTraits(image,channel);
+ PixelTrait source_traits=GetPixelChannelTraits(source_image,
+ channel);
+ if ((traits == UndefinedPixelTrait) ||
+ (source_traits == UndefinedPixelTrait))
+ continue;
+ q[i]=source[channel];
+ }
+ q+=GetPixelChannels(image);
+ continue;
+ }
+ /*
+ Authentic composite:
+ Sa: normalized source alpha.
+ Da: normalized canvas alpha.
+ */
+ if (GetPixelReadMask(source_image,p) == 0)
+ {
+ p+=GetPixelChannels(source_image);
+ channels=GetPixelChannels(source_image);
+ if (p >= (pixels+channels*source_image->columns))
+ p=pixels;
+ q+=GetPixelChannels(image);
+ continue;
+ }
+ Sa=QuantumScale*GetPixelAlpha(source_image,p);
+ Da=QuantumScale*GetPixelAlpha(image,q);
+ gamma=Sa+Da-Sa*Da;
+ gamma=PerceptibleReciprocal(gamma);
+ for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
+ {
+ PixelChannel channel=GetPixelChannelChannel(image,i);
+ PixelTrait traits=GetPixelChannelTraits(image,channel);
+ PixelTrait source_traits=GetPixelChannelTraits(source_image,
+ channel);
+ if ((traits == UndefinedPixelTrait) ||
+ (source_traits == UndefinedPixelTrait))
+ continue;
+ if ((traits & CopyPixelTrait) != 0)
+ {
+ /*
+ Copy channel.
+ */
+ q[i]=GetPixelChannel(source_image,channel,p);
+ continue;
+ }
+ if (channel == AlphaPixelChannel)
+ {
+ /*
+ Set alpha channel.
+ */
+ q[i]=clamp != MagickFalse ?
+ ClampPixel(QuantumRange*(Sa+Da-Sa*Da)) :
+ ClampToQuantum(QuantumRange*(Sa+Da-Sa*Da));
+ continue;
+ }
+ /*
+ Sc: source color.
+ Dc: canvas color.
+ */
+ Sc=(MagickRealType) GetPixelChannel(source_image,channel,p);
+ Dc=(MagickRealType) q[i];
+ Sca=QuantumScale*Sa*Sc;
+ Dca=QuantumScale*Da*Dc;
+ q[i]=clamp != MagickFalse ?
+ ClampPixel(gamma*QuantumRange*(Sca+Dca*(1.0-Sa))) :
+ ClampToQuantum(gamma*QuantumRange*(Sca+Dca*(1.0-Sa)));
+ }
+ p+=GetPixelChannels(source_image);
+ channels=GetPixelChannels(source_image);
+ if (p >= (pixels+channels*source_image->columns))
+ p=pixels;
+ q+=GetPixelChannels(image);
+ }
+ if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
+ status=MagickFalse;
+ if (image->progress_monitor != (MagickProgressMonitor) NULL)
+ {
+ MagickBooleanType
+ proceed;
+
+#if defined(MAGICKCORE_OPENMP_SUPPORT)
+ #pragma omp critical (MagickCore_CompositeImage)
+#endif
+ proceed=SetImageProgress(image,CompositeImageTag,progress++,
+ image->rows);
+ if (proceed == MagickFalse)
+ status=MagickFalse;
+ }
+ }
+ source_view=DestroyCacheView(source_view);
+ image_view=DestroyCacheView(image_view);
+ return(status);
+}
+
MagickExport MagickBooleanType CompositeImage(Image *image,
const Image *composite,const CompositeOperator compose,
const MagickBooleanType clip_to_self,const ssize_t x_offset,
if (IsGrayColorspace(image->colorspace) != MagickFalse)
(void) SetImageColorspace(image,sRGBColorspace,exception);
(void) SetImageColorspace(source_image,image->colorspace,exception);
+ if ((compose == OverCompositeOp) || (compose == SrcOverCompositeOp))
+ {
+ status=CompositeOverImage(image,source_image,clip_to_self,x_offset,
+ y_offset,exception);
+ source_image=DestroyImage(source_image);
+ return(status);
+ }
amount=0.5;
canvas_image=(Image *) NULL;
canvas_dissolve=1.0;
register ssize_t
i;
- if (GetPixelWriteMask(source_image,p) == QuantumRange)
+ if (GetPixelReadMask(source_image,p) == 0)
{
p+=GetPixelChannels(source_image);
q+=GetPixelChannels(image);
}
for (x=0; x < (ssize_t) source_image->columns; x++)
{
- if (GetPixelWriteMask(source_image,p) == QuantumRange)
+ if (GetPixelReadMask(source_image,p) == 0)
{
p+=GetPixelChannels(source_image);
q+=GetPixelChannels(image);
*/
(void) GetOneVirtualPixel(source_image,x-x_offset,y-y_offset,source,
exception);
- if (GetPixelWriteMask(image,q) == QuantumRange)
+ if (GetPixelReadMask(image,q) == 0)
{
q+=GetPixelChannels(image);
continue;
break;
}
}
- if (GetPixelWriteMask(image,q) == QuantumRange)
+ if (GetPixelReadMask(image,q) == 0)
{
p+=GetPixelChannels(source_image);
q+=GetPixelChannels(image);
register ssize_t
i;
- if (GetPixelWriteMask(image,q) == QuantumRange)
+ if (GetPixelReadMask(image,q) == 0)
{
p+=GetPixelChannels(texture_image);
q+=GetPixelChannels(image);
register ssize_t
i;
- if (GetPixelWriteMask(image,q) == QuantumRange)
+ if (GetPixelReadMask(image,q) == 0)
{
SetPixelBackgoundColor(frame_image,q);
p+=GetPixelChannels(image);
}
for (x=0; x < y; x++)
{
- if (GetPixelWriteMask(image,q) == QuantumRange)
+ if (GetPixelReadMask(image,q) == 0)
{
q+=GetPixelChannels(image);
continue;
}
for ( ; x < (ssize_t) (image->columns-y); x++)
{
- if (GetPixelWriteMask(image,q) == QuantumRange)
+ if (GetPixelReadMask(image,q) == 0)
{
q+=GetPixelChannels(image);
continue;
}
for ( ; x < (ssize_t) image->columns; x++)
{
- if (GetPixelWriteMask(image,q) == QuantumRange)
+ if (GetPixelReadMask(image,q) == 0)
{
q+=GetPixelChannels(image);
continue;
}
for (x=0; x < (ssize_t) raise_info->width; x++)
{
- if (GetPixelWriteMask(image,q) == QuantumRange)
+ if (GetPixelReadMask(image,q) == 0)
{
q+=GetPixelChannels(image);
continue;
q+=GetPixelChannels(image);
for ( ; x < (ssize_t) image->columns; x++)
{
- if (GetPixelWriteMask(image,q) == QuantumRange)
+ if (GetPixelReadMask(image,q) == 0)
{
q+=GetPixelChannels(image);
continue;
}
for (x=0; x < (ssize_t) (image->rows-y); x++)
{
- if (GetPixelWriteMask(image,q) == QuantumRange)
+ if (GetPixelReadMask(image,q) == 0)
{
q+=GetPixelChannels(image);
continue;
}
for ( ; x < (ssize_t) image->columns; x++)
{
- if (GetPixelWriteMask(image,q) == QuantumRange)
+ if (GetPixelReadMask(image,q) == 0)
{
q+=GetPixelChannels(image);
continue;
clip_mask=CloneImage(image,image->columns,image->rows,MagickTrue,exception);
if (clip_mask == (Image *) NULL)
return(MagickFalse);
- (void) QueryColorCompliance("#ffffff",AllCompliance,
+ (void) QueryColorCompliance("#0000",AllCompliance,
&clip_mask->background_color,exception);
clip_mask->background_color.alpha=(MagickRealType) TransparentAlpha;
(void) SetImageBackgroundColor(clip_mask,exception);
draw_info->clip_mask);
clone_info=CloneDrawInfo((ImageInfo *) NULL,draw_info);
(void) CloneString(&clone_info->primitive,value);
- (void) QueryColorCompliance("#000000",AllCompliance,&clone_info->fill,
+ (void) QueryColorCompliance("#ffffff",AllCompliance,&clone_info->fill,
exception);
- if (clone_info->clip_mask != (char *) NULL)
- clone_info->clip_mask=DestroyString(clone_info->clip_mask);
- status=DrawImage(clip_mask,clone_info,exception);
+ clone_info->clip_mask=(char *) NULL;
+ status=NegateImage(clip_mask,MagickFalse,exception);
(void) SetImageMask(image,ReadPixelMask,clip_mask,exception);
clip_mask=DestroyImage(clip_mask);
+ status&=DrawImage(image,clone_info,exception);
clone_info=DestroyDrawInfo(clone_info);
if (image->debug != MagickFalse)
(void) LogMagickEvent(DrawEvent,GetMagickModule(),"end clip-path");
draw_info->fill_rule=EvenOddRule;
draw_info->fill_alpha=OpaqueAlpha;
draw_info->stroke_alpha=OpaqueAlpha;
- draw_info->alpha=OpaqueAlpha;
draw_info->linecap=ButtCap;
draw_info->linejoin=MiterJoin;
draw_info->miterlimit=10;
(blur_traits == UndefinedPixelTrait))
continue;
if (((blur_traits & CopyPixelTrait) != 0) ||
- (GetPixelWriteMask(image,p+center) == QuantumRange))
+ (GetPixelReadMask(image,p+center) == 0))
{
SetPixelChannel(blur_image,channel,p[center+i],q);
continue;
(sharp_traits == UndefinedPixelTrait))
continue;
if (((sharp_traits & CopyPixelTrait) != 0) ||
- (GetPixelWriteMask(image,p+center) == QuantumRange))
+ (GetPixelReadMask(image,p+center) == 0))
{
SetPixelChannel(sharp_image,channel,p[center+i],q);
continue;
(blur_traits == UndefinedPixelTrait))
continue;
if (((blur_traits & CopyPixelTrait) != 0) ||
- (GetPixelWriteMask(image,p) == QuantumRange))
+ (GetPixelReadMask(image,p) == 0))
{
SetPixelChannel(blur_image,channel,p[i],q);
continue;
(blur_traits == UndefinedPixelTrait))
continue;
if (((blur_traits & CopyPixelTrait) != 0) ||
- (GetPixelWriteMask(image,p) == QuantumRange))
+ (GetPixelReadMask(image,p) == 0))
{
SetPixelChannel(blur_image,channel,p[i],q);
continue;
(blur_traits == UndefinedPixelTrait))
continue;
if (((blur_traits & CopyPixelTrait) != 0) ||
- (GetPixelWriteMask(image,p+center) == QuantumRange))
+ (GetPixelReadMask(image,p+center) == 0))
{
SetPixelChannel(blur_image,channel,p[center+i],q);
continue;
(shade_traits == UndefinedPixelTrait))
continue;
if (((shade_traits & CopyPixelTrait) != 0) ||
- (GetPixelWriteMask(linear_image,center) == QuantumRange))
+ (GetPixelReadMask(linear_image,center) == 0))
{
SetPixelChannel(shade_image,channel,center[i],q);
continue;
(unsharp_traits == UndefinedPixelTrait))
continue;
if (((unsharp_traits & CopyPixelTrait) != 0) ||
- (GetPixelWriteMask(image,p) == QuantumRange))
+ (GetPixelReadMask(image,p) == 0))
{
SetPixelChannel(unsharp_image,channel,p[i],q);
continue;
PixelTrait
traits;
- if (GetPixelWriteMask(image,q) == QuantumRange)
+ if (GetPixelReadMask(image,q) == 0)
{
q+=GetPixelChannels(image);
continue;
register ssize_t
j;
- if (GetPixelWriteMask(image,q) == QuantumRange)
+ if (GetPixelReadMask(image,q) == 0)
{
q+=GetPixelChannels(image);
continue;
register const Quantum
*magick_restrict r;
- if (GetPixelWriteMask(image,p) == QuantumRange)
+ if (GetPixelReadMask(image,p) == 0)
{
SetPixelBackgoundColor(enhance_image,q);
p+=GetPixelChannels(image);
register ssize_t
j;
- if (GetPixelWriteMask(image,q) == QuantumRange)
+ if (GetPixelReadMask(image,q) == 0)
{
q+=GetPixelChannels(image);
continue;
register ssize_t
j;
- if (GetPixelWriteMask(image,q) == QuantumRange)
+ if (GetPixelReadMask(image,q) == 0)
{
q+=GetPixelChannels(image);
continue;
red,
intensity;
- if (GetPixelWriteMask(image,q) == QuantumRange)
+ if (GetPixelReadMask(image,q) == 0)
{
q+=GetPixelChannels(image);
continue;
register ssize_t
j;
- if (GetPixelWriteMask(image,q) == QuantumRange)
+ if (GetPixelReadMask(image,q) == 0)
{
q+=GetPixelChannels(image);
continue;
register ssize_t
j;
- if (GetPixelWriteMask(image,q) == QuantumRange)
+ if (GetPixelReadMask(image,q) == 0)
{
q+=GetPixelChannels(image);
continue;
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
if ((IsGrayColorspace(image->colorspace) != MagickFalse) &&
- ((IsGrayColorspace(black_color->colorspace) != MagickFalse) ||
- (IsGrayColorspace(white_color->colorspace) != MagickFalse)))
+ ((IsGrayColorspace(black_color->colorspace) == MagickFalse) ||
+ (IsGrayColorspace(white_color->colorspace) == MagickFalse)))
(void) SetImageColorspace(image,sRGBColorspace,exception);
status=MagickTrue;
if (invert == MagickFalse)
green,
red;
- if (GetPixelWriteMask(image,q) == QuantumRange)
- {
- 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) ||
+ if ((GetPixelReadMask(image,q) == 0) ||
IsPixelGray(image,q) != MagickFalse)
{
q+=GetPixelChannels(image);
register ssize_t
j;
- if (GetPixelWriteMask(image,q) == QuantumRange)
+ if (GetPixelReadMask(image,q) == 0)
{
q+=GetPixelChannels(image);
continue;
register ssize_t
i;
- if (GetPixelWriteMask(image,q) == QuantumRange)
+ if (GetPixelReadMask(image,q) == 0)
{
q+=GetPixelChannels(image);
continue;
(noise_traits == UndefinedPixelTrait))
continue;
if (((noise_traits & CopyPixelTrait) != 0) ||
- (GetPixelWriteMask(image,p) == QuantumRange))
+ (GetPixelReadMask(image,p) == 0))
{
SetPixelChannel(noise_image,channel,p[i],q);
continue;
if (traits == UndefinedPixelTrait)
continue;
if (((traits & CopyPixelTrait) != 0) ||
- (GetPixelWriteMask(colorize_image,q) == QuantumRange))
+ (GetPixelReadMask(colorize_image,q) == 0))
continue;
SetPixelChannel(colorize_image,(PixelChannel) i,ClampToQuantum(
Colorize(q[i],GetPixelInfoChannel(&blend_percentage,(PixelChannel) i),
(fx_traits == UndefinedPixelTrait))
continue;
if (((fx_traits & CopyPixelTrait) != 0) ||
- (GetPixelWriteMask(image,p) == QuantumRange))
+ (GetPixelReadMask(image,p) == 0))
{
SetPixelChannel(fx_image,channel,p[i],q);
continue;
/*
Determine if the pixel is within an ellipse.
*/
- if (GetPixelWriteMask(image,p) == QuantumRange)
+ if (GetPixelReadMask(image,p) == 0)
{
SetPixelBackgoundColor(implode_image,q);
p+=GetPixelChannels(image);
(morph_traits == UndefinedPixelTrait))
continue;
if (((morph_traits & CopyPixelTrait) != 0) ||
- (GetPixelWriteMask(morph_images,p) == QuantumRange))
+ (GetPixelReadMask(morph_images,p) == 0))
{
SetPixelChannel(morph_image,channel,p[i],q);
continue;
register ssize_t
i;
- if (GetPixelWriteMask(random_image,q) == QuantumRange)
+ if (GetPixelReadMask(random_image,q) == 0)
{
q+=GetPixelChannels(random_image);
continue;
register ssize_t
i;
- if (GetPixelWriteMask(image,q) == QuantumRange)
+ if (GetPixelReadMask(image,q) == 0)
{
q+=GetPixelChannels(image);
continue;
/*
Determine if the pixel is within an ellipse.
*/
- if (GetPixelWriteMask(image,p) == QuantumRange)
+ if (GetPixelReadMask(image,p) == 0)
{
SetPixelBackgoundColor(swirl_image,q);
p+=GetPixelChannels(image);
(tint_traits == UndefinedPixelTrait))
continue;
if (((tint_traits & CopyPixelTrait) != 0) ||
- (GetPixelWriteMask(image,p) == QuantumRange))
+ (GetPixelReadMask(image,p) == 0))
{
SetPixelChannel(tint_image,channel,p[i],q);
continue;
ThrowImageException(ResourceLimitError,"MemoryAllocationFailed");
pixels_info=AcquireVirtualMemory(3*image->columns,image->rows*
sizeof(*pixels));
- kernel=(float *) AcquireQuantumMemory(MagickMax(image->rows,image->columns)+1,
+ kernel=(float *) AcquireQuantumMemory(MagickMax(image->rows,image->columns),
GetOpenMPMaximumThreads()*sizeof(*kernel));
if ((pixels_info == (MemoryInfo *) NULL) || (kernel == (float *) NULL))
{
GetPixelInfo(next,&pixel);
for (x=0; x < (ssize_t) next->columns; x++)
{
- if (GetPixelWriteMask(next,p) == QuantumRange)
+ if (GetPixelReadMask(next,p) == 0)
{
SetPixelBackgoundColor(append_image,q);
p+=GetPixelChannels(next);
register ssize_t
i;
- if (GetPixelWriteMask(image,p) == QuantumRange)
+ if (GetPixelReadMask(image,p) == 0)
{
p+=GetPixelChannels(image);
continue;
}
for (x=0; x < (ssize_t) image->columns; x++)
{
- if (GetPixelWriteMask(image,q) != QuantumRange)
+ if (GetPixelReadMask(image,q) != 0)
SetPixelAlpha(image,alpha,q);
q+=GetPixelChannels(image);
}
{
case WritePixelMask:
{
- SetPixelWriteMask(image,ClampToQuantum(intensity),q);
+ SetPixelWriteMask(image,ClampToQuantum(QuantumRange-intensity),q);
break;
}
default:
{
- SetPixelReadMask(image,ClampToQuantum(intensity),q);
+ SetPixelReadMask(image,ClampToQuantum(QuantumRange-intensity),q);
break;
}
}
% shape. However at least one non-nan value must be provided for correct
% working of a kernel.
%
-% The returned kernel should be freed using the DestroyKernelInfo method when
-% you are finished with it. Do not free this memory yourself.
+% The returned kernel should be freed using the DestroyKernelInfo() when you
+% are finished with it. Do not free this memory yourself.
%
% Input kernel defintion strings can consist of any of three types.
%
% %
% %
% %
-+ A c q u i r e K e r n e l B u i l t I n %
+% A c q u i r e K e r n e l B u i l t I n %
% %
% %
% %
(morphology_traits == UndefinedPixelTrait))
continue;
if (((traits & CopyPixelTrait) != 0) ||
- (GetPixelWriteMask(image,p+center) == QuantumRange))
+ (GetPixelReadMask(image,p+center) == 0))
{
SetPixelChannel(morphology_image,channel,p[center+i],q);
continue;
(morphology_traits == UndefinedPixelTrait))
continue;
if (((traits & CopyPixelTrait) != 0) ||
- (GetPixelWriteMask(image,p+center) == QuantumRange))
+ (GetPixelReadMask(image,p+center) == 0))
{
SetPixelChannel(morphology_image,channel,p[center+i],q);
continue;
if (traits == UndefinedPixelTrait)
continue;
if (((traits & CopyPixelTrait) != 0) ||
- (GetPixelWriteMask(image,p+center) == QuantumRange))
+ (GetPixelReadMask(image,p+center) == 0))
continue;
pixels=p;
pixel=(double) QuantumRange;
if (traits == UndefinedPixelTrait)
continue;
if (((traits & CopyPixelTrait) != 0) ||
- (GetPixelWriteMask(image,p+center) == QuantumRange))
+ (GetPixelReadMask(image,p+center) == 0))
continue;
pixels=p;
pixel=(double) QuantumRange;
SystemTimeToFileTime(&system_time,&elapsed_time.filetime);
return((double) 1.0e-7*elapsed_time.filetime64);
}
-\f
+
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
return(sign*y);
}
\f
+\f
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
length;
wchar_t
- directory_separator[MagickPathExtent],
file_specification[MagickPathExtent];
assert(path != (const char *) NULL);
MagickPathExtent);
if (length == 0)
return((DIR *) NULL);
- length=MultiByteToWideChar(CP_UTF8,0,DirectorySeparator,-1,
- directory_separator,strlen(DirectorySeparator)+1);
- if (length == 0)
- return((DIR *) NULL);
- if (wcsncat(file_specification,directory_separator,MagickPathExtent-wcslen(file_specification)-1) == (wchar_t*) NULL)
+ if(wcsncat(file_specification,(const wchar_t*) DirectorySeparator,
+ MagickPathExtent-wcslen(file_specification)-1) == (wchar_t*) NULL)
return((DIR *) NULL);
entry=(DIR *) AcquireMagickMemory(sizeof(DIR));
if (entry != (DIR *) NULL)
ExceptionInfo *exception)
{
cl_uint
- num_devices,
status;
size_t
- i,
- size,
- *program_sizes;
+ binaryProgramSize;
+
+ unsigned char
+ *binaryProgram;
status=openCL_library->clGetProgramInfo(device->program,
- CL_PROGRAM_NUM_DEVICES,sizeof(cl_uint),&num_devices,NULL);
+ CL_PROGRAM_BINARY_SIZES,sizeof(size_t),&binaryProgramSize,NULL);
if (status != CL_SUCCESS)
return;
- size=num_devices*sizeof(*program_sizes);
- program_sizes=(size_t*) AcquireMagickMemory(size);
- if (program_sizes == (size_t*) NULL)
- return;
+
+ binaryProgram=(unsigned char*) AcquireMagickMemory(binaryProgramSize);
status=openCL_library->clGetProgramInfo(device->program,
- CL_PROGRAM_BINARY_SIZES,size,program_sizes,NULL);
+ CL_PROGRAM_BINARIES,sizeof(unsigned char*),&binaryProgram,NULL);
if (status == CL_SUCCESS)
- {
- size_t
- binary_program_size;
-
- unsigned char
- **binary_program;
-
- binary_program_size=num_devices*sizeof(*binary_program);
- binary_program=(unsigned char **) AcquireMagickMemory(
- binary_program_size);
- for (i = 0; i < num_devices; i++)
- binary_program[i]=AcquireQuantumMemory(MagickMax(*(program_sizes+i),1),
- sizeof(**binary_program));
- status=openCL_library->clGetProgramInfo(device->program,
- CL_PROGRAM_BINARIES,binary_program_size,binary_program,NULL);
- if (status == CL_SUCCESS)
- {
- for (i = 0; i < num_devices; i++)
- {
- int
- file;
-
- size_t
- program_size;
-
- program_size=*(program_sizes+i);
- if (program_size < 1)
- continue;
- file=open_utf8(filename,O_WRONLY | O_CREAT | O_BINARY,S_MODE);
- if (file != -1)
- {
- write(file,binary_program[i],program_size);
- file=close(file);
- }
- else
- (void) ThrowMagickException(exception,GetMagickModule(),
- DelegateWarning,"Saving kernel failed.","`%s'",filename);
- break;
- }
- }
- for (i = 0; i < num_devices; i++)
- binary_program[i]=(unsigned char *) RelinquishMagickMemory(
- binary_program[i]);
- binary_program=(unsigned char **) RelinquishMagickMemory(binary_program);
- }
- program_sizes=(size_t *) RelinquishMagickMemory(program_sizes);
+ (void) BlobToFile(filename,binaryProgram,binaryProgramSize,exception);
+ binaryProgram=(unsigned char *) RelinquishMagickMemory(binaryProgram);
}
static MagickBooleanType LoadCachedOpenCLKernel(MagickCLDevice device,
{ "+render", 0L, DrawInfoOptionFlag, MagickFalse },
{ "+resample", 1L, DeprecateOptionFlag, MagickTrue },
{ "-resample", 1L, SimpleOperatorFlag, MagickFalse },
- { "-respect-parentheses", 0L, ImageInfoOptionFlag, MagickFalse },
- { "+respect-parentheses", 0L, ImageInfoOptionFlag, MagickFalse },
+ { "-respect-parenthesis", 0L, ImageInfoOptionFlag, MagickFalse },
+ { "+respect-parenthesis", 0L, ImageInfoOptionFlag, MagickFalse },
{ "+reverse", 0L, DeprecateOptionFlag | FireOptionFlag, MagickTrue },
{ "-reverse", 0L, ListOperatorFlag | FireOptionFlag, MagickFalse },
{ "+roll", 1L, DeprecateOptionFlag, MagickTrue },
(paint_traits == UndefinedPixelTrait))
continue;
if (((paint_traits & CopyPixelTrait) != 0) ||
- (GetPixelWriteMask(linear_image,p) == QuantumRange))
+ (GetPixelReadMask(linear_image,p) == 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)
- {
- q+=GetPixelChannels(image);
- continue;
- }
GetPixelInfoPixel(image,q,&pixel);
if (IsFuzzyEquivalencePixelInfo(&pixel,&conform_target) != invert)
SetPixelViaPixelInfo(image,&conform_fill,q);
%
% DefineImageProperty() associates an assignment string of the form
% "key=value" with an artifact or options. It is equivelent to
-% SetImageProperty().
+% SetImageProperty()
%
% The format of the DefineImageProperty method is:
%
count=(ssize_t) ReadPropertyMSBLong(&info,&length);
if ((count < 0) || ((size_t) count > length))
{
- length=0;
+ length=0;
continue;
}
if ((*name != '\0') && (*name != '#'))
(void) ConcatenateMagickString(value,"a",MagickPathExtent);
break;
}
- if (LocaleCompare("colors",property) == 0)
- {
- WarnNoImageReturn("\"%%[%s]\"",property);
- (void) FormatLocaleString(value,MagickPathExtent,"%.20g",(double)
- GetNumberColors(image,(FILE *) NULL,exception));
- break;
- }
if (LocaleCompare("colorspace",property) == 0)
{
WarnNoImageReturn("\"%%[%s]\"",property);
image->compose);
break;
}
- if (LocaleCompare("compression",property) == 0)
- {
- WarnNoImageReturn("\"%%[%s]\"",property);
- string=CommandOptionToMnemonic(MagickCompressOptions,(ssize_t)
- image->compression);
- break;
- }
if (LocaleCompare("copyright",property) == 0)
{
(void) CopyMagickString(value,GetMagickCopyright(),MagickPathExtent);
string=image->filename;
break;
}
- if (LocaleCompare("interlace",property) == 0)
- {
- WarnNoImageReturn("\"%%[%s]\"",property);
- string=CommandOptionToMnemonic(MagickInterlaceOptions,(ssize_t)
- image->interlace);
- break;
- }
break;
}
case 'k':
}
break;
}
- case 'q':
- {
- if (LocaleCompare("quality",property) == 0)
- {
- WarnNoImageReturn("\"%%[%s]\"",property);
- (void) FormatLocaleString(value,MagickPathExtent,"%.*g",
- GetMagickPrecision(),(double) image->quality);
- break;
- }
- break;
- }
case 'r':
{
- if (LocaleCompare("rendering-intent",property) == 0)
- {
- WarnNoImageReturn("\"%%[%s]\"",property);
- string=CommandOptionToMnemonic(MagickIntentOptions,(ssize_t)
- image->rendering_intent);
- break;
- }
if (LocaleCompare("resolution.x",property) == 0)
{
WarnNoImageReturn("\"%%[%s]\"",property);
{
/*
Do not 'set' single letter properties - read only shorthand.
- */
+ */
(void) ThrowMagickException(exception,GetMagickModule(),OptionError,
"SetReadOnlyProperty","`%s'",property);
return(MagickFalse);
"SetReadOnlyProperty","`%s'",property);
return(MagickFalse);
}
- if (LocaleCompare("colors",property) == 0)
- {
- image->colors=GetNumberColors(image,(FILE *) NULL,exception);
- return(MagickTrue);
- }
if (LocaleCompare("colorspace",property) == 0)
{
ssize_t
image->intensity=(PixelIntensityMethod) intensity;
return(MagickTrue);
}
+ if (LocaleCompare("intent",property) == 0)
+ {
+ ssize_t
+ rendering_intent;
+
+ rendering_intent=ParseCommandOption(MagickIntentOptions,MagickFalse,
+ value);
+ if (rendering_intent < 0)
+ return(MagickFalse); /* FUTURE: value exception?? */
+ image->rendering_intent=(RenderingIntent) rendering_intent;
+ return(MagickTrue);
+ }
if (LocaleCompare("interpolate",property) == 0)
{
ssize_t
area,
beta,
distance,
- gamma,
maximum_error,
mean_error,
mean_error_per_pixel;
}
}
image_view=DestroyCacheView(image_view);
- gamma=PerceptibleReciprocal(area);
- image->error.mean_error_per_pixel=gamma*mean_error_per_pixel;
- image->error.normalized_mean_error=gamma*QuantumScale*QuantumScale*mean_error;
- image->error.normalized_maximum_error=QuantumScale*maximum_error;
+ image->error.mean_error_per_pixel=(double) mean_error_per_pixel/area;
+ image->error.normalized_mean_error=(double) QuantumScale*QuantumScale*
+ mean_error/area;
+ image->error.normalized_maximum_error=(double) QuantumScale*maximum_error;
return(MagickTrue);
}
\f
register ssize_t
i;
- if (GetPixelWriteMask(image,q) == QuantumRange)
+ if (GetPixelReadMask(image,q) == 0)
{
q+=GetPixelChannels(image);
continue;
register ssize_t
i;
- if (GetPixelWriteMask(image,q) == QuantumRange)
+ if (GetPixelReadMask(image,q) == 0)
{
q+=GetPixelChannels(image);
continue;
register ssize_t
i;
- if (GetPixelWriteMask(resize_image,q) == QuantumRange)
+ if (GetPixelReadMask(resize_image,q) == 0)
{
q+=GetPixelChannels(resize_image);
continue;
(resize_traits == UndefinedPixelTrait))
continue;
if (((resize_traits & CopyPixelTrait) != 0) ||
- (GetPixelWriteMask(resize_image,q) == QuantumRange))
+ (GetPixelReadMask(resize_image,q) == 0))
{
j=(ssize_t) (MagickMin(MagickMax(bisect,(double) start),(double)
stop-1.0)+0.5);
(resize_traits == UndefinedPixelTrait))
continue;
if (((resize_traits & CopyPixelTrait) != 0) ||
- (GetPixelWriteMask(resize_image,q) == QuantumRange))
+ (GetPixelReadMask(resize_image,q) == 0))
{
j=(ssize_t) (MagickMin(MagickMax(bisect,(double) start),(double)
stop-1.0)+0.5);
register ssize_t
i;
- if (GetPixelWriteMask(sample_image,q) == QuantumRange)
+ if (GetPixelReadMask(sample_image,q) == 0)
{
q+=GetPixelChannels(sample_image);
continue;
}
for (x=0; x < (ssize_t) image->columns; x++)
{
- if (GetPixelWriteMask(image,p) == QuantumRange)
+ if (GetPixelReadMask(image,p) == 0)
{
p+=GetPixelChannels(image);
continue;
}
for (x=0; x < (ssize_t) image->columns; x++)
{
- if (GetPixelWriteMask(image,p) == QuantumRange)
+ if (GetPixelReadMask(image,p) == 0)
{
p+=GetPixelChannels(image);
continue;
}
for (x=0; x < (ssize_t) image->columns; x++)
{
- if (GetPixelWriteMask(image,p) == QuantumRange)
+ if (GetPixelReadMask(image,p) == 0)
{
p+=GetPixelChannels(image);
continue;
*/
for (x=0; x < (ssize_t) scale_image->columns; x++)
{
- if (GetPixelWriteMask(scale_image,q) == QuantumRange)
+ if (GetPixelReadMask(scale_image,q) == 0)
{
q+=GetPixelChannels(scale_image);
continue;
*/
for (x=0; x < (ssize_t) scale_image->columns; x++)
{
- if (GetPixelWriteMask(scale_image,q) == QuantumRange)
+ if (GetPixelReadMask(scale_image,q) == 0)
{
q+=GetPixelChannels(scale_image);
continue;
register ssize_t
i;
- if (GetPixelWriteMask(image,tile_pixels) == QuantumRange)
+ if (GetPixelReadMask(image,tile_pixels) == 0)
{
tile_pixels-=width*GetPixelChannels(image);
q+=GetPixelChannels(rotate_image);
i;
q-=GetPixelChannels(rotate_image);
- if (GetPixelWriteMask(image,p) == QuantumRange)
+ if (GetPixelReadMask(image,p) == 0)
{
p+=GetPixelChannels(image);
continue;
register ssize_t
i;
- if (GetPixelWriteMask(image,tile_pixels) == QuantumRange)
+ if (GetPixelReadMask(image,tile_pixels) == 0)
{
tile_pixels+=width*GetPixelChannels(image);
q+=GetPixelChannels(rotate_image);
register ssize_t
i;
- if (GetPixelWriteMask(image,p) == QuantumRange)
+ if (GetPixelReadMask(image,p) == 0)
{
p+=GetPixelChannels(image);
continue;
% The format of the CloneSplayTree method is:
%
% SplayTreeInfo *CloneSplayTree(SplayTreeInfo *splay_tree,
-% void *(*clone_key)(void *),void *(*clone_value)(void *))
+% void *(*clone_key)(void *),void *(*cline_value)(void *))
%
% A description of each parameter follows:
%
double *entropy,ExceptionInfo *exception)
{
double
- area,
- gamma;
+ area;
ChannelStatistics
*channel_statistics;
channel_statistics[i].entropy;
area++;
}
- gamma=PerceptibleReciprocal(area);
- channel_statistics[CompositePixelChannel].entropy*=gamma;
- gamma=PerceptibleReciprocal(area-1.0);
- channel_statistics[CompositePixelChannel].standard_deviation=
- sqrt(gamma*channel_statistics[CompositePixelChannel].standard_deviation);
+ if (area > MagickEpsilon)
+ {
+ channel_statistics[CompositePixelChannel].entropy/=area;
+ channel_statistics[CompositePixelChannel].standard_deviation=
+ sqrt(channel_statistics[CompositePixelChannel].standard_deviation/area);
+ }
*entropy=channel_statistics[CompositePixelChannel].entropy;
channel_statistics=(ChannelStatistics *) RelinquishMagickMemory(
channel_statistics);
double *standard_deviation,ExceptionInfo *exception)
{
double
- area,
- gamma;
+ area;
ChannelStatistics
*channel_statistics;
channel_statistics[i].mean;
area++;
}
- gamma=PerceptibleReciprocal(area);
- channel_statistics[CompositePixelChannel].mean*=gamma;
- gamma=PerceptibleReciprocal(area-1.0);
- channel_statistics[CompositePixelChannel].standard_deviation=
- sqrt(gamma*channel_statistics[CompositePixelChannel].standard_deviation);
+ if (area > MagickEpsilon)
+ {
+ channel_statistics[CompositePixelChannel].mean/=area;
+ channel_statistics[CompositePixelChannel].standard_deviation=
+ sqrt(channel_statistics[CompositePixelChannel].standard_deviation/area);
+ }
*mean=channel_statistics[CompositePixelChannel].mean;
*standard_deviation=
channel_statistics[CompositePixelChannel].standard_deviation;
(threshold_traits == UndefinedPixelTrait))
continue;
if (((threshold_traits & CopyPixelTrait) != 0) ||
- (GetPixelWriteMask(image,p) == QuantumRange))
+ (GetPixelReadMask(image,p) == 0))
{
SetPixelChannel(threshold_image,channel,p[center+i],q);
continue;
(threshold_traits == UndefinedPixelTrait))
continue;
if (((threshold_traits & CopyPixelTrait) != 0) ||
- (GetPixelWriteMask(image,p) == QuantumRange))
+ (GetPixelReadMask(image,p) == 0))
{
SetPixelChannel(threshold_image,channel,p[center+i],q);
continue;
register ssize_t
i;
- if (GetPixelWriteMask(image,q) == QuantumRange)
+ if (GetPixelReadMask(image,q) == 0)
{
q+=GetPixelChannels(image);
continue;
register ssize_t
i;
- if (GetPixelWriteMask(image,q) == QuantumRange)
+ if (GetPixelReadMask(image,q) == 0)
{
q+=GetPixelChannels(image);
continue;
register ssize_t
i;
- if (GetPixelWriteMask(image,q) == QuantumRange)
+ if (GetPixelReadMask(image,q) == 0)
{
q+=GetPixelChannels(image);
continue;
n;
n=0;
- if (GetPixelWriteMask(image,q) == QuantumRange)
+ if (GetPixelReadMask(image,q) == 0)
{
q+=GetPixelChannels(image);
continue;
register ssize_t
i;
- if (GetPixelWriteMask(image,q) == QuantumRange)
+ if (GetPixelReadMask(image,q) == 0)
{
q+=GetPixelChannels(image);
continue;
register ssize_t
i;
- if (GetPixelWriteMask(image,q) == QuantumRange)
+ if (GetPixelReadMask(image,q) == 0)
{
q+=GetPixelChannels(image);
continue;
register ssize_t
i;
- if (GetPixelWriteMask(image,q) == QuantumRange)
+ if (GetPixelReadMask(image,q) == 0)
{
q+=GetPixelChannels(image);
continue;
register ssize_t
i;
- if (GetPixelWriteMask(image,p) == QuantumRange)
+ if (GetPixelReadMask(image,p) == 0)
{
SetPixelBackgoundColor(crop_image,q);
p+=GetPixelChannels(image);
register ssize_t
i;
- if (GetPixelWriteMask(image,p) == QuantumRange)
+ if (GetPixelReadMask(image,p) == 0)
{
SetPixelBackgoundColor(excerpt_image,q);
p+=GetPixelChannels(image);
register ssize_t
i;
- if (GetPixelWriteMask(image,p) == QuantumRange)
+ if (GetPixelReadMask(image,p) == 0)
{
SetPixelBackgoundColor(flip_image,q);
p+=GetPixelChannels(image);
i;
q-=GetPixelChannels(flop_image);
- if (GetPixelWriteMask(image,p) == QuantumRange)
+ if (GetPixelReadMask(image,p) == 0)
{
p+=GetPixelChannels(image);
continue;
register ssize_t
i;
- if (GetPixelWriteMask(source,p) == QuantumRange)
+ if (GetPixelReadMask(source,p) == 0)
{
SetPixelBackgoundColor(destination,q);
p+=GetPixelChannels(source);
register ssize_t
i;
- if (GetPixelWriteMask(image,p) == QuantumRange)
+ if (GetPixelReadMask(image,p) == 0)
{
SetPixelBackgoundColor(splice_image,q);
p+=GetPixelChannels(image);
register ssize_t
i;
- if (GetPixelWriteMask(image,p) == QuantumRange)
+ if (GetPixelReadMask(image,p) == 0)
{
SetPixelBackgoundColor(splice_image,q);
p+=GetPixelChannels(image);
register ssize_t
i;
- if (GetPixelWriteMask(image,q) == QuantumRange)
+ if (GetPixelReadMask(image,q) == 0)
{
SetPixelBackgoundColor(splice_image,q);
p+=GetPixelChannels(image);
register ssize_t
i;
- if (GetPixelWriteMask(image,q) == QuantumRange)
+ if (GetPixelReadMask(image,q) == 0)
{
SetPixelBackgoundColor(splice_image,q);
p+=GetPixelChannels(image);
register ssize_t
i;
- if (GetPixelWriteMask(image,q) == QuantumRange)
+ if (GetPixelReadMask(image,q) == 0)
{
SetPixelBackgoundColor(transpose_image,q);
p+=GetPixelChannels(image);
i;
q-=GetPixelChannels(transverse_image);
- if (GetPixelWriteMask(image,p) == QuantumRange)
+ if (GetPixelReadMask(image,p) == 0)
{
p+=GetPixelChannels(image);
continue;
{
MagickBooleanType
status;
-
+
if (path == (const char *) NULL)
- {
+ {
errno=EINVAL;
return(MagickFalse);
}
"-quality value JPEG/MIFF/PNG compression level",
"-quiet suppress all warning messages",
"-quantize colorspace reduce colors in this colorspace",
- "-read-mask filename associate a read mask with the image",
+ "-read-mask filename associate a read mask with the image"
"-regard-warnings pay attention to warning messages",
"-respect-parentheses settings remain in effect until parenthesis boundary",
"-sampling-factor geometry",
i++;
if (i == (ssize_t) argc)
ThrowCompareException(OptionError,"MissingArgument",option);
- type=ParseCommandOption(MagickAlphaChannelOptions,MagickFalse,
- argv[i]);
+ type=ParseCommandOption(MagickAlphaChannelOptions,MagickFalse,argv[i]);
if (type < 0)
- ThrowCompareException(OptionError,
- "UnrecognizedAlphaChannelOption",argv[i]);
+ ThrowCompareException(OptionError,"UnrecognizedAlphaChannelOption",
+ argv[i]);
break;
}
if (LocaleCompare("authenticate",option+1) == 0)
*clone_images,
*clone_list;
- if (k == 0)
- clone_list=CloneImageList(image,exception);
- else
+ clone_list=CloneImageList(image,exception);
+ if (k != 0)
clone_list=CloneImageList(image_stack[k-1].image,exception);
if (clone_list == (Image *) NULL)
ThrowConvertException(ImageError,"ImageSequenceRequired",option);
ssize_t
noise;
- noise=ParseCommandOption(MagickNoiseOptions,MagickFalse,argv[i]);
+ noise=ParseCommandOption(MagickNoiseOptions,MagickFalse,
+ argv[i]);
if (noise < 0)
ThrowConvertException(OptionError,"UnrecognizedNoiseType",
argv[i]);
key[MagickPathExtent];
ExceptionInfo
- *sansexception;
+ *sans_exception;
Image
*image;
cache. Then return the image that is in the cache.
*/
(void) FormatLocaleString(key,MagickPathExtent,"cache:%s",path);
- sansexception=AcquireExceptionInfo();
- image=(Image *) GetImageRegistry(ImageRegistryType,key,sansexception);
- sansexception=DestroyExceptionInfo(sansexception);
+ sans_exception=AcquireExceptionInfo();
+ image=(Image *) GetImageRegistry(ImageRegistryType,key,sans_exception);
+ sans_exception=DestroyExceptionInfo(sans_exception);
if (image != (Image *) NULL)
return(image);
read_info=CloneImageInfo(image_info);
/*
Remove a mask.
*/
- (void) SetImageMask(*image,WritePixelMask,(Image *) NULL,
+ (void) SetImageMask(*image,ReadPixelMask,(Image *) NULL,
exception);
break;
}
mask=GetImageCache(mogrify_info,argv[i+1],exception);
if (mask == (Image *) NULL)
break;
- (void) SetImageMask(*image,WritePixelMask,mask,exception);
+ (void) SetImageMask(*image,ReadPixelMask,mask,exception);
mask=DestroyImage(mask);
break;
}
}
if (LocaleCompare("composite",option+1) == 0)
{
- CompositeOperator
- compose;
+ const char
+ *value;
- const char*
- value;
+ Image
+ *mask_image,
+ *composite_image,
+ *image;
MagickBooleanType
clip_to_self;
- Image
- *mask_image,
- *new_images,
- *source_image;
-
RectangleInfo
geometry;
(void) SyncImagesSettings(mogrify_info,*images,exception);
- /* Compose value from "-compose" option only */
- value=GetImageOption(mogrify_info,"compose");
- if (value == (const char *) NULL)
- compose=OverCompositeOp; /* use Over not source_image->compose */
- else
- compose=(CompositeOperator) ParseCommandOption(
- MagickComposeOptions,MagickFalse,value);
-
- /* Get "clip-to-self" expert setting (false is normal) */
value=GetImageOption(mogrify_info,"compose:clip-to-self");
if (value == (const char *) NULL)
clip_to_self=MagickTrue;
else
clip_to_self=IsStringTrue(GetImageOption(mogrify_info,
"compose:clip-to-self")); /* if this is true */
- value=GetImageOption(mogrify_info,"compose:outside-overlay");
- if (value != (const char *) NULL) { /* or this false */
- /* FUTURE: depreciate warning for "compose:outside-overlay"*/
- clip_to_self=IsStringFalse(value);
- }
-
- new_images=RemoveFirstImageFromList(images);
- source_image=RemoveFirstImageFromList(images);
- if (source_image == (Image *) NULL)
- break; /* FUTURE - produce Exception, rather than silent fail */
-
- /* FUTURE - this should not be here!- should be part of -geometry */
- if (source_image->geometry != (char *) NULL)
+ if (clip_to_self == MagickFalse) /* or */
+ clip_to_self=IsStringFalse(GetImageOption(mogrify_info,
+ "compose:outside-overlay"));
+ image=RemoveFirstImageFromList(images);
+ composite_image=RemoveFirstImageFromList(images);
+ if (composite_image == (Image *) NULL)
+ {
+ status=MagickFalse;
+ break;
+ }
+ if (composite_image->geometry != (char *) NULL)
{
RectangleInfo
resize_geometry;
- (void) ParseRegionGeometry(source_image,source_image->geometry,
- &resize_geometry,exception);
- if ((source_image->columns != resize_geometry.width) ||
- (source_image->rows != resize_geometry.height))
+ (void) ParseRegionGeometry(composite_image,
+ composite_image->geometry,&resize_geometry,exception);
+ if ((composite_image->columns != resize_geometry.width) ||
+ (composite_image->rows != resize_geometry.height))
{
Image
*resize_image;
- resize_image=ResizeImage(source_image,resize_geometry.width,
- resize_geometry.height,source_image->filter,exception);
+ resize_image=ResizeImage(composite_image,
+ resize_geometry.width,resize_geometry.height,
+ composite_image->filter,exception);
if (resize_image != (Image *) NULL)
{
- source_image=DestroyImage(source_image);
- source_image=resize_image;
+ composite_image=DestroyImage(composite_image);
+ composite_image=resize_image;
}
}
}
- SetGeometry(source_image,&geometry);
- (void) ParseAbsoluteGeometry(source_image->geometry,&geometry);
- GravityAdjustGeometry(new_images->columns,new_images->rows,
- new_images->gravity, &geometry);
+ SetGeometry(composite_image,&geometry);
+ (void) ParseAbsoluteGeometry(composite_image->geometry,&geometry);
+ GravityAdjustGeometry(image->columns,image->rows,image->gravity,
+ &geometry);
mask_image=RemoveFirstImageFromList(images);
if (mask_image == (Image *) NULL)
- status&=CompositeImage(new_images,source_image,compose,
+ (void) CompositeImage(image,composite_image,image->compose,
clip_to_self,geometry.x,geometry.y,exception);
else
{
- if ((compose == DisplaceCompositeOp) ||
- (compose == DistortCompositeOp))
+ if ((image->compose != DisplaceCompositeOp) &&
+ (image->compose != DistortCompositeOp))
{
- status&=CompositeImage(source_image,mask_image,
+ status&=CompositeImage(composite_image,mask_image,
CopyGreenCompositeOp,MagickTrue,0,0,exception);
- status&=CompositeImage(new_images,source_image,compose,
+ (void) CompositeImage(image,composite_image,image->compose,
clip_to_self,geometry.x,geometry.y,exception);
}
- else
+ else
{
Image
*clone_image;
- clone_image=CloneImage(new_images,0,0,MagickTrue,exception);
+ clone_image=CloneImage(image,0,0,MagickTrue,exception);
if (clone_image == (Image *) NULL)
break;
- status&=CompositeImage(new_images,source_image,compose,
+ (void) CompositeImage(image,composite_image,image->compose,
clip_to_self,geometry.x,geometry.y,exception);
- status&=CompositeImage(new_images,mask_image,
+ status&=CompositeImage(image,mask_image,
CopyAlphaCompositeOp,MagickTrue,0,0,exception);
- status&=CompositeImage(clone_image,new_images,
- OverCompositeOp,clip_to_self,0,0,exception);
- new_images=DestroyImage(new_images);
- new_images=clone_image;
+ status&=CompositeImage(clone_image,image,OverCompositeOp,
+ clip_to_self,0,0,exception);
+ image=DestroyImage(image);
+ image=clone_image;
}
mask_image=DestroyImage(mask_image);
}
- source_image=DestroyImage(source_image);
- *images=new_images;
+ composite_image=DestroyImage(composite_image);
+ *images=DestroyImageList(*images);
+ *images=image;
break;
}
if (LocaleCompare("copy",option+1) == 0)
{
#define DestroyMontage() \
{ \
- if (montage_info != (MontageInfo *) NULL) \
- montage_info=DestroyMontageInfo(montage_info); \
if (montage_image != (Image *) NULL) \
montage_image=DestroyImageList(montage_image); \
DestroyImageStack(); \
*clone_images,
*clone_list;
- if (k == 0)
- clone_list=CloneImageList(image,exception);
- else
+ clone_list=CloneImageList(image,exception);
+ if (k != 0)
clone_list=CloneImageList(image_stack[k-1].image,exception);
if (clone_list == (Image *) NULL)
ThrowMontageException(ImageError,"ImageSequenceRequired",option);
_draw_info->render= ArgBooleanNot;
break;
}
- if (LocaleCompare("respect-parentheses",option+1) == 0)
+ if (LocaleCompare("respect-parenthesis",option+1) == 0)
{
/* link image and setting stacks - option is itself saved on stack! */
(void) SetImageOption(_image_info,option+1,ArgBooleanString);
}
if (LocaleCompare("mask",option+1) == 0)
{
- CLIWandWarnReplaced("-write-mask");
- (void) CLISimpleOperatorImage(cli_wand,"-write-mask",NULL,NULL,
+ CLIWandWarnReplaced("-read-mask");
+ (void) CLISimpleOperatorImage(cli_wand,"-read-mask",NULL,NULL,
exception);
break;
}
cli_wand->image_list_stack = node;
cli_wand->wand.images = NewImageList();
- /* handle respect-parentheses */
+ /* handle respect-parenthesis */
if (IsStringTrue(GetImageOption(cli_wand->wand.image_info,
- "respect-parentheses")) != MagickFalse)
+ "respect-parenthesis")) != MagickFalse)
option="{"; /* fall-thru so as to push image settings too */
else
break;
cli_wand->wand.images= (Image *)node->data;
node = (Stack *)RelinquishMagickMemory(node);
- /* handle respect-parentheses - of the previous 'pushed' settings */
+ /* handle respect-parenthesis - of the previous 'pushed' settings */
node = cli_wand->image_info_stack;
if ( node != (Stack *) NULL)
{
if (IsStringTrue(GetImageOption(
- cli_wand->wand.image_info,"respect-parentheses")) != MagickFalse)
+ cli_wand->wand.image_info,"respect-parenthesis")) != MagickFalse)
option="}"; /* fall-thru so as to pop image settings too */
else
break;