]> granicus.if.org Git - imagemagick/blobdiff - MagickCore/image.c
(no commit message)
[imagemagick] / MagickCore / image.c
index 3b28e64acfd411eee1b4335abad422624b818ff2..b583397372a42c5f7db2c3a1a4db7382ec9e8cdd 100644 (file)
 %                           MagickCore Image Methods                          %
 %                                                                             %
 %                              Software Design                                %
-%                                John Cristy                                  %
+%                                   Cristy                                    %
 %                                 July 1992                                   %
 %                                                                             %
 %                                                                             %
-%  Copyright 1999-2013 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  %
@@ -208,7 +208,7 @@ MagickExport Image *AcquireImage(const ImageInfo *image_info,
   image->timestamp=time((time_t *) NULL);
   image->debug=IsEventLogging();
   image->reference_count=1;
-  image->semaphore=AllocateSemaphoreInfo();
+  image->semaphore=AcquireSemaphoreInfo();
   image->signature=MagickSignature;
   if (image_info == (ImageInfo *) NULL)
     return(image);
@@ -579,6 +579,7 @@ MagickExport Image *AppendImages(const Image *images,
       {
         if (GetPixelReadMask(image,p) == 0)
           {
+            SetPixelBackgoundColor(append_image,q);
             p+=GetPixelChannels(image);
             q+=GetPixelChannels(append_image);
             continue;
@@ -872,7 +873,7 @@ MagickExport Image *CloneImage(const Image *image,const size_t columns,
     }
   clone_image->ping=image->ping;
   clone_image->debug=IsEventLogging();
-  clone_image->semaphore=AllocateSemaphoreInfo();
+  clone_image->semaphore=AcquireSemaphoreInfo();
   if ((columns == 0) && (rows == 0))
     {
       if (image->montage != (char *) NULL)
@@ -1051,7 +1052,7 @@ MagickExport Image *DestroyImage(Image *image)
     image->ascii85=(Ascii85Info *) RelinquishMagickMemory(image->ascii85);
   DestroyBlob(image);
   if (image->semaphore != (SemaphoreInfo *) NULL)
-    DestroySemaphoreInfo(&image->semaphore);
+    RelinquishSemaphoreInfo(&image->semaphore);
   image->signature=(~MagickSignature);
   image=(Image *) RelinquishMagickMemory(image);
   return(image);
@@ -1673,7 +1674,7 @@ MagickExport MagickBooleanType IsHighDynamicRangeImage(const Image *image,
           continue;
         pixel=(double) p[i];
         if ((pixel < 0.0) || (pixel > QuantumRange) ||
-            (pixel != (QuantumAny) pixel))
+            (pixel != (double) ((QuantumAny) pixel)))
           break;
       }
       p+=GetPixelChannels(image);
@@ -2378,50 +2379,46 @@ MagickExport MagickBooleanType SetImageInfo(ImageInfo *image_info,
     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
       image_info->filename);
   *subimage='\0';
-  if (frames == 0)
+  GetPathComponent(image_info->filename,SubimagePath,subimage);
+  if (*subimage != '\0')
     {
-      GetPathComponent(image_info->filename,SubimagePath,subimage);
-      if (*subimage != '\0')
+      /*
+        Look for scene specification (e.g. img0001.pcd[4]).
+      */
+      if (IsSceneGeometry(subimage,MagickFalse) == MagickFalse)
         {
-          /*
-            Look for scene specification (e.g. img0001.pcd[4]).
-          */
-          if (IsSceneGeometry(subimage,MagickFalse) == MagickFalse)
-            {
-              if (IsGeometry(subimage) != MagickFalse)
-                (void) CloneString(&image_info->extract,subimage);
-            }
-          else
-            {
-              size_t
-                first,
-                last;
-
-              (void) CloneString(&image_info->scenes,subimage);
-              image_info->scene=StringToUnsignedLong(image_info->scenes);
-              image_info->number_scenes=image_info->scene;
-              p=image_info->scenes;
-              for (q=(char *) image_info->scenes; *q != '\0'; p++)
-              {
-                while ((isspace((int) ((unsigned char) *p)) != 0) ||
-                       (*p == ','))
-                  p++;
-                first=(size_t) strtol(p,&q,10);
-                last=first;
-                while (isspace((int) ((unsigned char) *q)) != 0)
-                  q++;
-                if (*q == '-')
-                  last=(size_t) strtol(q+1,&q,10);
-                if (first > last)
-                  Swap(first,last);
-                if (first < image_info->scene)
-                  image_info->scene=first;
-                if (last > image_info->number_scenes)
-                  image_info->number_scenes=last;
-                p=q;
-              }
-              image_info->number_scenes-=image_info->scene-1;
-            }
+          if (IsGeometry(subimage) != MagickFalse)
+            (void) CloneString(&image_info->extract,subimage);
+        }
+      else
+        {
+          size_t
+            first,
+            last;
+
+          (void) CloneString(&image_info->scenes,subimage);
+          image_info->scene=StringToUnsignedLong(image_info->scenes);
+          image_info->number_scenes=image_info->scene;
+          p=image_info->scenes;
+          for (q=(char *) image_info->scenes; *q != '\0'; p++)
+          {
+            while ((isspace((int) ((unsigned char) *p)) != 0) || (*p == ','))
+              p++;
+            first=(size_t) strtol(p,&q,10);
+            last=first;
+            while (isspace((int) ((unsigned char) *q)) != 0)
+              q++;
+            if (*q == '-')
+              last=(size_t) strtol(q+1,&q,10);
+            if (first > last)
+              Swap(first,last);
+            if (first < image_info->scene)
+              image_info->scene=first;
+            if (last > image_info->number_scenes)
+              image_info->number_scenes=last;
+            p=q;
+          }
+          image_info->number_scenes-=image_info->scene-1;
         }
     }
   *extension='\0';
@@ -3552,6 +3549,16 @@ MagickExport MagickBooleanType SyncImageSettings(const ImageInfo *image_info,
   if (option != (const char *) NULL)
     image->orientation=(OrientationType) ParseCommandOption(
       MagickOrientationOptions,MagickFalse,option);
+  option=GetImageOption(image_info,"page");
+  if (option != (const char *) NULL)
+    {
+      char
+        *geometry;
+
+      geometry=GetPageGeometry(option);
+      flags=ParseAbsoluteGeometry(geometry,&image->page);
+      geometry=DestroyString(geometry);
+    }
   option=GetImageOption(image_info,"quality");
   if (option != (const char *) NULL)
     image->quality=StringToUnsignedLong(option);