% You may not use this file except in compliance with the License. You may %
% obtain a copy of the License at %
% %
-% http://www.imagemagick.org/script/license.php %
+% https://www.imagemagick.org/script/license.php %
% %
% Unless required by applicable law or agreed to in writing, software %
% distributed under the License is distributed on an "AS IS" BASIS, %
Constant declaration.
*/
const char
- AlphaColor[] = "#bdbdbd", /* gray */
BackgroundColor[] = "#ffffff", /* white */
BorderColor[] = "#dfdfdf", /* gray */
DefaultTileFrame[] = "15x15+3+3",
ForegroundColor[] = "#000", /* black */
LoadImageTag[] = "Load/Image",
LoadImagesTag[] = "Load/Images",
+ MatteColor[] = "#bdbdbd", /* gray */
PSDensityGeometry[] = "72.0x72.0",
PSPageGeometry[] = "612x792",
SaveImageTag[] = "Save/Image",
image->interlace=NoInterlace;
image->ticks_per_second=UndefinedTicksPerSecond;
image->compose=OverCompositeOp;
- (void) QueryColorCompliance(AlphaColor,AllCompliance,&image->alpha_color,
+ (void) QueryColorCompliance(MatteColor,AllCompliance,&image->matte_color,
exception);
(void) QueryColorCompliance(BackgroundColor,AllCompliance,
&image->background_color,exception);
if (image_info->depth != 0)
image->depth=image_info->depth;
image->dither=image_info->dither;
- image->alpha_color=image_info->alpha_color;
+ image->matte_color=image_info->matte_color;
image->background_color=image_info->background_color;
image->border_color=image_info->border_color;
image->transparent_color=image_info->transparent_color;
image_view=AcquireVirtualCacheView(next,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static,4) shared(status) \
- magick_threads(next,next,next->rows,1)
+ magick_number_threads(next,next,next->rows,1)
#endif
for (y=0; y < (ssize_t) next->rows; y++)
{
GetPixelInfo(next,&pixel);
for (x=0; x < (ssize_t) next->columns; x++)
{
- if (GetPixelWriteMask(next,p) == 0)
+ if (GetPixelWriteMask(next,p) <= (QuantumRange/2))
{
SetPixelBackgoundColor(append_image,q);
p+=GetPixelChannels(next);
if (SetImageStorageClass(clip_mask,DirectClass,exception) == MagickFalse)
return(MagickFalse);
}
- if (inside == MagickFalse)
+ if (inside != MagickFalse)
(void) NegateImage(clip_mask,MagickFalse,exception);
(void) FormatLocaleString(clip_mask->magick_filename,MagickPathExtent,
"8BIM:1999,2998:%s\nPS",pathname);
clone_image->columns=image->columns;
clone_image->rows=image->rows;
clone_image->dither=image->dither;
- if (image->colormap != (PixelInfo *) NULL)
- {
- /*
- Allocate and copy the image colormap.
- */
- clone_image->colors=image->colors;
- length=(size_t) image->colors;
- clone_image->colormap=(PixelInfo *) AcquireQuantumMemory(length,
- sizeof(*clone_image->colormap));
- if (clone_image->colormap == (PixelInfo *) NULL)
- {
- clone_image=DestroyImage(clone_image);
- ThrowImageException(ResourceLimitError,"MemoryAllocationFailed");
- }
- (void) CopyMagickMemory(clone_image->colormap,image->colormap,length*
- sizeof(*clone_image->colormap));
- }
clone_image->image_info=CloneImageInfo(image->image_info);
(void) CloneImageProfiles(clone_image,image);
(void) CloneImageProperties(clone_image,image);
clone_image->ping=image->ping;
clone_image->debug=IsEventLogging();
clone_image->semaphore=AcquireSemaphoreInfo();
+ if (image->colormap != (PixelInfo *) NULL)
+ {
+ /*
+ Allocate and copy the image colormap.
+ */
+ clone_image->colors=image->colors;
+ length=(size_t) image->colors;
+ clone_image->colormap=(PixelInfo *) AcquireQuantumMemory(length+1,
+ sizeof(*clone_image->colormap));
+ if (clone_image->colormap == (PixelInfo *) NULL)
+ {
+ clone_image=DestroyImage(clone_image);
+ ThrowImageException(ResourceLimitError,"MemoryAllocationFailed");
+ }
+ (void) CopyMagickMemory(clone_image->colormap,image->colormap,length*
+ sizeof(*clone_image->colormap));
+ }
if ((columns == 0) || (rows == 0))
{
if (image->montage != (char *) NULL)
*clone_info;
clone_info=AcquireImageInfo();
- if (image_info == (ImageInfo *) NULL)
- return(clone_info);
clone_info->compression=image_info->compression;
clone_info->temporary=image_info->temporary;
clone_info->adjoin=image_info->adjoin;
clone_info->scene=image_info->scene;
clone_info->number_scenes=image_info->number_scenes;
clone_info->depth=image_info->depth;
- (void) CloneString(&clone_info->size,image_info->size);
- (void) CloneString(&clone_info->extract,image_info->extract);
- (void) CloneString(&clone_info->scenes,image_info->scenes);
- (void) CloneString(&clone_info->page,image_info->page);
+ if (image_info->size != (ImageInfo *) NULL)
+ (void) CloneString(&clone_info->size,image_info->size);
+ if (image_info->extract != (ImageInfo *) NULL)
+ (void) CloneString(&clone_info->extract,image_info->extract);
+ if (image_info->scenes != (ImageInfo *) NULL)
+ (void) CloneString(&clone_info->scenes,image_info->scenes);
+ if (image_info->page != (ImageInfo *) NULL)
+ (void) CloneString(&clone_info->page,image_info->page);
clone_info->interlace=image_info->interlace;
clone_info->endian=image_info->endian;
clone_info->units=image_info->units;
clone_info->quality=image_info->quality;
- (void) CloneString(&clone_info->sampling_factor,image_info->sampling_factor);
- (void) CloneString(&clone_info->server_name,image_info->server_name);
- (void) CloneString(&clone_info->font,image_info->font);
- (void) CloneString(&clone_info->texture,image_info->texture);
- (void) CloneString(&clone_info->density,image_info->density);
+ if (image_info->sampling_factor != (ImageInfo *) NULL)
+ (void) CloneString(&clone_info->sampling_factor,
+ image_info->sampling_factor);
+ if (image_info->server_name != (ImageInfo *) NULL)
+ (void) CloneString(&clone_info->server_name,image_info->server_name);
+ if (image_info->font != (ImageInfo *) NULL)
+ (void) CloneString(&clone_info->font,image_info->font);
+ if (image_info->texture != (ImageInfo *) NULL)
+ (void) CloneString(&clone_info->texture,image_info->texture);
+ if (image_info->density != (ImageInfo *) NULL)
+ (void) CloneString(&clone_info->density,image_info->density);
clone_info->pointsize=image_info->pointsize;
clone_info->fuzz=image_info->fuzz;
- clone_info->alpha_color=image_info->alpha_color;
+ clone_info->matte_color=image_info->matte_color;
clone_info->background_color=image_info->background_color;
clone_info->border_color=image_info->border_color;
clone_info->transparent_color=image_info->transparent_color;
SetImageInfoFile(clone_info,image_info->file);
SetImageInfoBlob(clone_info,image_info->blob,image_info->length);
clone_info->stream=image_info->stream;
- clone_info->custom_info=image_info->custom_info;
+ clone_info->custom_stream=image_info->custom_stream;
(void) CopyMagickString(clone_info->magick,image_info->magick,
MagickPathExtent);
(void) CopyMagickString(clone_info->unique,image_info->unique,
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static,4) shared(progress,status) \
- magick_threads(image,source_image,geometry->height,1)
+ magick_number_threads(image,source_image,geometry->height,1)
#endif
for (y=0; y < (ssize_t) geometry->height; y++)
{
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
- PixelChannel channel=GetPixelChannelChannel(image,i);
- PixelTrait traits=GetPixelChannelTraits(image,channel);
+ PixelChannel channel = GetPixelChannelChannel(image,i);
+ PixelTrait traits = GetPixelChannelTraits(image,channel);
PixelTrait source_traits=GetPixelChannelTraits(source_image,channel);
if ((traits == UndefinedPixelTrait) ||
((traits & UpdatePixelTrait) == 0) ||
synchronize=DestroyString(synchronize);
}
exception=AcquireExceptionInfo();
- (void) QueryColorCompliance(AlphaColor,AllCompliance,&image_info->alpha_color,
- exception);
(void) QueryColorCompliance(BackgroundColor,AllCompliance,
&image_info->background_color,exception);
(void) QueryColorCompliance(BorderColor,AllCompliance,
&image_info->border_color,exception);
+ (void) QueryColorCompliance(MatteColor,AllCompliance,&image_info->matte_color,
+ exception);
(void) QueryColorCompliance(TransparentColor,AllCompliance,
&image_info->transparent_color,exception);
exception=DestroyExceptionInfo(exception);
image_view=AcquireVirtualCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static,4) shared(status) \
- magick_threads(image,image,image->rows,1)
+ magick_number_threads(image,image,image->rows,1)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
register ssize_t
i;
- if (GetPixelWriteMask(image,p) == 0)
+ if (GetPixelWriteMask(image,p) <= (QuantumRange/2))
{
p+=GetPixelChannels(image);
continue;
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static,4) shared(status) \
- magick_threads(image,image,image->rows,1)
+ magick_number_threads(image,image,image->rows,1)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
% %
% %
% %
+% S e t I m a g e A l p h a %
+% %
+% %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% SetImageAlpha() sets the alpha levels of the image.
+%
+% The format of the SetImageAlpha method is:
+%
+% MagickBooleanType SetImageAlpha(Image *image,const Quantum alpha,
+% ExceptionInfo *exception)
+%
+% A description of each parameter follows:
+%
+% o image: the image.
+%
+% o Alpha: the level of transparency: 0 is fully opaque and QuantumRange is
+% fully transparent.
+%
+*/
+MagickExport MagickBooleanType SetImageAlpha(Image *image,const Quantum alpha,
+ ExceptionInfo *exception)
+{
+ CacheView
+ *image_view;
+
+ MagickBooleanType
+ status;
+
+ ssize_t
+ y;
+
+ assert(image != (Image *) NULL);
+ if (image->debug != MagickFalse)
+ (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
+ assert(image->signature == MagickCoreSignature);
+ image->alpha_trait=BlendPixelTrait;
+ status=MagickTrue;
+ image_view=AcquireAuthenticCacheView(image,exception);
+#if defined(MAGICKCORE_OPENMP_SUPPORT)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ magick_number_threads(image,image,image->rows,1)
+#endif
+ 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/2))
+ SetPixelAlpha(image,alpha,q);
+ q+=GetPixelChannels(image);
+ }
+ if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
+ status=MagickFalse;
+ }
+ image_view=DestroyCacheView(image_view);
+ return(status);
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% %
+% %
% S e t I m a g e B a c k g r o u n d C o l o r %
% %
% %
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static,4) shared(status) \
- magick_threads(image,image,image->rows,1)
+ magick_number_threads(image,image,image->rows,1)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
% %
% %
% %
-% S e t I m a g e I n f o F i l e %
+% S e t I m a g e I n f o C u s t o m S t r e a m %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% SetImageInfoFile() sets the image info file member.
+% SetImageInfoCustomStream() sets the image info custom stream handlers.
%
-% The format of the SetImageInfoFile method is:
+% The format of the SetImageInfoCustomStream method is:
%
-% void SetImageInfoFile(ImageInfo *image_info,FILE *file)
+% void SetImageInfoCustomStream(ImageInfo *image_info,
+% CustomStreamInfo *custom_stream)
%
% A description of each parameter follows:
%
% o image_info: the image info.
%
-% o file: the file.
+% o custom_stream: your custom stream methods.
%
*/
-MagickExport void SetImageInfoFile(ImageInfo *image_info,FILE *file)
+MagickExport void SetImageInfoCustomStream(ImageInfo *image_info,
+ CustomStreamInfo *custom_stream)
{
assert(image_info != (ImageInfo *) NULL);
assert(image_info->signature == MagickCoreSignature);
if (image_info->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
image_info->filename);
- image_info->file=file;
+ image_info->custom_stream=(CustomStreamInfo *) custom_stream;
}
\f
/*
% %
% %
% %
-% S e t I m a g e A l p h a %
+% S e t I m a g e I n f o F i l e %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% SetImageAlpha() sets the alpha levels of the image.
+% SetImageInfoFile() sets the image info file member.
%
-% The format of the SetImageAlpha method is:
+% The format of the SetImageInfoFile method is:
%
-% MagickBooleanType SetImageAlpha(Image *image,const Quantum alpha,
-% ExceptionInfo *exception)
+% void SetImageInfoFile(ImageInfo *image_info,FILE *file)
%
% A description of each parameter follows:
%
-% o image: the image.
+% o image_info: the image info.
%
-% o Alpha: the level of transparency: 0 is fully opaque and QuantumRange is
-% fully transparent.
+% o file: the file.
%
*/
-MagickExport MagickBooleanType SetImageAlpha(Image *image,const Quantum alpha,
- ExceptionInfo *exception)
+MagickExport void SetImageInfoFile(ImageInfo *image_info,FILE *file)
{
- CacheView
- *image_view;
-
- MagickBooleanType
- status;
-
- ssize_t
- y;
-
- assert(image != (Image *) NULL);
- if (image->debug != MagickFalse)
- (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
- assert(image->signature == MagickCoreSignature);
- image->alpha_trait=BlendPixelTrait;
- status=MagickTrue;
- image_view=AcquireAuthenticCacheView(image,exception);
-#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status) \
- magick_threads(image,image,image->rows,1)
-#endif
- 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) != 0)
- SetPixelAlpha(image,alpha,q);
- q+=GetPixelChannels(image);
- }
- if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
- status=MagickFalse;
- }
- image_view=DestroyCacheView(image_view);
- return(status);
+ assert(image_info != (ImageInfo *) NULL);
+ assert(image_info->signature == MagickCoreSignature);
+ if (image_info->debug != MagickFalse)
+ (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
+ image_info->filename);
+ image_info->file=file;
}
\f
/*
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static,4) shared(status) \
- magick_threads(mask,image,1,1)
+ magick_number_threads(mask,image,image->rows,1)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
case WritePixelMask: image->write_mask=MagickTrue; break;
default: image->read_mask=MagickTrue; break;
}
- if (SyncImagePixelCache(image,exception) == MagickFalse)
+ if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse)
return(MagickFalse);
status=MagickTrue;
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static,4) shared(status) \
- magick_threads(image,image,1,1)
+ magick_number_threads(image,image,image->rows,1)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
(void) DeleteImageProperty(image,"date:create");
(void) DeleteImageProperty(image,"date:modify");
status=SetImageArtifact(image,"png:exclude-chunk",
- "bKGD,cHRM,EXIF,gAMA,iCCP,iTXt,sRGB,tEXt,zCCP,zTXt,date");
+ "bKGD,caNv,cHRM,eXIf,gAMA,iCCP,iTXt,pHYs,sRGB,tEXt,zCCP,zTXt,date");
return(status);
}
\f
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static,4) shared(range_exception,status) \
- magick_threads(image,image,image->rows,1)
+ magick_number_threads(image,image,image->rows,1)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
assert(image->signature == MagickCoreSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
- option=GetImageOption(image_info,"alpha-color");
- if (option != (const char *) NULL)
- (void) QueryColorCompliance(option,AllCompliance,&image->alpha_color,
- exception);
option=GetImageOption(image_info,"background");
if (option != (const char *) NULL)
(void) QueryColorCompliance(option,AllCompliance,&image->background_color,
option=GetImageOption(image_info,"loop");
if (option != (const char *) NULL)
image->iterations=StringToUnsignedLong(option);
+ option=GetImageOption(image_info,"mattecolor");
+ if (option != (const char *) NULL)
+ (void) QueryColorCompliance(option,AllCompliance,&image->matte_color,
+ exception);
option=GetImageOption(image_info,"orient");
if (option != (const char *) NULL)
image->orientation=(OrientationType) ParseCommandOption(