]> granicus.if.org Git - imagemagick/commitdiff
gradient:"gray(0)-gray(255)" is linear gray
authorCristy <urban-warrior@imagemagick.org>
Wed, 13 Dec 2017 00:33:36 +0000 (19:33 -0500)
committerCristy <urban-warrior@imagemagick.org>
Wed, 13 Dec 2017 00:33:36 +0000 (19:33 -0500)
MagickCore/color.c
MagickCore/pixel.c
MagickCore/pixel.h
coders/gradient.c

index c9f7578ba0267208d42f98d1229f47f28b28746b..70b553efdff904da327ffc0a8e3144f3d2ebd3c3 100644 (file)
@@ -2456,6 +2456,7 @@ MagickExport MagickBooleanType QueryColorCompliance(const char *name,
           if (LocaleCompare(colorspace,"gray") == 0)
             {
               color->colorspace=GRAYColorspace;
+              color->gamma=1.0;
               color->green=color->red;
               color->blue=color->red;
               if (((flags & SigmaValue) != 0) &&
index ed9fcb837fadb24c27ee64dea97d51593ae21831..cbea7e582c0cfe78e0e33ea760e5292889f8f309 100644 (file)
@@ -2165,6 +2165,7 @@ MagickExport void GetPixelInfo(const Image *image,PixelInfo *pixel)
   pixel->alpha_trait=UndefinedPixelTrait;
   pixel->fuzz=0.0;
   pixel->depth=MAGICKCORE_QUANTUM_DEPTH;
+  pixel->gamma=1.000/2.200;
   pixel->red=0.0;
   pixel->green=0.0;
   pixel->blue=0.0;
@@ -2172,7 +2173,6 @@ MagickExport void GetPixelInfo(const Image *image,PixelInfo *pixel)
   pixel->alpha=(double) OpaqueAlpha;
   pixel->index=0.0;
   pixel->count=0;
-  pixel->fuzz=0.0;
   if (image == (const Image *) NULL)
     return;
   pixel->storage_class=image->storage_class;
@@ -2180,6 +2180,7 @@ MagickExport void GetPixelInfo(const Image *image,PixelInfo *pixel)
   pixel->alpha_trait=image->alpha_trait;
   pixel->depth=image->depth;
   pixel->fuzz=image->fuzz;
+  pixel->gamma=image->gamma;
 }
 \f
 /*
index e92d562435487cf5e25dfe06cc6c13b8d467b9c9..844195b8c354ec6679035853f972e1fa83cc89c9 100644 (file)
@@ -191,6 +191,9 @@ typedef struct _PixelInfo
     black,
     alpha,
     index;
+
+  double
+    gamma;
 } PixelInfo;
 
 typedef struct _PixelPacket
index 9901067b5228f50d2c739c23c0840263375e5120..337b02bb9d41a29b5d6735fe589dbed6aae6ca04 100644 (file)
@@ -173,6 +173,7 @@ static Image *ReadGRADIENTImage(const ImageInfo *image_info,
   image->alpha_trait=stops[0].color.alpha_trait;
   if (stops[1].color.alpha_trait != UndefinedPixelTrait)
     image->alpha_trait=stops[1].color.alpha_trait;
+  image->gamma=MagickMax(stops[0].color.gamma,stops[1].color.gamma);
   status=GradientImage(image,LocaleCompare(image_info->magick,"GRADIENT") == 0 ?
     LinearGradient : RadialGradient,PadSpread,stops,2,exception);
   stops=(StopInfo *) RelinquishMagickMemory(stops);