]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Fri, 7 May 2010 19:34:48 +0000 (19:34 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Fri, 7 May 2010 19:34:48 +0000 (19:34 +0000)
ChangeLog
PerlMagick/Magick.xs
magick/image.c
magick/image.h
wand/magick-image.c
wand/magick-image.h

index f52c46f5308c8b4656044ec4e48f5d6de4e42218..756182714060a40cc6d3851db04abf591c3dc489 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -55,6 +55,7 @@
     Anthony).
   * Register / unregister CALS format in static.c (reference
     http://www.imagemagick.org/discourse-server/viewtopic.php?f=2&t=16103).
+  * Add SetImageColor() method.
 
 2010-04-17  6.6.1-5 Cristy  <quetzlzacatenango@image...>
   * Only write one ICC profile to PSD image.
index cd378e2470e5e8249873168d44dca56f576bcd27..b3f7f419f34a0c492a9c97c08dfa6da41354d1f3 100644 (file)
@@ -531,6 +531,7 @@ static struct
       {"channel", MagickChannelOptions}, {"method", MagickMorphologyOptions},
       {"iterations", IntegerReference} } },
     { "ColorMatrix", { {"matrix", ArrayReference} } },
+    { "Color", { {"color", StringReference} } }
   };
 
 static SplayTreeInfo
@@ -7187,6 +7188,8 @@ Mogrify(ref,...)
     MorphologyImage    = 266
     ColorMatrix        = 267
     ColorMatrixImage   = 268
+    Color              = 269
+    ColorImage         = 270
     MogrifyRegion      = 666
   PPCODE:
   {
@@ -10503,6 +10506,18 @@ Mogrify(ref,...)
           color_matrix=(double *) RelinquishMagickMemory(color_matrix);
           break;
         }
+        case 135:  /* Color */
+        {
+          MagickPixelPacket
+            color;
+
+          (void) QueryMagickColor("none",&color,exception);
+          if (attribute_flag[0] != 0)
+            (void) QueryMagickColor(argument_list[0].string_reference,
+              &color,exception);
+          (void) SetImageColor(image,&color);
+          break;
+        }
       }
       if (next != (Image *) NULL)
         (void) CatchImageException(next);
index 4a1876b947b838b032d0a64001682a0144b314b0..393834759687c194dca3251e99eb598811f854cf 100644 (file)
@@ -2792,6 +2792,93 @@ MagickExport MagickBooleanType SetImageBackgroundColor(Image *image)
 %                                                                             %
 %                                                                             %
 %                                                                             %
+%   S e t I m a g e C o l o r                                                 %
+%                                                                             %
+%                                                                             %
+%                                                                             %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+%  SetImageColor() set the entire image canvas to the specified color.
+%
+%  The format of the SetImageColor method is:
+%
+%      MagickBooleanType SetImageColor(Image *image,
+%        const MagickPixelPacket *color)
+%
+%  A description of each parameter follows:
+%
+%    o image: the image.
+%
+%    o background: the image color.
+%
+*/
+MagickExport MagickBooleanType SetImageColor(Image *image,
+  const MagickPixelPacket *color)
+{
+  CacheView
+    *image_view;
+
+  ExceptionInfo
+    *exception;
+
+  long
+    y;
+
+  MagickBooleanType
+    status;
+
+  assert(image != (Image *) NULL);
+  if (image->debug != MagickFalse)
+    (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
+  assert(image->signature == MagickSignature);
+  assert(color != (const MagickPixelPacket *) NULL);
+  image->colorspace=color->colorspace;
+  image->matte=color->matte;
+  image->fuzz=color->fuzz;
+  image->depth=color->depth;
+  status=MagickTrue;
+  exception=(&image->exception);
+  image_view=AcquireCacheView(image);
+#if defined(MAGICKCORE_OPENMP_SUPPORT)
+  #pragma omp parallel for schedule(dynamic,4) shared(status)
+#endif
+  for (y=0; y < (long) image->rows; y++)
+  {
+    register IndexPacket
+      *restrict indexes;
+
+    register long
+      x;
+
+    register PixelPacket
+      *restrict q;
+
+    if (status == MagickFalse)
+      continue;
+    q=QueueCacheViewAuthenticPixels(image_view,0,y,image->columns,1,exception);
+    if (q == (PixelPacket *) NULL)
+      {
+        status=MagickFalse;
+        continue;
+      }
+    indexes=GetCacheViewAuthenticIndexQueue(image_view);
+    for (x=0; x < (long) image->columns; x++)
+    {
+      SetPixelPacket(image,color,q,indexes+x);
+      q++;
+    }
+    if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
+      status=MagickFalse;
+  }
+  image_view=DestroyCacheView(image_view);
+  return(status);
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%                                                                             %
+%                                                                             %
+%                                                                             %
 %   S e t I m a g e S t o r a g e C l a s s                                   %
 %                                                                             %
 %                                                                             %
index 4143346669393eaba134480925570da2920a5a72..d373149cdb4345f4ebae76909f833b4a9b50dc1a 100644 (file)
@@ -524,6 +524,7 @@ extern MagickExport MagickBooleanType
   SetImageAlphaChannel(Image *,const AlphaChannelType),
   SetImageBackgroundColor(Image *),
   SetImageClipMask(Image *,const Image *),
+  SetImageColor(Image *,const MagickPixelPacket *),
   SetImageExtent(Image *,const unsigned long,const unsigned long),
   SetImageInfo(ImageInfo *,const unsigned int,ExceptionInfo *),
   SetImageMask(Image *,const Image *),
index 3851da041be159b9a5151005423d55805d36f2c0..eccbb51ae5fc428f531c04bc8496a8030c5f6a54 100644 (file)
@@ -9651,6 +9651,51 @@ WandExport MagickBooleanType MagickSetImageClipMask(MagickWand *wand,
 %                                                                             %
 %                                                                             %
 %                                                                             %
+%   M a g i c k S e t I m a g e C o l o r                                     %
+%                                                                             %
+%                                                                             %
+%                                                                             %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+%  MagickSetImageColor() set the entire wand canvas to the specified color.
+%
+%  The format of the MagickSetImageColor method is:
+%
+%      MagickBooleanType MagickSetImageColor(MagickWand *wand,
+%        const PixelWand *color)
+%
+%  A description of each parameter follows:
+%
+%    o wand: the magick wand.
+%
+%    o background: the image color.
+%
+*/
+WandExport MagickBooleanType MagickSetImageColor(MagickWand *wand,
+  const PixelWand *color)
+{
+  MagickBooleanType
+    status;
+
+  MagickPixelPacket
+    pixel;
+
+  assert(wand != (MagickWand *) NULL);
+  assert(wand->signature == WandSignature);
+  if (wand->debug != MagickFalse)
+    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+  PixelGetMagickColor(color,&pixel);
+  status=SetImageColor(wand->images,&pixel);
+  if (status == MagickFalse)
+    InheritException(wand->exception,&wand->images->exception);
+  return(status);
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%                                                                             %
+%                                                                             %
+%                                                                             %
 %   M a g i c k S e t I m a g e C o l o r m a p C o l o r                     %
 %                                                                             %
 %                                                                             %
index 833279c2950ebfae6677323b272143c9a408c150..207f7500ff8c25f7d232427d79985d4a63c83b87 100644 (file)
@@ -288,6 +288,7 @@ extern WandExport MagickBooleanType
   MagickSetImageChannelDepth(MagickWand *,const ChannelType,
     const unsigned long),
   MagickSetImageClipMask(MagickWand *,const MagickWand *),
+  MagickSetImageColor(MagickWand *,const PixelWand *),
   MagickSetImageColormapColor(MagickWand *,const unsigned long,
     const PixelWand *),
   MagickSetImageColorspace(MagickWand *,const ColorspaceType),