]> granicus.if.org Git - imagemagick/blobdiff - coders/null.c
...
[imagemagick] / coders / null.c
index b78f1a30bb0490389d4dc458b193ef8db5192598..8f9636065ea6488a812a17c899118d8e7b2f84a9 100644 (file)
 %                    Read/Write Image Of Uniform Color.                       %
 %                                                                             %
 %                              Software Design                                %
-%                                John Cristy                                  %
+%                                   Cristy                                    %
 %                                 July 1992                                   %
 %                                                                             %
 %                                                                             %
-%  Copyright 1999-2011 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  %
@@ -99,6 +99,9 @@ static Image *ReadNULLImage(const ImageInfo *image_info,
   Image
     *image;
 
+  MagickBooleanType
+    status;
+
   PixelInfo
     background;
 
@@ -115,22 +118,23 @@ static Image *ReadNULLImage(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);
-  image=AcquireImage(image_info);
+  assert(exception->signature == MagickCoreSignature);
+  image=AcquireImage(image_info,exception);
   if (image->columns == 0)
     image->columns=1;
   if (image->rows == 0)
     image->rows=1;
-  image->matte=MagickTrue;
-  GetPixelInfo(image,&background);
-  background.alpha=(MagickRealType) TransparentAlpha;
-  if (image->colorspace == CMYKColorspace)
-    ConvertRGBToCMYK(&background);
+  status=SetImageExtent(image,image->columns,image->rows,exception);
+  if (status == MagickFalse)
+    return(DestroyImageList(image));
+  ConformPixelInfo(image,&image->background_color,&background,exception);
+  image->alpha_trait=BlendPixelTrait;
+  background.alpha=(double) TransparentAlpha;
   for (y=0; y < (ssize_t) image->rows; y++)
   {
     q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
@@ -138,7 +142,7 @@ static Image *ReadNULLImage(const ImageInfo *image_info,
       break;
     for (x=0; x < (ssize_t) image->columns; x++)
     {
-      SetPixelPixelInfo(image,&background,q);
+      SetPixelViaPixelInfo(image,&background,q);
       q+=GetPixelChannels(image);
     }
     if (SyncAuthenticPixels(image,exception) == MagickFalse)
@@ -175,13 +179,11 @@ ModuleExport size_t RegisterNULLImage(void)
   MagickInfo
     *entry;
 
-  entry=SetMagickInfo("NULL");
+  entry=AcquireMagickInfo("NULL","NULL","Constant image of uniform color");
   entry->decoder=(DecodeImageHandler *) ReadNULLImage;
   entry->encoder=(EncodeImageHandler *) WriteNULLImage;
-  entry->adjoin=MagickFalse;
+  entry->flags^=CoderAdjoinFlag;
   entry->format_type=ImplicitFormatType;
-  entry->description=ConstantString("Constant image of uniform color");
-  entry->module=ConstantString("NULL");
   (void) RegisterMagickInfo(entry);
   return(MagickImageCoderSignature);
 }
@@ -242,9 +244,9 @@ static MagickBooleanType WriteNULLImage(const ImageInfo *image_info,
   Image *image,ExceptionInfo *exception)
 {
   assert(image_info != (const ImageInfo *) NULL);
-  assert(image_info->signature == MagickSignature);
+  assert(image_info->signature == MagickCoreSignature);
   assert(image != (Image *) NULL);
-  assert(image->signature == MagickSignature);
+  assert(image->signature == MagickCoreSignature);
   assert(exception != (ExceptionInfo *) NULL);
   if (image->debug != MagickFalse)
     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);