]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Wed, 13 Mar 2013 12:03:11 +0000 (12:03 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Wed, 13 Mar 2013 12:03:11 +0000 (12:03 +0000)
14 files changed:
MagickCore/annotate.c
MagickCore/cache.c
MagickCore/channel.c
MagickCore/composite.c
MagickCore/decorate.c
MagickCore/distort.c
MagickCore/draw.c
MagickCore/enhance.c
MagickCore/fx.c
MagickCore/image.c
MagickCore/option.c
MagickCore/paint.c
MagickCore/pixel.c
MagickCore/pixel.h

index f7e5510165ec0489f0b965a209a51c5f89a4aed2..6ab5204be1987236137f5d61b302c51b58cabacd 100644 (file)
@@ -290,8 +290,6 @@ MagickExport MagickBooleanType AnnotateImage(Image *image,
     }
   if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse)
     return(MagickFalse);
-  if (IsGrayColorspace(image->colorspace) != MagickFalse)
-    (void) TransformImageColorspace(image,RGBColorspace,exception);
   status=MagickTrue;
   for (i=0; textlist[i] != (char *) NULL; i++)
   {
index 2ce31b11b5068a35d501165f308533cc0fc61516..dd55b72cc73a9416698b79ffe76ed8ce93c5298e 100644 (file)
@@ -4829,9 +4829,6 @@ MagickPrivate VirtualPixelMethod SetPixelCacheVirtualMethod(Image *image,
         if ((image->background_color.alpha_trait == BlendPixelTrait) &&
             (image->alpha_trait != BlendPixelTrait))
           (void) SetCacheAlphaChannel(image,OpaqueAlpha,exception);
-        if ((IsPixelInfoGray(&image->background_color) == MagickFalse) &&
-            (IsGrayColorspace(image->colorspace) != MagickFalse))
-          (void) TransformImageColorspace(image,RGBColorspace,exception);
         break;
       }
       case TransparentVirtualPixelMethod:
index 80c25364374f2387648b9ce54791af1aad5a6261..f8c58eb36bc3a96db35be1c9519e633253fe8f12 100644 (file)
@@ -239,8 +239,6 @@ MagickExport Image *ChannelFxImage(const Image *image,const char *expression,
   destination_image=CloneImage(source_image,0,0,MagickTrue,exception);
   if (destination_image == (Image *) NULL)
     return((Image *) NULL);
-  if (IsGrayColorspace(image->colorspace) != MagickFalse)
-    (void) TransformImageColorspace((Image *) image,RGBColorspace,exception);
   if (expression == (const char *) NULL)
     return(destination_image);
   destination_channel=RedPixelChannel;
@@ -290,8 +288,6 @@ MagickExport Image *ChannelFxImage(const Image *image,const char *expression,
             destination_image=DestroyImageList(destination_image);
             return(destination_image);
           }
-        if (IsGrayColorspace(canvas->colorspace) != MagickFalse)
-          (void) TransformImageColorspace(canvas,RGBColorspace,exception);
         AppendImageToList(&destination_image,canvas);
         destination_image=GetLastImageInList(destination_image);
         GetMagickToken(p,&p,token);
@@ -488,8 +484,6 @@ MagickExport Image *CombineImages(const Image *image,
       combine_image=DestroyImage(combine_image);
       return((Image *) NULL);
     }
-  if (IsGrayColorspace(image->colorspace) != MagickFalse)
-    (void) SetImageColorspace(combine_image,RGBColorspace,exception);
   if ((GetPixelAlphaTraits(image) & UpdatePixelTrait) != 0)
     combine_image->alpha_trait=BlendPixelTrait;
   /*
index 6aa8439d5206327f43c3d99353d11944aec6a4b5..7183a0f69edef43a04135fbc922efa2c1a76d765 100644 (file)
@@ -580,8 +580,6 @@ MagickExport MagickBooleanType CompositeImage(Image *image,
   composite_image=CloneImage(composite,0,0,MagickTrue,exception);
   if (composite_image == (const Image *) NULL)
     return(MagickFalse);
-  if (IsGrayColorspace(image->colorspace) != MagickFalse)
-    (void) SetImageColorspace(image,RGBColorspace,exception);
   (void) SetImageColorspace(composite_image,image->colorspace,exception);
   if ((image->alpha_trait == BlendPixelTrait) &&
       (composite_image->alpha_trait != BlendPixelTrait))
index 454582a4b701a1dc744e76b3057d7906383c9e23..3bc9d82948d935a759c390a2efe15e2e14ae5a81 100644 (file)
@@ -230,9 +230,6 @@ MagickExport Image *FrameImage(const Image *image,const FrameInfo *frame_info,
       frame_image=DestroyImage(frame_image);
       return((Image *) NULL);
     }
-  if ((IsPixelInfoGray(&frame_image->matte_color) == MagickFalse) &&
-      (IsGrayColorspace(frame_image->colorspace) != MagickFalse))
-    (void) SetImageColorspace(frame_image,RGBColorspace,exception);
   if ((frame_image->matte_color.alpha_trait == BlendPixelTrait) &&
       (frame_image->alpha_trait != BlendPixelTrait))
     (void) SetImageAlpha(frame_image,OpaqueAlpha,exception);
index 53227acdce725b8e10949b10b49794e7faacaac9..58f7a2248fef869b0305accf50816bf8851c56b2 100644 (file)
@@ -2290,9 +2290,6 @@ MagickExport Image *DistortImage(const Image *image,DistortImageMethod method,
       distort_image=DestroyImage(distort_image);
       return((Image *) NULL);
     }
-  if ((IsPixelInfoGray(&distort_image->background_color) == MagickFalse) &&
-      (IsGrayColorspace(distort_image->colorspace) != MagickFalse))
-    (void) TransformImageColorspace(distort_image,RGBColorspace,exception);
   if (distort_image->background_color.alpha_trait == BlendPixelTrait)
     distort_image->alpha_trait=BlendPixelTrait;
   distort_image->page.x=geometry.x;
index 0a7a29920141d19e4179e16f383331c46c1dafa4..0a9f976a3bbfa515625436f63e349243008f8a8a 100644 (file)
@@ -4145,10 +4145,6 @@ MagickExport MagickBooleanType DrawPrimitive(Image *image,
         draw_info->affine.rx,draw_info->affine.ry,draw_info->affine.sy,
         draw_info->affine.tx,draw_info->affine.ty);
     }
-  if ((IsGrayColorspace(image->colorspace) != MagickFalse) &&
-      ((IsPixelInfoGray(&draw_info->fill) == MagickFalse) ||
-       (IsPixelInfoGray(&draw_info->stroke) == MagickFalse)))
-    (void) SetImageColorspace(image,RGBColorspace,exception);
   status=MagickTrue;
   x=(ssize_t) ceil(primitive_info->point.x-0.5);
   y=(ssize_t) ceil(primitive_info->point.y-0.5);
index 7c8919ebba4d77a07c6097a4bb44fae64ff057fd..262c66bd5be68621dd2a0e5afb461def78b62887 100644 (file)
@@ -324,8 +324,6 @@ MagickExport MagickBooleanType ClutImage(Image *image,const Image *clut_image,
   assert(clut_image->signature == MagickSignature);
   if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse)
     return(MagickFalse);
-  if (IsGrayColorspace(image->colorspace) != MagickFalse)
-    (void) TransformImageColorspace(image,RGBColorspace,exception);
   clut_map=(PixelInfo *) AcquireQuantumMemory(MaxMap+1UL,sizeof(*clut_map));
   if (clut_map == (PixelInfo *) NULL)
     ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
@@ -1954,8 +1952,6 @@ MagickExport MagickBooleanType HaldClutImage(Image *image,
   assert(hald_image->signature == MagickSignature);
   if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse)
     return(MagickFalse);
-  if (IsGrayColorspace(image->colorspace) != MagickFalse)
-    (void) TransformImageColorspace(image,RGBColorspace,exception);
   if (image->alpha_trait != BlendPixelTrait)
     (void) SetImageAlphaChannel(image,OpaqueAlphaChannel,exception);
   /*
@@ -2308,8 +2304,6 @@ MagickExport MagickBooleanType LevelizeImage(Image *image,
   assert(image->signature == MagickSignature);
   if (image->debug != MagickFalse)
     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
-  if (IsGrayColorspace(image->colorspace) != MagickFalse)
-    (void) SetImageColorspace(image,RGBColorspace,exception);
   if (image->storage_class == PseudoClass)
     for (i=0; i < (ssize_t) image->colors; i++)
     {
index befa720776cbf68446cf38a6601773f1fc273fa1..eca389a1798d64e29389529366906893014d4297 100644 (file)
@@ -306,8 +306,6 @@ MagickExport Image *AddNoiseImage(const Image *image,const NoiseType noise_type,
       noise_image=DestroyImage(noise_image);
       return((Image *) NULL);
     }
-  if (IsGrayColorspace(image->colorspace) != MagickFalse)
-    (void) TransformImageColorspace(noise_image,RGBColorspace,exception);
   /*
     Add noise in each row.
   */
@@ -700,9 +698,6 @@ MagickExport Image *ColorizeImage(const Image *image,const char *blend,
       colorize_image=DestroyImage(colorize_image);
       return((Image *) NULL);
     }
-  if ((IsGrayColorspace(image->colorspace) != MagickFalse) &&
-      (IsPixelInfoGray(colorize) != MagickFalse))
-    (void) SetImageColorspace(colorize_image,RGBColorspace,exception);
   if ((colorize_image->alpha_trait != BlendPixelTrait) &&
       (colorize->alpha_trait == BlendPixelTrait))
     (void) SetImageAlpha(colorize_image,OpaqueAlpha,exception);
@@ -4265,8 +4260,6 @@ MagickExport Image *ShadowImage(const Image *image,const double alpha,
   clone_image=CloneImage(image,0,0,MagickTrue,exception);
   if (clone_image == (Image *) NULL)
     return((Image *) NULL);
-  if (IsGrayColorspace(image->colorspace) != MagickFalse)
-    (void) TransformImageColorspace(clone_image,RGBColorspace,exception);
   (void) SetImageVirtualPixelMethod(clone_image,TransparentVirtualPixelMethod,
     exception);
   border_info.width=(size_t) floor(2.0*sigma+0.5);
@@ -5244,9 +5237,6 @@ MagickExport Image *TintImage(const Image *image,const char *blend,
       tint_image=DestroyImage(tint_image);
       return((Image *) NULL);
     }
-  if ((IsGrayColorspace(image->colorspace) != MagickFalse) &&
-      (IsPixelInfoGray(tint) == MagickFalse))
-    (void) SetImageColorspace(tint_image,RGBColorspace,exception);
   if (blend == (const char *) NULL)
     return(tint_image);
   /*
index 14c875cb8c50cd48b4b589f4edea68ed4a36f78b..e5cbb080537ef96dae6c68ec4c3a95b251e87e9f 100644 (file)
@@ -2363,9 +2363,6 @@ MagickExport MagickBooleanType SetImageBackgroundColor(Image *image,
   assert(image->signature == MagickSignature);
   if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse)
     return(MagickFalse);
-  if ((IsPixelInfoGray(&image->background_color) == MagickFalse) &&
-      (IsGrayColorspace(image->colorspace) != MagickFalse))
-    (void) TransformImageColorspace(image,RGBColorspace,exception);
   if ((image->background_color.alpha_trait == BlendPixelTrait) &&
       (image->alpha_trait != BlendPixelTrait))
     (void) SetImageAlpha(image,OpaqueAlpha,exception);
index 0e4e8c32e3c463f61d6f516161a4fb08ab4a19e1..7342697b3cce4ccacc25db026ac3e221ec9acede 100644 (file)
@@ -1435,7 +1435,9 @@ static const OptionInfo
     { "Brightness", BrightnessPixelIntensityMethod, UndefinedOptionFlag, MagickTrue },
     { "Lightness", LightnessPixelIntensityMethod, UndefinedOptionFlag, MagickTrue },
     { "Rec601Luma", Rec601LumaPixelIntensityMethod, UndefinedOptionFlag, MagickTrue },
+    { "Rec601Luminance", Rec601LuminanceaPixelIntensityMethod, UndefinedOptionFlag, MagickTrue },
     { "Rec709Luma", Rec709LumaPixelIntensityMethod, UndefinedOptionFlag, MagickTrue },
+    { "Rec709Luminance", Rec709LuminanceaPixelIntensityMethod, UndefinedOptionFlag, MagickTrue },
     { "RMS", RMSPixelIntensityMethod, UndefinedOptionFlag, MagickTrue },
     { (char *) NULL, UndefinedPixelIntensityMethod, UndefinedOptionFlag, MagickFalse }
   },
index c0821819be8b0222d243ff6d7255478b681850fc..d22a7402e14b31ff95efc31a72061dc8a4dd3655 100644 (file)
@@ -172,8 +172,6 @@ MagickExport MagickBooleanType FloodfillPaintImage(Image *image,
     return(MagickFalse);
   if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse)
     return(MagickFalse);
-  if (IsGrayColorspace(image->colorspace) != MagickFalse)
-    (void) TransformImageColorspace(image,RGBColorspace,exception);
   if ((image->alpha_trait != BlendPixelTrait) &&
       (draw_info->fill.alpha_trait == BlendPixelTrait))
     (void) SetImageAlpha(image,OpaqueAlpha,exception);
@@ -780,9 +778,6 @@ MagickExport MagickBooleanType OpaquePaintImage(Image *image,
     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
   if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse)
     return(MagickFalse);
-  if ((IsGrayColorspace(image->colorspace) != MagickFalse) &&
-      (IsPixelInfoGray(fill) == MagickFalse))
-    (void) TransformImageColorspace(image,RGBColorspace,exception);
   if ((fill->alpha_trait == BlendPixelTrait) &&
       (image->alpha_trait != BlendPixelTrait))
     (void) SetImageAlpha(image,OpaqueAlpha,exception);
index 7e20f1f4608a256ea4c163d0ea3212a4f6e83de0..4ea2321bb8a295fff39f9364f387ef994ec313ce 100644 (file)
@@ -2098,16 +2098,19 @@ MagickExport void GetPixelInfo(const Image *image,PixelInfo *pixel)
 %  GetPixelIntensity() returns a single sample intensity value from the red,
 %  green, and blue components of a pixel based on the selected method:
 %
-%    Rec601Luma   0.298839R + 0.586811G + 0.114350B
-%    Rec709Luma   0.21260R + 0.71520G + 0.07220B
-%    Brightness   max(R, G, B)
-%    Lightness    (min(R, G, B) + max(R, G, B)) / 2.0
-%    RMS          (R^2 + G^2 + B^2) / 3.0
-%    Average      (R + G + B) / 3.0
+%    Rec601Luma       0.298839R' + 0.586811G' + 0.114350B'
+%    Rec601Luminance  0.298839R + 0.586811G + 0.114350B
+%    Rec709Luma       0.21260R' + 0.71520G' + 0.07220B'
+%    Rec709Luminance  0.21260R + 0.71520G + 0.07220B
+%    Brightness       max(R, G, B)
+%    Lightness        (min(R, G, B) + max(R, G, B)) / 2.0
+%    RMS              (R'^2 + G'^2 + B'^2) / 3.0
+%    Average          (R' + G' + B') / 3.0
 %
 %  The format of the GetPixelIntensity method is:
 %
-%      GetPixelIntensity(const Image *image,const Quantum *pixel)
+%      MagickRealType GetPixelIntensity(const Image *image,
+%        const Quantum *pixel)
 %
 %  A description of each parameter follows:
 %
@@ -2151,6 +2154,11 @@ MagickExport MagickRealType GetPixelIntensity(const Image *restrict image,
   {
     case Rec601LumaPixelIntensityMethod:
     default:
+    {
+      intensity=0.298839f*red+0.586811f*green+0.114350f*blue;
+      break;
+    }
+    case Rec601LuminancePixelIntensityMethod:
     {
       if (image->colorspace == sRGBColorspace)
         {
@@ -2162,6 +2170,11 @@ MagickExport MagickRealType GetPixelIntensity(const Image *restrict image,
       break;
     }
     case Rec709LumaPixelIntensityMethod:
+    {
+      intensity=0.21260f*red+0.71520f*green+0.07220f*blue;
+      break;
+    }
+    case Rec709LuminancePixelIntensityMethod:
     {
       if (image->colorspace == sRGBColorspace)
         {
@@ -2174,23 +2187,11 @@ MagickExport MagickRealType GetPixelIntensity(const Image *restrict image,
     }
     case BrightnessPixelIntensityMethod:
     {
-      if (image->colorspace == sRGBColorspace)
-        {
-          red=DecodePixelGamma(red);
-          green=DecodePixelGamma(green);
-          blue=DecodePixelGamma(blue);
-        }
       intensity=MagickMax(MagickMax(red,green),blue);
       break;
     }
     case LightnessPixelIntensityMethod:
     {
-      if (image->colorspace == sRGBColorspace)
-        {
-          red=DecodePixelGamma(red);
-          green=DecodePixelGamma(green);
-          blue=DecodePixelGamma(blue);
-        }
       intensity=MagickMin(MagickMin(red,green),blue);
       break;
     }
index 474ed59ee8ab797bb937f6156d4485b60da2de16..f9f0b1f51411464d873a60552baf6109a63548e6 100644 (file)
@@ -91,7 +91,9 @@ typedef enum
   BrightnessPixelIntensityMethod,
   LightnessPixelIntensityMethod,
   Rec601LumaPixelIntensityMethod,
+  Rec601LuminancePixelIntensityMethod,
   Rec709LumaPixelIntensityMethod,
+  Rec709LuminancePixelIntensityMethod,
   RMSPixelIntensityMethod
 } PixelIntensityMethod;