]> granicus.if.org Git - imagemagick/blobdiff - coders/rla.c
Accommodate background color index in PLTE chunk
[imagemagick] / coders / rla.c
index 8480b9115731bcdb7193fb545c63d49589712247..843fd6fb273ddb449916598210fc5fe505daf81a 100644 (file)
@@ -17,7 +17,7 @@
 %                                 July 1992                                   %
 %                                                                             %
 %                                                                             %
-%  Copyright 1999-2011 ImageMagick Studio LLC, a non-profit organization      %
+%  Copyright 1999-2012 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/property.h"
-#include "magick/blob.h"
-#include "magick/blob-private.h"
-#include "magick/cache.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/monitor.h"
-#include "magick/monitor-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/property.h"
+#include "MagickCore/blob.h"
+#include "MagickCore/blob-private.h"
+#include "MagickCore/cache.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/monitor.h"
+#include "MagickCore/monitor-private.h"
+#include "MagickCore/pixel-accessor.h"
+#include "MagickCore/quantum-private.h"
+#include "MagickCore/static.h"
+#include "MagickCore/string_.h"
+#include "MagickCore/module.h"
 \f
 /*
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -172,7 +173,7 @@ static Image *ReadRLAImage(const ImageInfo *image_info,ExceptionInfo *exception)
     i,
     x;
 
-  register PixelPacket
+  register Quantum
     *q;
 
   ssize_t
@@ -196,7 +197,7 @@ static Image *ReadRLAImage(const ImageInfo *image_info,ExceptionInfo *exception)
       image_info->filename);
   assert(exception != (ExceptionInfo *) NULL);
   assert(exception->signature == MagickSignature);
-  image=AcquireImage(image_info);
+  image=AcquireImage(image_info,exception);
   status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
   if (status == MagickFalse)
     {
@@ -263,7 +264,7 @@ static Image *ReadRLAImage(const ImageInfo *image_info,ExceptionInfo *exception)
   if (scanlines == (ssize_t *) NULL)
     ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
   if (*rla_info.description != '\0')
-    (void) SetImageProperty(image,"comment",rla_info.description);
+    (void) SetImageProperty(image,"comment",rla_info.description,exception);
   /*
     Read offsets to each scanline data.
   */
@@ -296,7 +297,7 @@ static Image *ReadRLAImage(const ImageInfo *image_info,ExceptionInfo *exception)
             {
               q=GetAuthenticPixels(image,(ssize_t) (x % image->columns),
                 (ssize_t) (y % image->rows),1,1,exception);
-              if (q == (PixelPacket *) NULL)
+              if (q == (Quantum *) NULL)
                 break;
               byte=(unsigned char) ReadBlobByte(image);
               length--;
@@ -304,24 +305,23 @@ static Image *ReadRLAImage(const ImageInfo *image_info,ExceptionInfo *exception)
               {
                 case 0:
                 {
-                  SetRedPixelComponent(q,ScaleCharToQuantum(byte));
+                  SetPixelRed(image,ScaleCharToQuantum(byte),q);
                   break;
                 }
                 case 1:
                 {
-                  SetGreenPixelComponent(q,ScaleCharToQuantum(byte));
+                  SetPixelGreen(image,ScaleCharToQuantum(byte),q);
                   break;
                 }
                 case 2:
                 {
-                  SetBluePixelComponent(q,ScaleCharToQuantum(byte));
+                  SetPixelBlue(image,ScaleCharToQuantum(byte),q);
                   break;
                 }
                 case 3:
                 default:
                 {
-                  SetOpacityPixelComponent(q,QuantumRange-
-                    ScaleCharToQuantum(byte));
+                  SetPixelAlpha(image,ScaleCharToQuantum(byte),q);
                   break;
                 }
               }
@@ -339,29 +339,29 @@ static Image *ReadRLAImage(const ImageInfo *image_info,ExceptionInfo *exception)
         {
           q=GetAuthenticPixels(image,(ssize_t) (x % image->columns),
             (ssize_t) (y % image->rows),1,1,exception);
-          if (q == (PixelPacket *) NULL)
+          if (q == (Quantum *) NULL)
             break;
           switch (channel)
           {
             case 0:
             {
-              SetRedPixelComponent(q,ScaleCharToQuantum(byte));
+              SetPixelRed(image,ScaleCharToQuantum(byte),q);
               break;
             }
             case 1:
             {
-              SetGreenPixelComponent(q,ScaleCharToQuantum(byte));
+              SetPixelGreen(image,ScaleCharToQuantum(byte),q);
               break;
             }
             case 2:
             {
-              SetBluePixelComponent(q,ScaleCharToQuantum(byte));
+              SetPixelBlue(image,ScaleCharToQuantum(byte),q);
               break;
             }
             case 3:
             default:
             {
-              SetOpacityPixelComponent(q,QuantumRange-ScaleCharToQuantum(byte));
+              SetPixelAlpha(image,ScaleCharToQuantum(byte),q);
               break;
             }
           }