]> granicus.if.org Git - imagemagick/blobdiff - coders/sct.c
(no commit message)
[imagemagick] / coders / sct.c
index 528dbac390e87c0929c2cae3724c3b45b72a4fc6..69370772e190d3a369301fe2c8607afd0a6d21e6 100644 (file)
 %                    Read Scitex HandShake Image Format                       %
 %                                                                             %
 %                              Software Design                                %
-%                                John Cristy                                  %
+%                                   Cristy                                    %
 %                                 July 1992                                   %
 %                                                                             %
 %                                                                             %
-%  Copyright 1999-2011 ImageMagick Studio LLC, a non-profit organization      %
+%  Copyright 1999-2015 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/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/module.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/string-private.h"
+#include "MagickCore/studio.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/module.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/string-private.h"
 \f
 /*
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -129,21 +130,18 @@ static Image *ReadSCTImage(const ImageInfo *image_info,ExceptionInfo *exception)
   MagickBooleanType
     status;
 
-  MagickRealType
+  double
     height,
     width;
 
   Quantum
     pixel;
 
-  register IndexPacket
-    *indexes;
-
   register ssize_t
     i,
     x;
 
-  register PixelPacket
+  register Quantum
     *q;
 
   ssize_t
@@ -168,7 +166,7 @@ static Image *ReadSCTImage(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)
     {
@@ -215,14 +213,17 @@ static Image *ReadSCTImage(const ImageInfo *image_info,ExceptionInfo *exception)
   count=ReadBlob(image,200,buffer);
   count=ReadBlob(image,768,buffer);
   if (separations_mask == 0x0f)
-    image->colorspace=CMYKColorspace;
-  image->x_resolution=1.0*image->columns/width;
-  image->y_resolution=1.0*image->rows/height;
+    SetImageColorspace(image,CMYKColorspace,exception);
+  image->resolution.x=1.0*image->columns/width;
+  image->resolution.y=1.0*image->rows/height;
   if (image_info->ping != MagickFalse)
     {
       (void) CloseBlob(image);
       return(GetFirstImageInList(image));
     }
+  status=SetImageExtent(image,image->columns,image->rows,exception);
+  if (status == MagickFalse)
+    return(DestroyImageList(image));
   /*
     Convert SCT raster image to pixel packets.
   */
@@ -231,9 +232,8 @@ static Image *ReadSCTImage(const ImageInfo *image_info,ExceptionInfo *exception)
     for (i=0; i < (ssize_t) separations; i++)
     {
       q=GetAuthenticPixels(image,0,y,image->columns,1,exception);
-      if (q == (PixelPacket *) NULL)
+      if (q == (Quantum *) NULL)
         break;
-      indexes=GetAuthenticIndexQueue(image);
       for (x=0; x < (ssize_t) image->columns; x++)
       {
         pixel=(Quantum) ScaleCharToQuantum((unsigned char) ReadBlobByte(image));
@@ -243,29 +243,29 @@ static Image *ReadSCTImage(const ImageInfo *image_info,ExceptionInfo *exception)
         {
           case 0:
           {
-            SetRedPixelComponent(q,pixel);
-            SetGreenPixelComponent(q,pixel);
-            SetBluePixelComponent(q,pixel);
+            SetPixelRed(image,pixel,q);
+            SetPixelGreen(image,pixel,q);
+            SetPixelBlue(image,pixel,q);
             break;
           }
           case 1:
           {
-            SetGreenPixelComponent(q,pixel);
+            SetPixelGreen(image,pixel,q);
             break;
           }
           case 2:
           {
-            SetBluePixelComponent(q,pixel);
+            SetPixelBlue(image,pixel,q);
             break;
           }
           case 3: 
           {
             if (image->colorspace == CMYKColorspace)
-              SetBlackPixelComponent(indexes+x,pixel);
+              SetPixelBlack(image,pixel,q);
             break;
           }
         }
-        q++;
+        q+=GetPixelChannels(image);
       }
       if (SyncAuthenticPixels(image,exception) == MagickFalse)
         break;
@@ -312,12 +312,10 @@ ModuleExport size_t RegisterSCTImage(void)
   MagickInfo
     *entry;
 
-  entry=SetMagickInfo("SCT");
+  entry=AcquireMagickInfo("SCT","SCT","Scitex HandShake");
   entry->decoder=(DecodeImageHandler *) ReadSCTImage;
   entry->magick=(IsImageFormatHandler *) IsSCT;
-  entry->adjoin=MagickFalse;
-  entry->description=ConstantString("Scitex HandShake");
-  entry->module=ConstantString("SCT");
+  entry->flags^=CoderAdjoinFlag;
   (void) RegisterMagickInfo(entry);
   return(MagickImageCoderSignature);
 }