]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Tue, 3 May 2011 17:12:12 +0000 (17:12 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Tue, 3 May 2011 17:12:12 +0000 (17:12 +0000)
magick/morphology.c
magick/segment.c
magick/shear.c
magick/statistic.c
magick/stream.c
magick/threshold.c
magick/transform.c
magick/xwindow.c

index 318e0c78213b33b744fae8be405a879923e0eaaf..9caa097215361a624f6414638f2134ae258ea878 100644 (file)
@@ -3860,13 +3860,10 @@ MagickExport Image *MorphologyApply(const Image *image, const ChannelType
         goto error_cleanup;
 
       if ( method == VoronoiMorphology ) {
-#if 0
         /* Preserve the alpha channel of input image - but turned off */
         SetImageAlphaChannel(rslt_image, DeactivateAlphaChannel);
         (void) CompositeImageChannel(rslt_image, DefaultChannels,
                 CopyOpacityCompositeOp, image, 0, 0);
-#endif
-        /* ensure alpha is turned off in resultant image */
         SetImageAlphaChannel(rslt_image, DeactivateAlphaChannel);
       }
       goto exit_cleanup;
index 438fef0e9fc86a6864473ae173c818b49488bd66..0f7d99f76d097fd11015827f19a76bce5dc22c9a 100644 (file)
@@ -555,7 +555,7 @@ static MagickBooleanType Classify(Image *image,short **extrema,
     indexes=GetCacheViewAuthenticIndexQueue(image_view);
     for (x=0; x < (ssize_t) image->columns; x++)
     {
-      indexes[x]=(IndexPacket) 0;
+      SetIndexPixelComponent(indexes+x,0);
       for (cluster=head; cluster != (Cluster *) NULL; cluster=cluster->next)
       {
         if (((ssize_t) ScaleQuantumToChar(q->red) >=
@@ -574,7 +574,7 @@ static MagickBooleanType Classify(Image *image,short **extrema,
             /*
               Classify this pixel.
             */
-            indexes[x]=(IndexPacket) cluster->id;
+            SetIndexPixelComponent(indexes+x,cluster->id);
             break;
           }
       }
@@ -624,7 +624,7 @@ static MagickBooleanType Classify(Image *image,short **extrema,
                   Classify this pixel.
                 */
                 local_minima=1.0/sum;
-                indexes[x]=(IndexPacket) j;
+                SetIndexPixelComponent(indexes+x,j);
               }
           }
         }
index 32fb63db80ec939c35b2ddc4dae3b69b09e3cead..6bbdd07d0cadd2289927cc7910713e0d5d5d32af 100644 (file)
@@ -1238,7 +1238,8 @@ static Image *IntegralRotateImage(const Image *image,size_t rotations,
         if ((indexes != (IndexPacket *) NULL) &&
             (rotate_indexes != (IndexPacket *) NULL))
           for (x=0; x < (ssize_t) image->columns; x++)
-            rotate_indexes[image->columns-x-1]=indexes[x];
+            SetIndexPixelComponent(rotate_indexes+image->columns-x-1,
+              GetIndexPixelComponent(indexes+x));
         sync=SyncCacheViewAuthenticPixels(rotate_view,exception);
         if (sync == MagickFalse)
           status=MagickFalse;
index 4858ef12b53dc0f17ac28413ff0b0c62ef637620..0047aa5be0e5f9538f7fbfa39c5a0260c40db5ad 100644 (file)
@@ -570,15 +570,18 @@ MagickExport Image *EvaluateImages(const Image *images,
         }
         qsort((void *) evaluate_pixel,number_images,sizeof(*evaluate_pixel),
           IntensityCompare);
-        q->red=ClampToQuantum(evaluate_pixel[i/2].red);
-        q->green=ClampToQuantum(evaluate_pixel[i/2].green);
-        q->blue=ClampToQuantum(evaluate_pixel[i/2].blue);
+        SetRedPixelComponent(q,ClampToQuantum(evaluate_pixel[i/2].red));
+        SetGreenPixelComponent(q,ClampToQuantum(evaluate_pixel[i/2].green));
+        SetBluePixelComponent(q,ClampToQuantum(evaluate_pixel[i/2].blue));
         if (evaluate_image->matte == MagickFalse)
-          q->opacity=ClampToQuantum(evaluate_pixel[i/2].opacity);
+          SetOpacityPixelComponent(q,ClampToQuantum(
+            evaluate_pixel[i/2].opacity));
         else
-          q->opacity=ClampToQuantum(QuantumRange-evaluate_pixel[i/2].opacity);
+          SetOpacityPixelComponent(q,ClampToQuantum(QuantumRange-
+            evaluate_pixel[i/2].opacity));
         if (evaluate_image->colorspace == CMYKColorspace)
-          evaluate_indexes[i]=ClampToQuantum(evaluate_pixel[i/2].index);
+          SetIndexPixelComponent(evaluate_indexes+i,ClampToQuantum(
+            evaluate_pixel[i/2].index));
         q++;
       }
       if (SyncCacheViewAuthenticPixels(evaluate_view,exception) == MagickFalse)
@@ -660,16 +663,18 @@ MagickExport Image *EvaluateImages(const Image *images,
           evaluate_pixel[x].red=ApplyEvaluateOperator(random_info[id],
             GetRedPixelComponent(p),i == 0 ? AddEvaluateOperator : op,evaluate_pixel[x].red);
           evaluate_pixel[x].green=ApplyEvaluateOperator(random_info[id],
-            GetGreenPixelComponent(p),i == 0 ? AddEvaluateOperator : op,evaluate_pixel[x].green);
+            GetGreenPixelComponent(p),i == 0 ? AddEvaluateOperator : op,
+            evaluate_pixel[x].green);
           evaluate_pixel[x].blue=ApplyEvaluateOperator(random_info[id],
-            GetBluePixelComponent(p),i == 0 ? AddEvaluateOperator : op,evaluate_pixel[x].blue);
+            GetBluePixelComponent(p),i == 0 ? AddEvaluateOperator : op,
+            evaluate_pixel[x].blue);
           evaluate_pixel[x].opacity=ApplyEvaluateOperator(random_info[id],
             GetOpacityPixelComponent(p),i == 0 ? AddEvaluateOperator : op,
             evaluate_pixel[x].opacity);
           if (evaluate_image->colorspace == CMYKColorspace)
             evaluate_pixel[x].index=ApplyEvaluateOperator(random_info[id],
-              indexes[x],i == 0 ? AddEvaluateOperator : op,
-              evaluate_pixel[x].index);
+              GetIndexPixelComponent(indexes+x),i == 0 ? AddEvaluateOperator :
+              op,evaluate_pixel[x].index);
           p++;
         }
         image_view=DestroyCacheView(image_view);
@@ -686,15 +691,17 @@ MagickExport Image *EvaluateImages(const Image *images,
         }
       for (x=0; x < (ssize_t) evaluate_image->columns; x++)
       {
-        q->red=ClampToQuantum(evaluate_pixel[x].red);
-        q->green=ClampToQuantum(evaluate_pixel[x].green);
-        q->blue=ClampToQuantum(evaluate_pixel[x].blue);
+        SetRedPixelComponent(q,ClampToQuantum(evaluate_pixel[x].red));
+        SetGreenPixelComponent(q,ClampToQuantum(evaluate_pixel[x].green));
+        SetBluePixelComponent(q,ClampToQuantum(evaluate_pixel[x].blue));
         if (evaluate_image->matte == MagickFalse)
-          q->opacity=ClampToQuantum(evaluate_pixel[x].opacity);
+          SetOpacityPixelComponent(q,ClampToQuantum(evaluate_pixel[x].opacity));
         else
-          q->opacity=ClampToQuantum(QuantumRange-evaluate_pixel[x].opacity);
+          SetOpacityPixelComponent(q,ClampToQuantum(QuantumRange-
+            evaluate_pixel[x].opacity));
         if (evaluate_image->colorspace == CMYKColorspace)
-          evaluate_indexes[x]=ClampToQuantum(evaluate_pixel[x].index);
+          SetIndexPixelComponent(evaluate_indexes+x,ClampToQuantum(
+            evaluate_pixel[x].index));
         q++;
       }
       if (SyncCacheViewAuthenticPixels(evaluate_view,exception) == MagickFalse)
@@ -784,26 +791,27 @@ MagickExport MagickBooleanType EvaluateImageChannel(Image *image,
     for (x=0; x < (ssize_t) image->columns; x++)
     {
       if ((channel & RedChannel) != 0)
-        q->red=ClampToQuantum(ApplyEvaluateOperator(random_info[id],q->red,op,
-          value));
+        SetRedPixelComponent(q,ClampToQuantum(ApplyEvaluateOperator(
+          random_info[id],GetRedPixelComponent(q),op,value)));
       if ((channel & GreenChannel) != 0)
-        q->green=ClampToQuantum(ApplyEvaluateOperator(random_info[id],q->green,
-          op,value));
+        SetGreenPixelComponent(q,ClampToQuantum(ApplyEvaluateOperator(
+          random_info[id],GetGreenPixelComponent(q),op,value)));
       if ((channel & BlueChannel) != 0)
-        q->blue=ClampToQuantum(ApplyEvaluateOperator(random_info[id],q->blue,op,
-          value));
+        SetBluePixelComponent(q,ClampToQuantum(ApplyEvaluateOperator(
+          random_info[id],GetBluePixelComponent(q),op,value)));
       if ((channel & OpacityChannel) != 0)
         {
           if (image->matte == MagickFalse)
-            q->opacity=ClampToQuantum(ApplyEvaluateOperator(random_info[id],
-              q->opacity,op,value));
+            SetOpacityPixelComponent(q,ClampToQuantum(ApplyEvaluateOperator(
+              random_info[id],GetOpacityPixelComponent(q),op,value)));
           else
-            q->opacity=ClampToQuantum(QuantumRange-ApplyEvaluateOperator(
-              random_info[id],(Quantum) GetAlphaPixelComponent(q),op,value));
+            SetOpacityPixelComponent(q,ClampToQuantum(QuantumRange-
+              ApplyEvaluateOperator(random_info[id],GetAlphaPixelComponent(q),
+              op,value)));
         }
       if (((channel & IndexChannel) != 0) && (indexes != (IndexPacket *) NULL))
-        indexes[x]=(IndexPacket) ClampToQuantum(ApplyEvaluateOperator(
-          random_info[id],indexes[x],op,value));
+        SetIndexPixelComponent(indexes+x,ClampToQuantum(ApplyEvaluateOperator(
+          random_info[id],GetIndexPixelComponent(indexes+x),op,value)));
       q++;
     }
     if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
@@ -1019,27 +1027,28 @@ MagickExport MagickBooleanType FunctionImageChannel(Image *image,
     for (x=0; x < (ssize_t) image->columns; x++)
     {
       if ((channel & RedChannel) != 0)
-        q->red=ApplyFunction(q->red,function,number_parameters,parameters,
-          exception);
+        SetRedPixelComponent(q,ApplyFunction(GetRedPixelComponent(q),
+          function,number_parameters,parameters,exception));
       if ((channel & GreenChannel) != 0)
-        q->green=ApplyFunction(q->green,function,number_parameters,parameters,
-          exception);
+        SetGreenPixelComponent(q,ApplyFunction(GetGreenPixelComponent(q),
+          function,number_parameters,parameters,exception));
       if ((channel & BlueChannel) != 0)
-        q->blue=ApplyFunction(q->blue,function,number_parameters,parameters,
-          exception);
+        SetBluePixelComponent(q,ApplyFunction(GetBluePixelComponent(q),
+          function,number_parameters,parameters,exception));
       if ((channel & OpacityChannel) != 0)
         {
           if (image->matte == MagickFalse)
-            q->opacity=ApplyFunction(q->opacity,function,number_parameters,
-              parameters,exception);
+            SetOpacityPixelComponent(q,ApplyFunction(
+              GetOpacityPixelComponent(q),function,number_parameters,parameters,
+              exception));
           else
-            q->opacity=(Quantum) QuantumRange-ApplyFunction((Quantum)
+            SetOpacityPixelComponent(q,QuantumRange-ApplyFunction((Quantum)
               GetAlphaPixelComponent(q),function,number_parameters,parameters,
-              exception);
+              exception));
         }
       if (((channel & IndexChannel) != 0) && (indexes != (IndexPacket *) NULL))
-        indexes[x]=(IndexPacket) ApplyFunction(GetIndexPixelComponent(indexes+x),function,
-          number_parameters,parameters,exception);
+        SetIndexPixelComponent(indexes+x,ApplyFunction(GetIndexPixelComponent(
+          indexes+x),function,number_parameters,parameters,exception));
       q++;
     }
     if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
@@ -1341,46 +1350,60 @@ MagickExport MagickBooleanType GetImageChannelKurtosis(const Image *image,
         {
           mean+=GetRedPixelComponent(p);
           sum_squares+=(double) GetRedPixelComponent(p)*GetRedPixelComponent(p);
-          sum_cubes+=(double) GetRedPixelComponent(p)*GetRedPixelComponent(p)*GetRedPixelComponent(p);
-          sum_fourth_power+=(double) GetRedPixelComponent(p)*GetRedPixelComponent(p)*GetRedPixelComponent(p)*
+          sum_cubes+=(double) GetRedPixelComponent(p)*GetRedPixelComponent(p)*
+            GetRedPixelComponent(p);
+          sum_fourth_power+=(double) GetRedPixelComponent(p)*
+            GetRedPixelComponent(p)*GetRedPixelComponent(p)*
             GetRedPixelComponent(p);
           area++;
         }
       if ((channel & GreenChannel) != 0)
         {
           mean+=GetGreenPixelComponent(p);
-          sum_squares+=(double) GetGreenPixelComponent(p)*GetGreenPixelComponent(p);
-          sum_cubes+=(double) GetGreenPixelComponent(p)*GetGreenPixelComponent(p)*GetGreenPixelComponent(p);
-          sum_fourth_power+=(double) GetGreenPixelComponent(p)*GetGreenPixelComponent(p)*GetGreenPixelComponent(p)*
+          sum_squares+=(double) GetGreenPixelComponent(p)*
+            GetGreenPixelComponent(p);
+          sum_cubes+=(double) GetGreenPixelComponent(p)*
+            GetGreenPixelComponent(p)*GetGreenPixelComponent(p);
+          sum_fourth_power+=(double) GetGreenPixelComponent(p)*
+            GetGreenPixelComponent(p)*GetGreenPixelComponent(p)*
             GetGreenPixelComponent(p);
           area++;
         }
       if ((channel & BlueChannel) != 0)
         {
           mean+=GetBluePixelComponent(p);
-          sum_squares+=(double) GetBluePixelComponent(p)*GetBluePixelComponent(p);
-          sum_cubes+=(double) GetBluePixelComponent(p)*GetBluePixelComponent(p)*GetBluePixelComponent(p);
-          sum_fourth_power+=(double) GetBluePixelComponent(p)*GetBluePixelComponent(p)*GetBluePixelComponent(p)*
+          sum_squares+=(double) GetBluePixelComponent(p)*
+            GetBluePixelComponent(p);
+          sum_cubes+=(double) GetBluePixelComponent(p)*GetBluePixelComponent(p)*
+            GetBluePixelComponent(p);
+          sum_fourth_power+=(double) GetBluePixelComponent(p)*
+            GetBluePixelComponent(p)*GetBluePixelComponent(p)*
             GetBluePixelComponent(p);
           area++;
         }
       if ((channel & OpacityChannel) != 0)
         {
           mean+=GetOpacityPixelComponent(p);
-          sum_squares+=(double) GetOpacityPixelComponent(p)*GetOpacityPixelComponent(p);
-          sum_cubes+=(double) GetOpacityPixelComponent(p)*GetOpacityPixelComponent(p)*GetOpacityPixelComponent(p);
-          sum_fourth_power+=(double) GetOpacityPixelComponent(p)*GetOpacityPixelComponent(p)*GetOpacityPixelComponent(p)*
+          sum_squares+=(double) GetOpacityPixelComponent(p)*
+            GetOpacityPixelComponent(p);
+          sum_cubes+=(double) GetOpacityPixelComponent(p)*
+            GetOpacityPixelComponent(p)*GetOpacityPixelComponent(p);
+          sum_fourth_power+=(double) GetOpacityPixelComponent(p)*
+            GetOpacityPixelComponent(p)*GetOpacityPixelComponent(p)*
             GetOpacityPixelComponent(p);
           area++;
         }
       if (((channel & IndexChannel) != 0) &&
           (image->colorspace == CMYKColorspace))
         {
-          mean+=indexes[x];
-          sum_squares+=(double) indexes[x]*indexes[x];
-          sum_cubes+=(double) indexes[x]*indexes[x]*indexes[x];
-          sum_fourth_power+=(double) indexes[x]*indexes[x]*indexes[x]*
-            indexes[x];
+          mean+=GetIndexPixelComponent(indexes+x);
+          sum_squares+=(double) GetIndexPixelComponent(indexes+x)*
+            GetIndexPixelComponent(indexes+x);
+          sum_cubes+=(double) GetIndexPixelComponent(indexes+x)*
+            GetIndexPixelComponent(indexes+x)*GetIndexPixelComponent(indexes+x);
+          sum_fourth_power+=(double) GetIndexPixelComponent(indexes+x)*
+            GetIndexPixelComponent(indexes+x)*GetIndexPixelComponent(indexes+x)*
+            GetIndexPixelComponent(indexes+x);
           area++;
         }
       p++;
@@ -1514,10 +1537,10 @@ MagickExport MagickBooleanType GetImageChannelRange(const Image *image,
       if (((channel & IndexChannel) != 0) &&
           (image->colorspace == CMYKColorspace))
         {
-          if ((double) indexes[x] < *minima)
-            *minima=(double) indexes[x];
-          if ((double) indexes[x] > *maxima)
-            *maxima=(double) indexes[x];
+          if ((double) GetIndexPixelComponent(indexes+x) < *minima)
+            *minima=(double) GetIndexPixelComponent(indexes+x);
+          if ((double) GetIndexPixelComponent(indexes+x) > *maxima)
+            *maxima=(double) GetIndexPixelComponent(indexes+x);
         }
       p++;
     }
@@ -1679,8 +1702,9 @@ MagickExport ChannelStatistics *GetImageChannelStatistics(const Image *image,
             {
               depth=channel_statistics[BlackChannel].depth;
               range=GetQuantumRange(depth);
-              status=indexes[x] != ScaleAnyToQuantum(ScaleQuantumToAny(
-                indexes[x],range),range) ? MagickTrue : MagickFalse;
+              status=GetIndexPixelComponent(indexes+x) !=
+                ScaleAnyToQuantum(ScaleQuantumToAny(GetIndexPixelComponent(
+                indexes+x),range),range) ? MagickTrue : MagickFalse;
               if (status != MagickFalse)
                 {
                   channel_statistics[BlackChannel].depth++;
@@ -1751,17 +1775,22 @@ MagickExport ChannelStatistics *GetImageChannelStatistics(const Image *image,
         }
       if (image->colorspace == CMYKColorspace)
         {
-          if ((double) indexes[x] < channel_statistics[BlackChannel].minima)
-            channel_statistics[BlackChannel].minima=(double) indexes[x];
-          if ((double) indexes[x] > channel_statistics[BlackChannel].maxima)
-            channel_statistics[BlackChannel].maxima=(double) indexes[x];
-          channel_statistics[BlackChannel].sum+=indexes[x];
+          if ((double) GetIndexPixelComponent(indexes+x) < channel_statistics[BlackChannel].minima)
+            channel_statistics[BlackChannel].minima=(double)
+              GetIndexPixelComponent(indexes+x);
+          if ((double) GetIndexPixelComponent(indexes+x) > channel_statistics[BlackChannel].maxima)
+            channel_statistics[BlackChannel].maxima=(double)
+              GetIndexPixelComponent(indexes+x);
+          channel_statistics[BlackChannel].sum+=
+            GetIndexPixelComponent(indexes+x);
           channel_statistics[BlackChannel].sum_squared+=(double)
-            indexes[x]*indexes[x];
-          channel_statistics[BlackChannel].sum_cubed+=(double) indexes[x]*
-            indexes[x]*indexes[x];
+            GetIndexPixelComponent(indexes+x)*GetIndexPixelComponent(indexes+x);
+          channel_statistics[BlackChannel].sum_cubed+=(double)
+            GetIndexPixelComponent(indexes+x)*GetIndexPixelComponent(indexes+x)*
+            GetIndexPixelComponent(indexes+x);
           channel_statistics[BlackChannel].sum_fourth_power+=(double)
-            indexes[x]*indexes[x]*indexes[x]*indexes[x];
+            GetIndexPixelComponent(indexes+x)*GetIndexPixelComponent(indexes+x)*
+            GetIndexPixelComponent(indexes+x)*GetIndexPixelComponent(indexes+x);
         }
       x++;
       p++;
index 07ee7718de6ab413d7a1377669af800723867861..e7a6f9b07d27eaacf66587818b44ac77290dd19e 100644 (file)
@@ -1525,7 +1525,7 @@ static MagickBooleanType StreamImagePixels(const StreamInfo *stream_info,
             case BlackQuantum:
             {
               if (image->colorspace == CMYKColorspace)
-                *q=ScaleQuantumToChar(indexes[x]);
+                *q=ScaleQuantumToChar(GetIndexPixelComponent(indexes+x));
               break;
             }
             case IndexQuantum:
@@ -1716,8 +1716,8 @@ static MagickBooleanType StreamImagePixels(const StreamInfo *stream_info,
             case BlackQuantum:
             {
               if (image->colorspace == CMYKColorspace)
-                *q=(double) ((QuantumScale*indexes[x])*quantum_info->scale+
-                  quantum_info->minimum);
+                *q=(double) ((QuantumScale*GetIndexPixelComponent(indexes+x))*
+                  quantum_info->scale+quantum_info->minimum);
               break;
             }
             case IndexQuantum:
@@ -1909,8 +1909,8 @@ static MagickBooleanType StreamImagePixels(const StreamInfo *stream_info,
             case BlackQuantum:
             {
               if (image->colorspace == CMYKColorspace)
-                *q=(float) ((QuantumScale*indexes[x])*quantum_info->scale+
-                  quantum_info->minimum);
+                *q=(float) ((QuantumScale*GetIndexPixelComponent(indexes+x))*
+                  quantum_info->scale+quantum_info->minimum);
               break;
             }
             case IndexQuantum:
@@ -2080,7 +2080,8 @@ static MagickBooleanType StreamImagePixels(const StreamInfo *stream_info,
             case BlackQuantum:
             {
               if (image->colorspace == CMYKColorspace)
-                *q=(unsigned int) ScaleQuantumToLong(indexes[x]);
+                *q=(unsigned int) ScaleQuantumToLong(GetIndexPixelComponent(
+                  indexes+x));
               break;
             }
             case IndexQuantum:
@@ -2246,7 +2247,7 @@ static MagickBooleanType StreamImagePixels(const StreamInfo *stream_info,
             case BlackQuantum:
             {
               if (image->colorspace == CMYKColorspace)
-                *q=ScaleQuantumToLong(indexes[x]);
+                *q=ScaleQuantumToLong(GetIndexPixelComponent(indexes+x));
               break;
             }
             case IndexQuantum:
@@ -2411,7 +2412,7 @@ static MagickBooleanType StreamImagePixels(const StreamInfo *stream_info,
             case BlackQuantum:
             {
               if (image->colorspace == CMYKColorspace)
-                *q=indexes[x];
+                *q=GetIndexPixelComponent(indexes+x);
               break;
             }
             case IndexQuantum:
@@ -2576,7 +2577,7 @@ static MagickBooleanType StreamImagePixels(const StreamInfo *stream_info,
             case BlackQuantum:
             {
               if (image->colorspace == CMYKColorspace)
-                *q=ScaleQuantumToShort(indexes[x]);
+                *q=ScaleQuantumToShort(GetIndexPixelComponent(indexes+x));
               break;
             }
             case IndexQuantum:
index 1eaa7545d4ac422b68b9044ef082d93af8178f5a..411859857b0ebc6e2d17a6cf2998702fa39b7d2c 100644 (file)
@@ -257,7 +257,8 @@ MagickExport Image *AdaptiveThresholdImage(const Image *image,
           pixel.blue+=r[u].blue;
           pixel.opacity+=r[u].opacity;
           if (image->colorspace == CMYKColorspace)
-            pixel.index=(MagickRealType) indexes[x+(r-p)+u];
+            pixel.index=(MagickRealType) GetIndexPixelComponent(
+              indexes+x+(r-p)+u);
         }
         r+=image->columns+width;
       }
@@ -267,17 +268,18 @@ MagickExport Image *AdaptiveThresholdImage(const Image *image,
       mean.opacity=(MagickRealType) (pixel.opacity/number_pixels+offset);
       if (image->colorspace == CMYKColorspace)
         mean.index=(MagickRealType) (pixel.index/number_pixels+offset);
-      q->red=(Quantum) (((MagickRealType) q->red <= mean.red) ?
-        0 : QuantumRange);
-      q->green=(Quantum) (((MagickRealType) q->green <= mean.green) ?
-        0 : QuantumRange);
-      q->blue=(Quantum) (((MagickRealType) q->blue <= mean.blue) ?
-        0 : QuantumRange);
-      q->opacity=(Quantum) (((MagickRealType) q->opacity <= mean.opacity) ?
-        0 : QuantumRange);
+      SetRedPixelComponent(q,((MagickRealType) GetRedPixelComponent(q) <=
+        mean.red) ? 0 : QuantumRange);
+      SetGreenPixelComponent(q,((MagickRealType) GetGreenPixelComponent(q) <=
+        mean.green) ? 0 : QuantumRange);
+      SetBluePixelComponent(q,((MagickRealType) GetBluePixelComponent(q) <=
+        mean.blue) ? 0 : QuantumRange);
+      SetOpacityPixelComponent(q,((MagickRealType) GetOpacityPixelComponent(q)
+        <= mean.opacity) ? 0 : QuantumRange);
       if (image->colorspace == CMYKColorspace)
-        threshold_indexes[x]=(IndexPacket) (((MagickRealType)
-          threshold_indexes[x] <= mean.index) ? 0 : QuantumRange);
+        SetIndexPixelComponent(threshold_indexes+x,(((MagickRealType)
+          GetIndexPixelComponent(threshold_indexes+x) <= mean.index) ? 0 :
+          QuantumRange));
       p++;
       q++;
     }
@@ -417,7 +419,7 @@ MagickExport MagickBooleanType BilevelImageChannel(Image *image,
       {
         for (x=0; x < (ssize_t) image->columns; x++)
         {
-          q->red=(Quantum) ((MagickRealType) PixelIntensityToQuantum(q) <=
+          SetRedPixelComponent(q,(MagickRealType) PixelIntensityToQuantum(q) <=
             threshold ? 0 : QuantumRange);
           SetGreenPixelComponent(q,GetRedPixelComponent(q));
           SetBluePixelComponent(q,GetRedPixelComponent(q));
@@ -428,27 +430,27 @@ MagickExport MagickBooleanType BilevelImageChannel(Image *image,
       for (x=0; x < (ssize_t) image->columns; x++)
       {
         if ((channel & RedChannel) != 0)
-          q->red=(Quantum) ((MagickRealType) q->red <= threshold ? 0 :
-            QuantumRange);
+          SetRedPixelComponent(q,(MagickRealType) GetRedPixelComponent(q) <=
+            threshold ? 0 : QuantumRange);
         if ((channel & GreenChannel) != 0)
-          q->green=(Quantum) ((MagickRealType) q->green <= threshold ? 0 :
-            QuantumRange);
+          SetGreenPixelComponent(q,(MagickRealType) GetGreenPixelComponent(q) <=
+            threshold ? 0 : QuantumRange);
         if ((channel & BlueChannel) != 0)
-          q->blue=(Quantum) ((MagickRealType) q->blue <= threshold ? 0 :
-            QuantumRange);
+          SetBluePixelComponent(q,(MagickRealType) GetBluePixelComponent(q) <=
+            threshold ? 0 : QuantumRange);
         if ((channel & OpacityChannel) != 0)
           {
             if (image->matte == MagickFalse)
-              q->opacity=(Quantum) ((MagickRealType) q->opacity <= threshold ?
-                0 : QuantumRange);
+              SetOpacityPixelComponent(q,(MagickRealType)
+                GetOpacityPixelComponent(q) <= threshold ? 0 : QuantumRange);
             else
-              q->opacity=(Quantum) ((MagickRealType) q->opacity <= threshold ?
-                OpaqueOpacity : TransparentOpacity);
+              SetRedPixelComponent(q,(MagickRealType) GetOpacityPixelComponent(
+                q) <= threshold ? OpaqueOpacity : TransparentOpacity);
           }
         if (((channel & IndexChannel) != 0) &&
             (image->colorspace == CMYKColorspace))
-          indexes[x]=(IndexPacket) ((MagickRealType) indexes[x] <= threshold ?
-            0 : QuantumRange);
+          SetIndexPixelComponent(indexes+x,(MagickRealType)
+            GetIndexPixelComponent(indexes+x) <= threshold ? 0 : QuantumRange);
         q++;
       }
     if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
@@ -607,31 +609,32 @@ MagickExport MagickBooleanType BlackThresholdImageChannel(Image *image,
         {
           if (PixelIntensity(q) < MagickPixelIntensity(&threshold))
             {
-              q->red=(Quantum) 0;
-              q->green=(Quantum) 0;
-              q->blue=(Quantum) 0;
+              SetRedPixelComponent(q,0);
+              SetGreenPixelComponent(q,0);
+              SetBluePixelComponent(q,0);
               if (image->colorspace == CMYKColorspace)
-                indexes[x]=(Quantum) 0;
+                SetIndexPixelComponent(indexes+x,0);
             }
         }
       else
         {
           if (((channel & RedChannel) != 0) &&
-              ((MagickRealType) q->red < threshold.red))
-            q->red=(Quantum) 0;
+              ((MagickRealType) GetRedPixelComponent(q) < threshold.red))
+            SetRedPixelComponent(q,0);
           if (((channel & GreenChannel) != 0) &&
-              ((MagickRealType) q->green < threshold.green))
-            q->green=(Quantum) 0;
+              ((MagickRealType) GetGreenPixelComponent(q) < threshold.green))
+            SetGreenPixelComponent(q,0);
           if (((channel & BlueChannel) != 0) &&
-              ((MagickRealType) q->blue < threshold.blue))
-            q->blue=(Quantum) 0;
+              ((MagickRealType) GetBluePixelComponent(q) < threshold.blue))
+            SetBluePixelComponent(q,0);
           if (((channel & OpacityChannel) != 0) &&
-              ((MagickRealType) q->opacity < threshold.opacity))
-            q->opacity=(Quantum) 0;
+              ((MagickRealType) GetOpacityPixelComponent(q) < threshold.opacity))
+            SetOpacityPixelComponent(q,0);
           if (((channel & IndexChannel) != 0) &&
               (image->colorspace == CMYKColorspace) &&
-              ((MagickRealType) indexes[x] < threshold.index))
-            indexes[x]=(Quantum) 0;
+              ((MagickRealType) GetIndexPixelComponent(indexes+x) <
+              threshold.index))
+            SetIndexPixelComponent(indexes+x,0);
         }
       q++;
     }
@@ -739,10 +742,14 @@ MagickExport MagickBooleanType ClampImageChannel(Image *image,
       q=image->colormap;
       for (i=0; i < (ssize_t) image->colors; i++)
       {
-        q->red=ClampToUnsignedQuantum(q->red);
-        q->green=ClampToUnsignedQuantum(q->green);
-        q->blue=ClampToUnsignedQuantum(q->blue);
-        q->opacity=ClampToUnsignedQuantum(q->opacity);
+        SetRedPixelComponent(q,ClampToUnsignedQuantum(
+          GetRedPixelComponent(q)));
+        SetGreenPixelComponent(q,ClampToUnsignedQuantum(
+          GetGreenPixelComponent(q)));
+        SetBluePixelComponent(q,ClampToUnsignedQuantum(
+          GetBluePixelComponent(q)));
+        SetOpacityPixelComponent(q,ClampToUnsignedQuantum(
+          GetOpacityPixelComponent(q)));
         q++;
       }
       return(SyncImage(image));
@@ -780,16 +787,21 @@ MagickExport MagickBooleanType ClampImageChannel(Image *image,
     for (x=0; x < (ssize_t) image->columns; x++)
     {
       if ((channel & RedChannel) != 0)
-        q->red=ClampToUnsignedQuantum(q->red);
+        SetRedPixelComponent(q,ClampToUnsignedQuantum(
+          GetRedPixelComponent(q)));
       if ((channel & GreenChannel) != 0)
-        q->green=ClampToUnsignedQuantum(q->green);
+        SetGreenPixelComponent(q,ClampToUnsignedQuantum(
+          GetGreenPixelComponent(q)));
       if ((channel & BlueChannel) != 0)
-        q->blue=ClampToUnsignedQuantum(q->blue);
+        SetBluePixelComponent(q,ClampToUnsignedQuantum(
+          GetBluePixelComponent(q)));
       if ((channel & OpacityChannel) != 0)
-        q->opacity=ClampToUnsignedQuantum(q->opacity);
+        SetOpacityPixelComponent(q,ClampToUnsignedQuantum(
+          GetOpacityPixelComponent(q)));
       if (((channel & IndexChannel) != 0) &&
           (image->colorspace == CMYKColorspace))
-        indexes[x]=(IndexPacket) ClampToUnsignedQuantum(indexes[x]);
+        SetIndexPixelComponent(indexes+x,ClampToUnsignedQuantum(
+          GetIndexPixelComponent(indexes+x)));
       q++;
     }
     if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
@@ -1535,34 +1547,39 @@ printf("DEBUG levels  r=%u g=%u b=%u a=%u i=%u\n",
               Opacity is inverted so 'off' represents transparent.
         */
         if (levels.red) {
-          t = (ssize_t) (QuantumScale*q->red*(levels.red*d+1));
+          t = (ssize_t) (QuantumScale*GetRedPixelComponent(q)*(levels.red*d+1));
           l = t/d;  t = t-l*d;
-          q->red=RoundToQuantum((MagickRealType) ((l+(t >= threshold))*
-            (MagickRealType) QuantumRange/levels.red));
+          SetRedPixelComponent(q,RoundToQuantum((MagickRealType)
+            ((l+(t >= threshold))*(MagickRealType) QuantumRange/levels.red)));
         }
         if (levels.green) {
-          t = (ssize_t) (QuantumScale*q->green*(levels.green*d+1));
+          t = (ssize_t) (QuantumScale*GetGreenPixelComponent(q)*
+            (levels.green*d+1));
           l = t/d;  t = t-l*d;
-          q->green=RoundToQuantum((MagickRealType) ((l+(t >= threshold))*
-            (MagickRealType) QuantumRange/levels.green));
+          SetGreenPixelComponent(q,RoundToQuantum((MagickRealType)
+            ((l+(t >= threshold))*(MagickRealType) QuantumRange/levels.green)));
         }
         if (levels.blue) {
-          t = (ssize_t) (QuantumScale*q->blue*(levels.blue*d+1));
+          t = (ssize_t) (QuantumScale*GetBluePixelComponent(q)*
+            (levels.blue*d+1));
           l = t/d;  t = t-l*d;
-          q->blue=RoundToQuantum((MagickRealType) ((l+(t >= threshold))*
-            (MagickRealType) QuantumRange/levels.blue));
+          SetBluePixelComponent(q,RoundToQuantum((MagickRealType)
+            ((l+(t >= threshold))*(MagickRealType) QuantumRange/levels.blue)));
         }
         if (levels.opacity) {
-          t = (ssize_t) ((1.0-QuantumScale*q->opacity)*(levels.opacity*d+1));
+          t = (ssize_t) ((1.0-QuantumScale*GetOpacityPixelComponent(q))*
+            (levels.opacity*d+1));
           l = t/d;  t = t-l*d;
-          q->opacity=RoundToQuantum((MagickRealType) ((1.0-l-(t >= threshold))*
-            (MagickRealType) QuantumRange/levels.opacity));
+          SetOpacityPixelComponent(q,RoundToQuantum((MagickRealType)
+            ((1.0-l-(t >= threshold))*(MagickRealType) QuantumRange/
+            levels.opacity)));
         }
         if (levels.index) {
-          t = (ssize_t) (QuantumScale*indexes[x]*(levels.index*d+1));
+          t = (ssize_t) (QuantumScale*GetIndexPixelComponent(indexes+x)*
+            (levels.index*d+1));
           l = t/d;  t = t-l*d;
-          indexes[x]=(IndexPacket) RoundToQuantum((MagickRealType) ((l+
-            (t>=threshold))*(MagickRealType) QuantumRange/levels.index));
+          SetIndexPixelComponent(indexes+x,RoundToQuantum((MagickRealType) ((l+
+            (t>=threshold))*(MagickRealType) QuantumRange/levels.index)));
         }
         q++;
       }
@@ -1758,8 +1775,11 @@ MagickExport MagickBooleanType RandomThresholdImageChannel(Image *image,
             threshold.index=(MagickRealType)(QuantumRange*
               GetPseudoRandomValue(random_info[id]));
           index=(IndexPacket) (intensity <= threshold.index ? 0 : 1);
-          indexes[x]=index;
-          *q++=image->colormap[(ssize_t) index];
+          SetIndexPixelComponent(indexes+x,index);
+          SetRedPixelComponent(q,image->colormap[(ssize_t) index].red);
+          SetGreenPixelComponent(q,image->colormap[(ssize_t) index].green);
+          SetBluePixelComponent(q,image->colormap[(ssize_t) index].blue);
+          q++;
         }
         sync=SyncCacheViewAuthenticPixels(image_view,exception);
         if (sync == MagickFalse)
@@ -1819,10 +1839,10 @@ MagickExport MagickBooleanType RandomThresholdImageChannel(Image *image,
     {
       if ((channel & RedChannel) != 0)
         {
-          if ((MagickRealType) q->red < min_threshold)
+          if ((MagickRealType) GetRedPixelComponent(q) < min_threshold)
             threshold.red=min_threshold;
           else
-            if ((MagickRealType) q->red > max_threshold)
+            if ((MagickRealType) GetRedPixelComponent(q) > max_threshold)
               threshold.red=max_threshold;
             else
               threshold.red=(MagickRealType) (QuantumRange*
@@ -1830,10 +1850,10 @@ MagickExport MagickBooleanType RandomThresholdImageChannel(Image *image,
         }
       if ((channel & GreenChannel) != 0)
         {
-          if ((MagickRealType) q->green < min_threshold)
+          if ((MagickRealType) GetGreenPixelComponent(q) < min_threshold)
             threshold.green=min_threshold;
           else
-            if ((MagickRealType) q->green > max_threshold)
+            if ((MagickRealType) GetGreenPixelComponent(q) > max_threshold)
               threshold.green=max_threshold;
             else
               threshold.green=(MagickRealType) (QuantumRange*
@@ -1841,10 +1861,10 @@ MagickExport MagickBooleanType RandomThresholdImageChannel(Image *image,
         }
       if ((channel & BlueChannel) != 0)
         {
-          if ((MagickRealType) q->blue < min_threshold)
+          if ((MagickRealType) GetBluePixelComponent(q) < min_threshold)
             threshold.blue=min_threshold;
           else
-            if ((MagickRealType) q->blue > max_threshold)
+            if ((MagickRealType) GetBluePixelComponent(q) > max_threshold)
               threshold.blue=max_threshold;
             else
               threshold.blue=(MagickRealType) (QuantumRange*
@@ -1852,10 +1872,10 @@ MagickExport MagickBooleanType RandomThresholdImageChannel(Image *image,
         }
       if ((channel & OpacityChannel) != 0)
         {
-          if ((MagickRealType) q->opacity < min_threshold)
+          if ((MagickRealType) GetOpacityPixelComponent(q) < min_threshold)
             threshold.opacity=min_threshold;
           else
-            if ((MagickRealType) q->opacity > max_threshold)
+            if ((MagickRealType) GetOpacityPixelComponent(q) > max_threshold)
               threshold.opacity=max_threshold;
             else
               threshold.opacity=(MagickRealType) (QuantumRange*
@@ -1864,31 +1884,32 @@ MagickExport MagickBooleanType RandomThresholdImageChannel(Image *image,
       if (((channel & IndexChannel) != 0) &&
           (image->colorspace == CMYKColorspace))
         {
-          if ((MagickRealType) indexes[x] < min_threshold)
+          if ((MagickRealType) GetIndexPixelComponent(indexes+x) < min_threshold)
             threshold.index=min_threshold;
           else
-            if ((MagickRealType) indexes[x] > max_threshold)
+            if ((MagickRealType) GetIndexPixelComponent(indexes+x) > max_threshold)
               threshold.index=max_threshold;
             else
               threshold.index=(MagickRealType) (QuantumRange*
                 GetPseudoRandomValue(random_info[id]));
         }
       if ((channel & RedChannel) != 0)
-        q->red=(Quantum) ((MagickRealType) q->red <= threshold.red ? 0 :
-          QuantumRange);
+        SetRedPixelComponent(q,(MagickRealType) GetRedPixelComponent(q) <=
+          threshold.red ? 0 : QuantumRange);
       if ((channel & GreenChannel) != 0)
-        q->green=(Quantum) ((MagickRealType) q->green <= threshold.green ? 0 :
-          QuantumRange);
+        SetGreenPixelComponent(q,(MagickRealType) GetGreenPixelComponent(q) <=
+          threshold.green ? 0 : QuantumRange);
       if ((channel & BlueChannel) != 0)
-        q->blue=(Quantum) ((MagickRealType) q->blue <= threshold.blue ? 0 :
-          QuantumRange);
+        SetBluePixelComponent(q,(MagickRealType) GetBluePixelComponent(q) <=
+          threshold.blue ? 0 : QuantumRange);
       if ((channel & OpacityChannel) != 0)
-        q->opacity=(Quantum) ((MagickRealType) q->opacity <= threshold.opacity ?
-          0 : QuantumRange);
+        SetOpacityPixelComponent(q,(MagickRealType) GetOpacityPixelComponent(q)
+          <= threshold.opacity ? 0 : QuantumRange);
       if (((channel & IndexChannel) != 0) &&
           (image->colorspace == CMYKColorspace))
-        indexes[x]=(IndexPacket) ((MagickRealType) indexes[x] <=
-          threshold.index ? 0 : QuantumRange);
+        SetIndexPixelComponent(indexes+x,(MagickRealType)
+          GetIndexPixelComponent(indexes+x) <= threshold.index ? 0 :
+          QuantumRange);
       q++;
     }
     if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
@@ -2048,31 +2069,32 @@ MagickExport MagickBooleanType WhiteThresholdImageChannel(Image *image,
         {
           if (PixelIntensity(q) > MagickPixelIntensity(&threshold))
             {
-              q->red=(Quantum) QuantumRange;
-              q->green=(Quantum) QuantumRange;
-              q->blue=(Quantum) QuantumRange;
+              SetRedPixelComponent(q,QuantumRange);
+              SetGreenPixelComponent(q,QuantumRange);
+              SetBluePixelComponent(q,QuantumRange);
               if (image->colorspace == CMYKColorspace)
-                indexes[x]=(Quantum) QuantumRange;
+                SetIndexPixelComponent(indexes+x,QuantumRange);
             }
         }
       else
         {
           if (((channel & RedChannel) != 0) &&
-              ((MagickRealType) q->red > threshold.red))
-            q->red=(Quantum) QuantumRange;
+              ((MagickRealType) GetRedPixelComponent(q) > threshold.red))
+            SetRedPixelComponent(q,QuantumRange);
           if (((channel & GreenChannel) != 0) &&
-              ((MagickRealType) q->green > threshold.green))
-            q->green=(Quantum) QuantumRange;
+              ((MagickRealType) GetGreenPixelComponent(q) > threshold.green))
+            SetGreenPixelComponent(q,QuantumRange);
           if (((channel & BlueChannel) != 0) &&
-              ((MagickRealType) q->blue > threshold.blue))
-            q->blue=(Quantum) QuantumRange;
+              ((MagickRealType) GetBluePixelComponent(q) > threshold.blue))
+            SetBluePixelComponent(q,QuantumRange);
           if (((channel & OpacityChannel) != 0) &&
-              ((MagickRealType) q->opacity > threshold.opacity))
-            q->opacity=(Quantum) QuantumRange;
+              ((MagickRealType) GetOpacityPixelComponent(q) > threshold.opacity))
+            SetOpacityPixelComponent(q,QuantumRange);
           if (((channel & IndexChannel) != 0) &&
               (image->colorspace == CMYKColorspace) &&
-              ((MagickRealType) indexes[x] > threshold.index))
-            indexes[x]=(Quantum) QuantumRange;
+              ((MagickRealType) GetIndexPixelComponent(indexes+x)) >
+              threshold.index)
+            SetIndexPixelComponent(indexes+x,QuantumRange);
         }
       q++;
     }
index 1fd838b2b3f0723b4cdacf9805520b539df82a6c..2820602abee9a106e074248a57f41027c02d44b8 100644 (file)
@@ -197,7 +197,7 @@ MagickExport Image *ChopImage(const Image *image,const RectangleInfo *chop_info,
           if (indexes != (IndexPacket *) NULL)
             {
               if (chop_indexes != (IndexPacket *) NULL)
-                *chop_indexes++=indexes[x];
+                *chop_indexes++=GetIndexPixelComponent(indexes+x);
             }
           q++;
         }
@@ -260,7 +260,7 @@ MagickExport Image *ChopImage(const Image *image,const RectangleInfo *chop_info,
           if (indexes != (IndexPacket *) NULL)
             {
               if (chop_indexes != (IndexPacket *) NULL)
-                *chop_indexes++=indexes[x];
+                *chop_indexes++=GetIndexPixelComponent(indexes+x);
             }
           q++;
         }
@@ -368,7 +368,7 @@ MagickExport Image *ConsolidateCMYKImages(const Image *images,
         break;
       for (x=0; x < (ssize_t) images->columns; x++)
       {
-        q->red=(Quantum) (QuantumRange-PixelIntensityToQuantum(p));
+        SetRedPixelComponent(q,QuantumRange-PixelIntensityToQuantum(p));
         p++;
         q++;
       }
@@ -468,7 +468,8 @@ MagickExport Image *ConsolidateCMYKImages(const Image *images,
       indexes=GetCacheViewAuthenticIndexQueue(cmyk_view);
       for (x=0; x < (ssize_t) images->columns; x++)
       {
-        indexes[x]=(IndexPacket) (QuantumRange-PixelIntensityToQuantum(p));
+        SetIndexPixelComponent(indexes+x,QuantumRange-
+          PixelIntensityToQuantum(p));
         p++;
       }
       if (SyncCacheViewAuthenticPixels(cmyk_view,exception) == MagickFalse)
@@ -1401,7 +1402,8 @@ MagickExport Image *FlopImage(const Image *image,ExceptionInfo *exception)
       (*--q)=(*p++);
       if ((indexes != (const IndexPacket *) NULL) &&
           (flop_indexes != (IndexPacket *) NULL))
-        flop_indexes[flop_image->columns-x-1]=indexes[x];
+        SetIndexPixelComponent(flop_indexes+flop_image->columns-x-1,
+         GetIndexPixelComponent( indexes+x));
     }
     if (SyncCacheViewAuthenticPixels(flop_view,exception) == MagickFalse)
       status=MagickFalse;
@@ -1827,7 +1829,9 @@ MagickExport Image *SpliceImage(const Image *image,
       if (image->matte != MagickFalse)
         SetOpacityPixelComponent(q,GetOpacityPixelComponent(p));
       if (image->colorspace == CMYKColorspace)
-        splice_indexes[x]=(*indexes++);
+        SetIndexPixelComponent(splice_indexes+x,
+          GetIndexPixelComponent(indexes));
+      indexes++;
       p++;
       q++;
     }
@@ -1842,7 +1846,9 @@ MagickExport Image *SpliceImage(const Image *image,
       if (image->matte != MagickFalse)
         SetOpacityPixelComponent(q,GetOpacityPixelComponent(p));
       if (image->colorspace == CMYKColorspace)
-        splice_indexes[x]=(*indexes++);
+        SetIndexPixelComponent(splice_indexes+x,
+          GetIndexPixelComponent(indexes));
+      indexes++;
       p++;
       q++;
     }
@@ -1905,7 +1911,9 @@ MagickExport Image *SpliceImage(const Image *image,
       if (image->matte != MagickFalse)
         SetOpacityPixelComponent(q,GetOpacityPixelComponent(p));
       if (image->colorspace == CMYKColorspace)
-        splice_indexes[x]=(*indexes++);
+        SetIndexPixelComponent(splice_indexes+x,
+           GetIndexPixelComponent(indexes));
+      indexes++;
       p++;
       q++;
     }
@@ -1920,7 +1928,9 @@ MagickExport Image *SpliceImage(const Image *image,
       if (image->matte != MagickFalse)
         SetOpacityPixelComponent(q,GetOpacityPixelComponent(p));
       if (image->colorspace == CMYKColorspace)
-        splice_indexes[x]=(*indexes++);
+        SetIndexPixelComponent(splice_indexes+x,
+          GetIndexPixelComponent(indexes));
+      indexes++;
       p++;
       q++;
     }
@@ -2349,7 +2359,8 @@ MagickExport Image *TransverseImage(const Image *image,ExceptionInfo *exception)
         transverse_indexes=GetCacheViewAuthenticIndexQueue(transverse_view);
         if (transverse_indexes != (IndexPacket *) NULL)
           for (x=0; x < (ssize_t) image->columns; x++)
-            transverse_indexes[image->columns-x-1]=indexes[x];
+            SetIndexPixelComponent(transverse_indexes+image->columns-x-1,
+              GetIndexPixelComponent(indexes+x));
       }
     sync=SyncCacheViewAuthenticPixels(transverse_view,exception);
     if (sync == MagickFalse)
index 3f22290eebc73fe42732dd05fa2f670ad1d4ba81..c1e60818fb308d32ab339e5b44a773a0ff8fd08b 100644 (file)
@@ -567,23 +567,23 @@ MagickExport MagickBooleanType XAnnotateImage(Display *display,
           /*
             Set this pixel to the background color.
           */
-          q->red=ScaleShortToQuantum(pixel->box_color.red);
-          q->green=ScaleShortToQuantum(pixel->box_color.green);
-          q->blue=ScaleShortToQuantum(pixel->box_color.blue);
+          SetRedPixelComponent(q,ScaleShortToQuantum(pixel->box_color.red));
+          SetGreenPixelComponent(q,ScaleShortToQuantum(pixel->box_color.green));
+          SetBluePixelComponent(q,ScaleShortToQuantum(pixel->box_color.blue));
           if ((annotate_info->stencil == ForegroundStencil) ||
               (annotate_info->stencil == OpaqueStencil))
-            q->opacity=(Quantum) TransparentOpacity;
+            SetOpacityPixelComponent(q,TransparentOpacity);
         }
       else
         {
           /*
             Set this pixel to the pen color.
           */
-          q->red=ScaleShortToQuantum(pixel->pen_color.red);
-          q->green=ScaleShortToQuantum(pixel->pen_color.green);
-          q->blue=ScaleShortToQuantum(pixel->pen_color.blue);
+          SetRedPixelComponent(q,ScaleShortToQuantum(pixel->pen_color.red));
+          SetGreenPixelComponent(q,ScaleShortToQuantum(pixel->pen_color.green));
+          SetBluePixelComponent(q,ScaleShortToQuantum(pixel->pen_color.blue));
           if (annotate_info->stencil == BackgroundStencil)
-            q->opacity=(Quantum) TransparentOpacity;
+            SetOpacityPixelComponent(q,TransparentOpacity);
         }
       q++;
     }
@@ -2481,11 +2481,11 @@ MagickExport MagickBooleanType XDrawImage(Display *display,
           /*
             Set this pixel to the pen color.
           */
-          q->red=ScaleShortToQuantum(pixel->pen_color.red);
-          q->green=ScaleShortToQuantum(pixel->pen_color.green);
-          q->blue=ScaleShortToQuantum(pixel->pen_color.blue);
-          q->opacity=(Quantum) (draw_info->stencil == OpaqueStencil ?
-            OpaqueOpacity : TransparentOpacity);
+          SetRedPixelComponent(q,ScaleShortToQuantum(pixel->pen_color.red));
+          SetGreenPixelComponent(q,ScaleShortToQuantum(pixel->pen_color.green));
+          SetBluePixelComponent(q,ScaleShortToQuantum(pixel->pen_color.blue));
+          SetOpacityPixelComponent(q,(Quantum) (draw_info->stencil ==
+            OpaqueStencil ? OpaqueOpacity : TransparentOpacity));
         }
       q++;
     }
@@ -4380,11 +4380,14 @@ static Image *XGetWindowImage(Display *display,const Window window,
                 {
                   pixel=XGetPixel(ximage,x,y);
                   index=(pixel >> red_shift) & red_mask;
-                  q->red=ScaleShortToQuantum(colors[index].red);
+                  SetRedPixelComponent(q,ScaleShortToQuantum(
+                    colors[index].red));
                   index=(pixel >> green_shift) & green_mask;
-                  q->green=ScaleShortToQuantum(colors[index].green);
+                  SetGreenPixelComponent(q,ScaleShortToQuantum(
+                    colors[index].green));
                   index=(pixel >> blue_shift) & blue_mask;
-                  q->blue=ScaleShortToQuantum(colors[index].blue);
+                  SetBluePixelComponent(q,ScaleShortToQuantum(
+                    colors[index].blue));
                   q++;
                 }
                 if (SyncCacheViewAuthenticPixels(composite_view,exception) == MagickFalse)
@@ -4402,13 +4405,16 @@ static Image *XGetWindowImage(Display *display,const Window window,
                   pixel=XGetPixel(ximage,x,y);
                   color=(pixel >> red_shift) & red_mask;
                   color=(65535UL*color)/red_mask;
-                  q->red=ScaleShortToQuantum((unsigned short) color);
+                  SetRedPixelComponent(q,ScaleShortToQuantum((unsigned short)
+                    color));
                   color=(pixel >> green_shift) & green_mask;
                   color=(65535UL*color)/green_mask;
-                  q->green=ScaleShortToQuantum((unsigned short) color);
+                  SetGreenPixelComponent(q,ScaleShortToQuantum((unsigned short)
+                    color));
                   color=(pixel >> blue_shift) & blue_mask;
                   color=(65535UL*color)/blue_mask;
-                  q->blue=ScaleShortToQuantum((unsigned short) color);
+                  SetBluePixelComponent(q,ScaleShortToQuantum((unsigned short)
+                    color));
                   q++;
                 }
                 if (SyncCacheViewAuthenticPixels(composite_view,exception) == MagickFalse)
@@ -4449,7 +4455,7 @@ static Image *XGetWindowImage(Display *display,const Window window,
               for (x=0; x < (int) composite_image->columns; x++)
               {
                 index=(IndexPacket) XGetPixel(ximage,x,y);
-                indexes[x]=index;
+                SetIndexPixelComponent(indexes+x,index);
                 *q++=composite_image->colormap[(ssize_t) index];
               }
               if (SyncCacheViewAuthenticPixels(composite_view,exception) == MagickFalse)
@@ -5930,7 +5936,7 @@ static void XMakeImageLSBFirst(const XResourceInfo *resource_info,
         for (x=0; x < (int) canvas->columns; x++)
         {
           byte>>=1;
-          if (indexes[x] == (IndexPacket) polarity)
+          if (GetIndexPixelComponent(indexes+x) == (IndexPacket) polarity)
             byte|=foreground;
           else
             byte|=background;
@@ -5969,7 +5975,7 @@ static void XMakeImageLSBFirst(const XResourceInfo *resource_info,
             nibble=0;
             for (x=0; x < (int) canvas->columns; x++)
             {
-              pixel=pixels[(ssize_t) indexes[x]] & 0x0f;
+              pixel=pixels[(ssize_t) GetIndexPixelComponent(indexes+x)] & 0x0f;
               switch (nibble)
               {
                 case 0:
@@ -6021,7 +6027,7 @@ static void XMakeImageLSBFirst(const XResourceInfo *resource_info,
             nibble=0;
             for (x=0; x < (int) canvas->columns; x++)
             {
-              pixel=pixels[(ssize_t) indexes[x]] & 0xf;
+              pixel=pixels[(ssize_t) GetIndexPixelComponent(indexes+x)] & 0xf;
               switch (nibble)
               {
                 case 0:
@@ -6064,7 +6070,7 @@ static void XMakeImageLSBFirst(const XResourceInfo *resource_info,
             indexes=GetCacheViewVirtualIndexQueue(canvas_view);
             for (x=0; x < (int) canvas->columns; x++)
             {
-              pixel=pixels[(ssize_t) indexes[x]];
+              pixel=pixels[(ssize_t) GetIndexPixelComponent(indexes+x)];
               *q++=(unsigned char) pixel;
             }
             q+=scanline_pad;
@@ -6095,7 +6101,7 @@ static void XMakeImageLSBFirst(const XResourceInfo *resource_info,
             indexes=GetCacheViewVirtualIndexQueue(canvas_view);
             for (x=0; x < (int) canvas->columns; x++)
             {
-              pixel=pixels[(ssize_t) indexes[x]];
+              pixel=pixels[(ssize_t) GetIndexPixelComponent(indexes+x)];
               for (k=0; k < (int) bytes_per_pixel; k++)
               {
                 channel[k]=(unsigned char) pixel;
@@ -6557,7 +6563,7 @@ static void XMakeImageMSBFirst(const XResourceInfo *resource_info,
         for (x=(int) canvas->columns-1; x >= 0; x--)
         {
           byte<<=1;
-          if (indexes[x] == (IndexPacket) polarity)
+          if (GetIndexPixelComponent(indexes+x) == (IndexPacket) polarity)
             byte|=foreground;
           else
             byte|=background;
@@ -6596,7 +6602,7 @@ static void XMakeImageMSBFirst(const XResourceInfo *resource_info,
             nibble=0;
             for (x=0; x < (int) canvas->columns; x++)
             {
-              pixel=pixels[(ssize_t) indexes[x]] & 0xf;
+              pixel=pixels[(ssize_t) GetIndexPixelComponent(indexes+x)] & 0xf;
               switch (nibble)
               {
                 case 0:
@@ -6648,7 +6654,7 @@ static void XMakeImageMSBFirst(const XResourceInfo *resource_info,
             nibble=0;
             for (x=0; x < (int) canvas->columns; x++)
             {
-              pixel=pixels[(ssize_t) indexes[x]] & 0xf;
+              pixel=pixels[(ssize_t) GetIndexPixelComponent(indexes+x)] & 0xf;
               switch (nibble)
               {
                 case 0:
@@ -6691,7 +6697,7 @@ static void XMakeImageMSBFirst(const XResourceInfo *resource_info,
             indexes=GetCacheViewVirtualIndexQueue(canvas_view);
             for (x=0; x < (int) canvas->columns; x++)
             {
-              pixel=pixels[(ssize_t) indexes[x]];
+              pixel=pixels[(ssize_t) GetIndexPixelComponent(indexes+x)];
               *q++=(unsigned char) pixel;
             }
             q+=scanline_pad;
@@ -6722,7 +6728,7 @@ static void XMakeImageMSBFirst(const XResourceInfo *resource_info,
             indexes=GetCacheViewVirtualIndexQueue(canvas_view);
             for (x=0; x < (int) canvas->columns; x++)
             {
-              pixel=pixels[(ssize_t) indexes[x]];
+              pixel=pixels[(ssize_t) GetIndexPixelComponent(indexes+x)];
               for (k=(int) bytes_per_pixel-1; k >= 0; k--)
               {
                 channel[k]=(unsigned char) pixel;
@@ -7754,20 +7760,20 @@ MagickExport void XMakeStandardColormap(Display *display,
               {
                 for (i=0; i < (ssize_t) number_colors; i++)
                 {
-                  q->red=(Quantum) 0;
+                  SetRedPixelComponent(q,0);
                   if (map_info->red_max != 0)
-                    q->red=ScaleXToQuantum((size_t) (i/
-                      map_info->red_mult),map_info->red_max);
-                  q->green=(Quantum) 0;
+                    SetRedPixelComponent(q,ScaleXToQuantum((size_t) (i/
+                      map_info->red_mult),map_info->red_max));
+                  SetGreenPixelComponent(q,0);
                   if (map_info->green_max != 0)
-                    q->green=ScaleXToQuantum((size_t) ((i/
+                    SetGreenPixelComponent(q,ScaleXToQuantum((size_t) ((i/
                       map_info->green_mult) % (map_info->green_max+1)),
-                      map_info->green_max);
-                  q->blue=(Quantum) 0;
+                      map_info->green_max));
+                  SetBluePixelComponent(q,0);
                   if (map_info->blue_max != 0)
-                    q->blue=ScaleXToQuantum((size_t) (i %
-                      map_info->green_mult),map_info->blue_max);
-                  q->opacity=(Quantum) TransparentOpacity;
+                    SetBluePixelComponent(q,ScaleXToQuantum((size_t) (i %
+                      map_info->green_mult),map_info->blue_max));
+                  SetOpacityPixelComponent(q,TransparentOpacity);
                   q++;
                 }
                 (void) SyncAuthenticPixels(affinity_image,exception);
@@ -7955,7 +7961,7 @@ MagickExport void XMakeStandardColormap(Display *display,
               break;
             indexes=GetCacheViewAuthenticIndexQueue(image_view);
             for (x=(int) image->columns-1; x >= 0; x--)
-              diversity[(ssize_t) indexes[x]].count++;
+              diversity[(ssize_t) GetIndexPixelComponent(indexes+x)].count++;
           }
           image_view=DestroyCacheView(image_view);
           /*