]> granicus.if.org Git - imagemagick/blobdiff - coders/null.c
(no commit message)
[imagemagick] / coders / null.c
index 98c07b3055165067ccf97c63c1a92abbafd6e569..34ebe4f85ad0c5d0b487a6138f8f36b864cfad38 100644 (file)
 %                    Read/Write Image Of Uniform Color.                       %
 %                                                                             %
 %                              Software Design                                %
-%                                John Cristy                                  %
+%                                   Cristy                                    %
 %                                 July 1992                                   %
 %                                                                             %
 %                                                                             %
-%  Copyright 1999-2009 ImageMagick Studio LLC, a non-profit organization      %
+%  Copyright 1999-2014 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  %
 /*
   Include declarations.
 */
-#include "magick/studio.h"
-#include "magick/blob.h"
-#include "magick/blob-private.h"
-#include "magick/cache.h"
-#include "magick/color.h"
-#include "magick/color-private.h"
-#include "magick/colorspace-private.h"
-#include "magick/exception.h"
-#include "magick/exception-private.h"
-#include "magick/image.h"
-#include "magick/image-private.h"
-#include "magick/list.h"
-#include "magick/magick.h"
-#include "magick/memory_.h"
-#include "magick/pixel-private.h"
-#include "magick/quantum-private.h"
-#include "magick/static.h"
-#include "magick/string_.h"
-#include "magick/module.h"
+#include "MagickCore/studio.h"
+#include "MagickCore/blob.h"
+#include "MagickCore/blob-private.h"
+#include "MagickCore/cache.h"
+#include "MagickCore/color.h"
+#include "MagickCore/color-private.h"
+#include "MagickCore/colorspace-private.h"
+#include "MagickCore/exception.h"
+#include "MagickCore/exception-private.h"
+#include "MagickCore/image.h"
+#include "MagickCore/image-private.h"
+#include "MagickCore/list.h"
+#include "MagickCore/magick.h"
+#include "MagickCore/memory_.h"
+#include "MagickCore/pixel-accessor.h"
+#include "MagickCore/quantum-private.h"
+#include "MagickCore/static.h"
+#include "MagickCore/string_.h"
+#include "MagickCore/module.h"
 \f
 /*
   Forward declarations.
 */
 static MagickBooleanType
-  WriteNULLImage(const ImageInfo *,Image *);
+  WriteNULLImage(const ImageInfo *,Image *,ExceptionInfo *);
 \f
 /*
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -99,21 +99,18 @@ static Image *ReadNULLImage(const ImageInfo *image_info,
   Image
     *image;
 
-  long
-    y;
-
-  MagickPixelPacket
+  PixelInfo
     background;
 
-  register IndexPacket
-    *indexes;
-
-  register long
+  register ssize_t
     x;
 
-  register PixelPacket
+  register Quantum
     *q;
 
+  ssize_t
+    y;
+
   /*
     Initialize Image structure.
   */
@@ -124,27 +121,25 @@ static Image *ReadNULLImage(const ImageInfo *image_info,
       image_info->filename);
   assert(exception != (ExceptionInfo *) NULL);
   assert(exception->signature == MagickSignature);
-  image=AcquireImage(image_info);
+  image=AcquireImage(image_info,exception);
   if (image->columns == 0)
     image->columns=1;
   if (image->rows == 0)
     image->rows=1;
-  image->matte=MagickTrue;
-  GetMagickPixelPacket(image,&background);
-  background.opacity=(MagickRealType) TransparentOpacity;
+  image->alpha_trait=BlendPixelTrait;
+  GetPixelInfo(image,&background);
+  background.alpha=(double) TransparentAlpha;
   if (image->colorspace == CMYKColorspace)
     ConvertRGBToCMYK(&background);
-  for (y=0; y < (long) image->rows; y++)
+  for (y=0; y < (ssize_t) image->rows; y++)
   {
     q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
-    if (q == (PixelPacket *) NULL)
+    if (q == (Quantum *) NULL)
       break;
-    indexes=GetAuthenticIndexQueue(image);
-    for (x=0; x < (long) image->columns; x++)
+    for (x=0; x < (ssize_t) image->columns; x++)
     {
-      SetPixelPacket(image,&background,q,indexes);
-      q++;
-      indexes++;
+      SetPixelInfoPixel(image,&background,q);
+      q+=GetPixelChannels(image);
     }
     if (SyncAuthenticPixels(image,exception) == MagickFalse)
       break;
@@ -172,10 +167,10 @@ static Image *ReadNULLImage(const ImageInfo *image_info,
 %
 %  The format of the RegisterNULLImage method is:
 %
-%      unsigned long RegisterNULLImage(void)
+%      size_t RegisterNULLImage(void)
 %
 */
-ModuleExport unsigned long RegisterNULLImage(void)
+ModuleExport size_t RegisterNULLImage(void)
 {
   MagickInfo
     *entry;
@@ -184,7 +179,7 @@ ModuleExport unsigned long RegisterNULLImage(void)
   entry->decoder=(DecodeImageHandler *) ReadNULLImage;
   entry->encoder=(EncodeImageHandler *) WriteNULLImage;
   entry->adjoin=MagickFalse;
-  entry->format_type=ExplicitFormatType;
+  entry->format_type=ImplicitFormatType;
   entry->description=ConstantString("Constant image of uniform color");
   entry->module=ConstantString("NULL");
   (void) RegisterMagickInfo(entry);
@@ -232,7 +227,7 @@ ModuleExport void UnregisterNULLImage(void)
 %  The format of the WriteNULLImage method is:
 %
 %      MagickBooleanType WriteNULLImage(const ImageInfo *image_info,
-%        Image *image)
+%        Image *image,ExceptionInfo *exception)
 %
 %  A description of each parameter follows.
 %
@@ -240,14 +235,17 @@ ModuleExport void UnregisterNULLImage(void)
 %
 %    o image:  The image.
 %
+%    o exception: return any errors or warnings in this structure.
+%
 */
 static MagickBooleanType WriteNULLImage(const ImageInfo *image_info,
-  Image *image)
+  Image *image,ExceptionInfo *exception)
 {
   assert(image_info != (const ImageInfo *) NULL);
   assert(image_info->signature == MagickSignature);
   assert(image != (Image *) NULL);
   assert(image->signature == MagickSignature);
+  assert(exception != (ExceptionInfo *) NULL);
   if (image->debug != MagickFalse)
     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
   return(MagickTrue);