diff --git a/coders/dds.c b/coders/dds.c
index fa1e0c7..6e2115d 100644
--- a/coders/dds.c
+++ b/coders/dds.c
@@ -641,8 +641,8 @@
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 @@
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 @@
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++;
}
diff --git a/coders/fpx.c b/coders/fpx.c
index 6d92199..7d7c14a 100644
--- a/coders/fpx.c
+++ b/coders/fpx.c
@@ -473,7 +473,7 @@
}
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;
diff --git a/coders/png.c b/coders/png.c
index 93a28d4..3f12048 100644
--- a/coders/png.c
+++ b/coders/png.c
@@ -3070,8 +3070,8 @@
* 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++;
diff --git a/coders/xcf.c b/coders/xcf.c
index b0cea28..f344832 100644
--- a/coders/xcf.c
+++ b/coders/xcf.c
@@ -377,8 +377,8 @@
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 @@
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 @@
{
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 @@
}
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 @@
{
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 @@
}
case 3:
{
- SetOpacityPixelComponent(q,data == 0 ? TransparentOpacity :
- ScaleCharToQuantum((unsigned char) (255-
- inLayerInfo->opacity)));
+ SetAlphaPixelComponent(q,data == 0 ? OpaqueOpacity :
+ ScaleCharToQuantum((unsigned char) inLayerInfo->opacity));
break;
}
}