Commit a2abbe0d authored by Nick Lamb /GIMP's avatar Nick Lamb /GIMP
Browse files

Overbright alpha bug #77283 fixed

parent 3258c5f1
2002-05-03 Nick Lamb <njl195@zepler.org.uk>
* plug-ins/common/tiff.c: Overbright alpha bug #77283 fixed
2002-05-03 Sven Neumann <sven@gimp.org>
 
* plug-ins/common/borderaverage.c
......
......@@ -864,6 +864,7 @@ read_16bit (guchar *source,
if (alpha) {
gray_val= *source; source+= 2;
alpha_val= *source; source+= 2;
gray_val= MIN(gray_val, alpha_val);
if (alpha_val)
*dest++ = gray_val * 255 / alpha_val;
else
......@@ -878,8 +879,9 @@ read_16bit (guchar *source,
if (alpha) {
gray_val= *source; source+= 2;
alpha_val= *source; source+= 2;
gray_val= MIN(gray_val, alpha_val);
if (alpha_val)
*dest++ = ((255 - gray_val) * 255) / alpha_val;
*dest++ = ((alpha_val - gray_val) * 255) / alpha_val;
else
*dest++ = 0;
*dest++ = alpha_val;
......@@ -899,6 +901,9 @@ read_16bit (guchar *source,
green_val= *source; source+= 2;
blue_val= *source; source+= 2;
alpha_val= *source; source+= 2;
red_val= MIN(red_val, alpha_val);
green_val= MIN(green_val, alpha_val);
blue_val= MIN(blue_val, alpha_val);
if (alpha_val) {
*dest++ = (red_val * 255) / alpha_val;
*dest++ = (green_val * 255) / alpha_val;
......@@ -977,6 +982,7 @@ read_8bit (guchar *source,
if (alpha) {
gray_val= *source++;
alpha_val= *source++;
gray_val= MIN(gray_val, alpha_val);
if (alpha_val)
*dest++ = gray_val * 255 / alpha_val;
else
......@@ -991,8 +997,9 @@ read_8bit (guchar *source,
if (alpha) {
gray_val= *source++;
alpha_val= *source++;
gray_val= MIN(gray_val, alpha_val);
if (alpha_val)
*dest++ = ((255 - gray_val) * 255) / alpha_val;
*dest++ = ((alpha_val - gray_val) * 255) / alpha_val;
else
*dest++ = 0;
*dest++ = alpha_val;
......@@ -1012,6 +1019,9 @@ read_8bit (guchar *source,
green_val= *source++;
blue_val= *source++;
alpha_val= *source++;
red_val= MIN(red_val, alpha_val);
blue_val= MIN(blue_val, alpha_val);
green_val= MIN(green_val, alpha_val);
if (alpha_val) {
*dest++ = (red_val * 255) / alpha_val;
*dest++ = (green_val * 255) / alpha_val;
......@@ -1105,6 +1115,7 @@ read_default (guchar *source,
NEXTSAMPLE(gray_val);
if (alpha) {
NEXTSAMPLE(alpha_val);
gray_val= MIN(gray_val, alpha_val);
if (alpha_val)
*dest++ = (gray_val * 65025) / (alpha_val * maxval);
else
......@@ -1119,6 +1130,7 @@ read_default (guchar *source,
NEXTSAMPLE(gray_val);
if (alpha) {
NEXTSAMPLE(alpha_val);
gray_val= MIN(gray_val, alpha_val);
if (alpha_val)
*dest++ = ((maxval - gray_val) * 65025) / (alpha_val * maxval);
else
......@@ -1142,6 +1154,9 @@ read_default (guchar *source,
NEXTSAMPLE(blue_val)
if (alpha) {
NEXTSAMPLE(alpha_val)
red_val= MIN(red_val, alpha_val);
blue_val= MIN(blue_val, alpha_val);
green_val= MIN(green_val, alpha_val);
if (alpha_val) {
*dest++ = (red_val * 255) / alpha_val;
*dest++ = (green_val * 255) / alpha_val;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment