]> granicus.if.org Git - imagemagick/blobdiff - coders/mask.c
Removed png_write_chunk_from_profile()
[imagemagick] / coders / mask.c
index 89a67bcfa21a27f38b80e9c99a0a4a362befa9be..643735b0843b46408f26dc4a5f6187b42427024d 100644 (file)
 %                                 July 1992                                   %
 %                                                                             %
 %                                                                             %
-%  Copyright 1999-2014 ImageMagick Studio LLC, a non-profit organization      %
+%  Copyright 1999-2017 ImageMagick Studio LLC, a non-profit organization      %
 %  dedicated to making software imaging solutions freely available.           %
 %                                                                             %
 %  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,          %
@@ -102,15 +102,15 @@ static Image *ReadMASKImage(const ImageInfo *image_info,
     Initialize Image structure.
   */
   assert(image_info != (const ImageInfo *) NULL);
-  assert(image_info->signature == MagickSignature);
+  assert(image_info->signature == MagickCoreSignature);
   if (image_info->debug != MagickFalse)
     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
       image_info->filename);
   assert(exception != (ExceptionInfo *) NULL);
-  assert(exception->signature == MagickSignature);
+  assert(exception->signature == MagickCoreSignature);
   read_info=CloneImageInfo(image_info);
   SetImageInfoBlob(read_info,(void *) NULL,0);
-  *read_info->magick='\0';
+  (void) CopyMagickString(read_info->magick,"MIFF",MagickPathExtent);
   image=ReadImage(read_info,exception);
   read_info=DestroyImageInfo(read_info);
   if (image != (Image *) NULL)
@@ -153,11 +153,9 @@ ModuleExport size_t RegisterMASKImage(void)
   MagickInfo
     *entry;
 
-  entry=SetMagickInfo("MASK");
+  entry=AcquireMagickInfo("MASK","MASK","Image Clip Mask");
   entry->decoder=(DecodeImageHandler *) ReadMASKImage;
   entry->encoder=(EncodeImageHandler *) WriteMASKImage;
-  entry->description=ConstantString("Image Clip Mask");
-  entry->module=ConstantString("MASK");
   (void) RegisterMagickInfo(entry);
   return(MagickImageCoderSignature);
 }
@@ -249,10 +247,10 @@ static Image *MaskImage(const Image *image,ExceptionInfo *exception)
   for (y=0; y < (ssize_t) image->rows; y++)
   {
     register const Quantum
-      *restrict p;
+      *magick_restrict p;
 
     register Quantum
-      *restrict q;
+      *magick_restrict q;
 
     register ssize_t
       x;
@@ -270,7 +268,7 @@ static Image *MaskImage(const Image *image,ExceptionInfo *exception)
     for (x=0; x < (ssize_t) image->columns; x++)
     {
       SetPixelChannel(mask_image,GrayPixelChannel,0,q);
-      SetPixelChannel(mask_image,GrayPixelChannel,GetPixelReadMask(image,p),q);
+      SetPixelChannel(mask_image,GrayPixelChannel,GetPixelWriteMask(image,p),q);
       p+=GetPixelChannels(image);
       q+=GetPixelChannels(mask_image);
     }
@@ -299,11 +297,14 @@ static MagickBooleanType WriteMASKImage(const ImageInfo *image_info,
   mask_image=MaskImage(image,exception);
   if (mask_image == (Image *) NULL)
     return(MagickFalse);
-  (void) CopyMagickString(mask_image->filename,image->filename,MaxTextExtent);
+  (void) CopyMagickString(mask_image->filename,image->filename,
+    MagickPathExtent);
   write_info=CloneImageInfo(image_info);
+  *write_info->magick='\0';
   (void) SetImageInfo(write_info,1,exception);
-  if (LocaleCompare(write_info->magick,"MASK") == 0)
-    (void) FormatLocaleString(mask_image->filename,MaxTextExtent,"miff:%s",
+  if ((*write_info->magick == '\0') ||
+      (LocaleCompare(write_info->magick,"MASK") == 0))
+    (void) FormatLocaleString(mask_image->filename,MagickPathExtent,"miff:%s",
       write_info->filename);
   status=WriteImage(write_info,mask_image,exception);
   mask_image=DestroyImage(mask_image);