]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Mon, 30 May 2011 00:41:18 +0000 (00:41 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Mon, 30 May 2011 00:41:18 +0000 (00:41 +0000)
coders/dds.c
coders/fpx.c
coders/png.c
coders/xcf.c

index fa1e0c719c5e82ca51f577a1f05391378ebe0ac7..6e2115d688efa76b796f8da4747b2056b7467a28 100644 (file)
@@ -641,8 +641,8 @@ static MagickBooleanType ReadDXT3(Image *image, DDSInfo *dds_info)
                 alpha = 17U * (unsigned char) ((a0 >> (4*(4*j+i))) & 0xf);
               else
                 alpha = 17U * (unsigned char) ((a1 >> (4*(4*(j-2)+i))) & 0xf);
-              SetOpacityPixelComponent(q,ScaleCharToQuantum((unsigned char)
-                (255-alpha)));
+              SetAlphaPixelComponent(q,ScaleCharToQuantum((unsigned char)
+                alpha));
               q++;
             }
         }
@@ -745,8 +745,8 @@ static MagickBooleanType ReadDXT5(Image *image, DDSInfo *dds_info)
                 alpha = 255;
               else
                 alpha = (((6-alpha_code) * a0 + (alpha_code-1) * a1) / 5);
-              SetOpacityPixelComponent(q,ScaleCharToQuantum((unsigned char)
-                (255-alpha)));
+              SetAlphaPixelComponent(q,ScaleCharToQuantum((unsigned char)
+                alpha));
               q++;
             }
         }
@@ -830,8 +830,8 @@ static MagickBooleanType ReadUncompressedRGBA(Image *image, DDSInfo *dds_info)
         ReadBlobByte(image)));
       SetRedPixelComponent(q,ScaleCharToQuantum((unsigned char)
         ReadBlobByte(image)));
-      SetOpacityPixelComponent(q,ScaleCharToQuantum((unsigned char)
-        (255-ReadBlobByte(image))));
+      SetAlphaPixelComponent(q,ScaleCharToQuantum((unsigned char)
+        ReadBlobByte(image)));
       q++;
     }
     
index 6d921990b8b9b59cd53e4805a2a3c828b78fc056..7d7c14a63d8793732531d4f5a327fa428cdd7939 100644 (file)
@@ -473,7 +473,7 @@ static Image *ReadFPXImage(const ImageInfo *image_info,ExceptionInfo *exception)
         }
       SetOpacityPixelComponent(q,OpaqueOpacity);
       if (image->matte != MagickFalse)
-        SetOpacityPixelComponent(q,ScaleCharToQuantum(255-*a));
+        SetAlphaPixelComponent(q,ScaleCharToQuantum(*a));
       q++;
       r+=red_component->columnStride;
       g+=green_component->columnStride;
index 93a28d484ad79c3cc7c2a2ce459b13043001e142..3f12048c4e38a243c764bc87e733beda327b402e 100644 (file)
@@ -3070,8 +3070,8 @@ static Image *ReadOnePNGImage(MngInfo *mng_info,
                  * In a PNG datastream, Opaque is QuantumRange
                  * and Transparent is 0.
                  */
-                SetOpacityPixelComponent(q,
-                    ScaleCharToQuantum((unsigned char) (255-(*p++))));
+                SetAlphaPixelComponent(q,ScaleCharToQuantum((unsigned char)
+                  *p++));
                 if (GetOpacityPixelComponent(q) != OpaqueOpacity)
                   found_transparent_pixel = MagickTrue;
                 q++;
index b0cea287784ab711e0e5725bc5d88690646805ba..f344832452a2cd6a42bd60eeac27bca054d21f0a 100644 (file)
@@ -377,8 +377,8 @@ static MagickBooleanType load_tile(Image *image,Image *tile_image,
           SetRedPixelComponent(q,ScaleCharToQuantum(*graydata));
           SetGreenPixelComponent(q,GetRedPixelComponent(q));
           SetBluePixelComponent(q,GetRedPixelComponent(q));
-          SetOpacityPixelComponent(q,ScaleCharToQuantum(
-            (unsigned char) (255-inLayerInfo->opacity)));
+          SetAlphaPixelComponent(q,ScaleCharToQuantum((unsigned char)
+            inLayerInfo->opacity));
           graydata++;
           q++;
         }
@@ -391,9 +391,8 @@ static MagickBooleanType load_tile(Image *image,Image *tile_image,
             SetRedPixelComponent(q,ScaleCharToQuantum(xcfdata->red));
             SetGreenPixelComponent(q,ScaleCharToQuantum(xcfdata->green));
             SetBluePixelComponent(q,ScaleCharToQuantum(xcfdata->blue));
-            SetOpacityPixelComponent(q,xcfdata->opacity == 0U ?
-              TransparentOpacity : ScaleCharToQuantum((unsigned char) (255-
-              inLayerInfo->opacity)));
+            SetAlphaPixelComponent(q,xcfdata->opacity == 0U ?  OpaqueOpacity :
+              ScaleCharToQuantum((unsigned char) inLayerInfo->opacity));
             xcfdata++;
             q++;
           }
@@ -480,15 +479,15 @@ static MagickBooleanType load_tile_rle(Image *image,Image *tile_image,
                     {
                       SetGreenPixelComponent(q,ScaleCharToQuantum(data));
                       SetBluePixelComponent(q,ScaleCharToQuantum(data));
-                      SetOpacityPixelComponent(q,ScaleCharToQuantum(
-                        (unsigned char) (255-inLayerInfo->opacity)));
+                      SetAlphaPixelComponent(q,ScaleCharToQuantum(
+                        (unsigned char) inLayerInfo->opacity));
                     }
                   else
                     {
                       SetGreenPixelComponent(q,GetRedPixelComponent(q));
                       SetBluePixelComponent(q,GetRedPixelComponent(q));
-                      SetOpacityPixelComponent(q,ScaleCharToQuantum(
-                        (unsigned char) (255-inLayerInfo->opacity)));
+                      SetAlphaPixelComponent(q,ScaleCharToQuantum(
+                        (unsigned char) inLayerInfo->opacity));
                     }
                   break;
                 }
@@ -504,9 +503,8 @@ static MagickBooleanType load_tile_rle(Image *image,Image *tile_image,
                 }
                 case 3:
                 {
-                  SetOpacityPixelComponent(q,data == 0 ? TransparentOpacity :
-                    ScaleCharToQuantum((unsigned char) (255-
-                    inLayerInfo->opacity)));
+                  SetAlphaPixelComponent(q,data == 0 ? OpaqueOpacity :
+                    ScaleCharToQuantum((unsigned char) inLayerInfo->opacity));
                   break;
                 }
               }
@@ -541,15 +539,15 @@ static MagickBooleanType load_tile_rle(Image *image,Image *tile_image,
                     {
                       SetGreenPixelComponent(q,ScaleCharToQuantum(data));
                       SetBluePixelComponent(q,ScaleCharToQuantum(data));
-                      SetOpacityPixelComponent(q,ScaleCharToQuantum(
-                        (unsigned char) (255-inLayerInfo->opacity)));
+                      SetAlphaPixelComponent(q,ScaleCharToQuantum(
+                        (unsigned char) inLayerInfo->opacity));
                     }
                   else
                     {
                       SetGreenPixelComponent(q,GetRedPixelComponent(q));
                       SetBluePixelComponent(q,GetRedPixelComponent(q));
-                      SetOpacityPixelComponent(q,ScaleCharToQuantum(
-                        (unsigned char) (255-inLayerInfo->opacity)));
+                      SetAlphaPixelComponent(q,ScaleCharToQuantum(
+                        (unsigned char) inLayerInfo->opacity));
                     }
                   break;
                 }
@@ -565,9 +563,8 @@ static MagickBooleanType load_tile_rle(Image *image,Image *tile_image,
                 }
                 case 3:
                 {
-                  SetOpacityPixelComponent(q,data == 0 ? TransparentOpacity :
-                    ScaleCharToQuantum((unsigned char) (255-
-                    inLayerInfo->opacity)));
+                  SetAlphaPixelComponent(q,data == 0 ? OpaqueOpacity :
+                    ScaleCharToQuantum((unsigned char) inLayerInfo->opacity));
                   break;
                 }
               }