From: cristy Date: Wed, 31 Mar 2010 16:14:11 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~9718 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b25a32d26eab8dded4e10f76f3c50b303e4e223c;p=imagemagick --- diff --git a/magick/fx.c b/magick/fx.c index d467484a0..f1368f9d2 100644 --- a/magick/fx.c +++ b/magick/fx.c @@ -3681,20 +3681,16 @@ MagickExport Image *RecolorImage(const Image *image,const unsigned long order, *image_view, *recolor_view; - const double - *recolor_matrix[6]; - double - RecolorMatrix[] = + recolor_matrix[6][6] = { - 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, - 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, - 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, - 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, - 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, - 0.0, 0.0, 0.0, 0.0, 0.0, 1.0 - }, - *m; + { 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 }, + { 0.0, 1.0, 0.0, 0.0, 0.0, 0.0 }, + { 0.0, 0.0, 1.0, 0.0, 0.0, 0.0 }, + { 0.0, 0.0, 0.0, 1.0, 0.0, 0.0 }, + { 0.0, 0.0, 0.0, 0.0, 1.0, 0.0 }, + { 0.0, 0.0, 0.0, 0.0, 0.0, 1.0 } + }; Image *recolor_image; @@ -3708,9 +3704,6 @@ MagickExport Image *RecolorImage(const Image *image,const unsigned long order, MagickBooleanType status; - register const double - *k; - register long i; @@ -3725,24 +3718,12 @@ MagickExport Image *RecolorImage(const Image *image,const unsigned long order, assert(exception->signature == MagickSignature); if ((order < 1) || (order > 6)) return(CloneImage(image,0,0,MagickTrue,exception)); - for (i=0; i < 6; i++) - recolor_matrix[i]=(double *) NULL; - k=color_matrix; + i=0; for (v=0; v < (long) order; v++) - { - m=(&RecolorMatrix[6*v]); for (u=0; u < (long) order; u++) - { - if (*k != m[u]) - { - m[u]=(*k); - recolor_matrix[v]=m; - } - k++; - } - } + recolor_matrix[v][u]=color_matrix[i++]; /* - Recolor image. + Initialize recolor image. */ recolor_image=CloneImage(image,0,0,MagickTrue,exception); if (recolor_image == (Image *) NULL) @@ -3761,7 +3742,6 @@ MagickExport Image *RecolorImage(const Image *image,const unsigned long order, (void) LogMagickEvent(TransformEvent,GetMagickModule(), " Recolor image with color matrix:"); - m=RecolorMatrix; message=AcquireString(""); for (v=0; v < 6; v++) { @@ -3770,7 +3750,8 @@ MagickExport Image *RecolorImage(const Image *image,const unsigned long order, (void) ConcatenateString(&message,format); for (u=0; u < 6; u++) { - (void) FormatMagickString(format,MaxTextExtent,"%+f ",*m++); + (void) FormatMagickString(format,MaxTextExtent,"%+f ", + recolor_matrix[v][u]); (void) ConcatenateString(&message,format); } (void) LogMagickEvent(TransformEvent,GetMagickModule(),"%s",message); @@ -3790,7 +3771,7 @@ MagickExport Image *RecolorImage(const Image *image,const unsigned long order, for (y=0; y < (long) image->rows; y++) { MagickRealType - pixels[6]; + pixel; register const IndexPacket *restrict indexes; @@ -3826,31 +3807,33 @@ MagickExport Image *RecolorImage(const Image *image,const unsigned long order, for (v=0; v < (long) order; v++) { - pixels[v]=recolor_matrix[v][0]*q->red+recolor_matrix[v][1]*q->green+ - recolor_matrix[v][2]*q->blue; + pixel=recolor_matrix[v][0]*p->red+recolor_matrix[v][1]*p->green+ + recolor_matrix[v][2]*p->blue; if (image->matte != MagickFalse) - pixels[v]+=recolor_matrix[v][3]*(QuantumRange-q->opacity); + pixel+=recolor_matrix[v][3]*(QuantumRange-p->opacity); if (image->colorspace == CMYKColorspace) - pixels[v]+=recolor_matrix[v][4]*indexes[x]; + pixel+=recolor_matrix[v][4]*indexes[x]; + pixel+=QuantumRange*recolor_matrix[v][5]; switch (v) { - case 0: q->red=ClampToQuantum(pixels[v]); break; - case 1: q->green=ClampToQuantum(pixels[v]); break; - case 2: q->blue=ClampToQuantum(pixels[v]); break; + case 0: q->red=ClampToQuantum(pixel); break; + case 1: q->green=ClampToQuantum(pixel); break; + case 2: q->blue=ClampToQuantum(pixel); break; case 3: { if (image->matte != MagickFalse) - q->opacity=ClampToQuantum(QuantumRange-pixels[v]); + q->opacity=ClampToQuantum(QuantumRange-pixel); break; } case 4: { if (image->colorspace == CMYKColorspace) - recolor_indexes[x]=ClampToQuantum(pixels[v]); + recolor_indexes[x]=ClampToQuantum(pixel); break; } } } + p++; q++; } if (SyncCacheViewAuthenticPixels(recolor_view,exception) == MagickFalse) diff --git a/utilities/convert.1 b/utilities/convert.1 index 8aaeed918..1f4f747f0 100644 --- a/utilities/convert.1 +++ b/utilities/convert.1 @@ -172,7 +172,7 @@ Image Operators: \-raise value lighten/darken image edges to create a 3-D effect \-random-threshold low,high random threshold the image - \-recolor matrix translate, scale, shear, or rotate image colors + \-recolor matrix apply color correction to the image \-region geometry apply options to a portion of the image \-render render vector graphics \-repage geometry size and location of an image canvas diff --git a/utilities/convert.1.in b/utilities/convert.1.in index fd8f1a742..8a72a8086 100644 --- a/utilities/convert.1.in +++ b/utilities/convert.1.in @@ -173,7 +173,7 @@ Image Operators: \-raise value lighten/darken image edges to create a 3-D effect \-random-threshold low,high random threshold the image - \-recolor matrix translate, scale, shear, or rotate image colors + \-recolor matrix apply color correction to the image \-region geometry apply options to a portion of the image \-render render vector graphics \-repage geometry size and location of an image canvas diff --git a/utilities/mogrify.1 b/utilities/mogrify.1 index a384f8245..d06721d6e 100644 --- a/utilities/mogrify.1 +++ b/utilities/mogrify.1 @@ -174,7 +174,7 @@ Image Operators: \-raise value lighten/darken image edges to create a 3-D effect \-random-threshold low,high random threshold the image - \-recolor matrix translate, scale, shear, or rotate image colors + \-recolor matrix apply color correction to the image \-region geometry apply options to a portion of the image \-render render vector graphics \-repage geometry size and location of an image canvas diff --git a/utilities/mogrify.1.in b/utilities/mogrify.1.in index 7a45c66b3..a7ea4555b 100644 --- a/utilities/mogrify.1.in +++ b/utilities/mogrify.1.in @@ -175,7 +175,7 @@ Image Operators: \-raise value lighten/darken image edges to create a 3-D effect \-random-threshold low,high random threshold the image - \-recolor matrix translate, scale, shear, or rotate image colors + \-recolor matrix apply color correction to the image \-region geometry apply options to a portion of the image \-render render vector graphics \-repage geometry size and location of an image canvas diff --git a/wand/convert.c b/wand/convert.c index 940a6bff9..dc324c0ad 100644 --- a/wand/convert.c +++ b/wand/convert.c @@ -240,7 +240,7 @@ static MagickBooleanType ConvertUsage(void) "-raise value lighten/darken image edges to create a 3-D effect", "-random-threshold low,high", " random threshold the image", - "-recolor matrix translate, scale, shear, or rotate image colors", + "-recolor matrix apply color correction to the image", "-region geometry apply options to a portion of the image", "-render render vector graphics", "-repage geometry size and location of an image canvas", diff --git a/wand/magick-image.c b/wand/magick-image.c index ccc0b21bf..2acffb27a 100644 --- a/wand/magick-image.c +++ b/wand/magick-image.c @@ -8557,7 +8557,7 @@ WandExport MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file) % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% MagickRecolorImage() translate, scale, shear, or rotate image colors. +% MagickRecolorImage() apply color correction to the image. % Although you can use variable sized matrices, typically you use a 5 x 5 for % an RGBA image and a 6x6 for CMYKA. Populate the last row with normalized % values to translate. diff --git a/wand/mogrify.c b/wand/mogrify.c index 88cb1afa8..75b45d5fd 100644 --- a/wand/mogrify.c +++ b/wand/mogrify.c @@ -3755,7 +3755,7 @@ static MagickBooleanType MogrifyUsage(void) "-raise value lighten/darken image edges to create a 3-D effect", "-random-threshold low,high", " random threshold the image", - "-recolor matrix translate, scale, shear, or rotate image colors", + "-recolor matrix apply color correction to the image", "-region geometry apply options to a portion of the image", "-render render vector graphics", "-repage geometry size and location of an image canvas",