Browse Source

Do not touch alpha values when modifying brightness or contrast.

git-svn-id: file:///srv/caca.zoy.org/var/lib/svn/libpipi/trunk@3544 92316355-f0b4-4df1-b90c-862c8a59935f
master
sam 15 years ago
parent
commit
b473f55d2f
1 changed files with 4 additions and 4 deletions
  1. +4
    -4
      pipi/filter/color.c

+ 4
- 4
pipi/filter/color.c View File

@@ -70,7 +70,7 @@ pipi_image_t *pipi_brightness(pipi_image_t *src, double val)
p = srcdata[d + 2]; p = srcdata[d + 2];
dstdata[d + 2] = p < 1. - val ? p + val : 1.; dstdata[d + 2] = p < 1. - val ? p + val : 1.;
p = srcdata[d + 3]; p = srcdata[d + 3];
dstdata[d + 3] = p < 1. - val ? p + val : 1.;
dstdata[d + 3] = p;
} }
} }
} }
@@ -98,7 +98,7 @@ pipi_image_t *pipi_brightness(pipi_image_t *src, double val)
p = srcdata[d + 2]; p = srcdata[d + 2];
dstdata[d + 2] = p > -val ? p + val : 0.; dstdata[d + 2] = p > -val ? p + val : 0.;
p = srcdata[d + 3]; p = srcdata[d + 3];
dstdata[d + 3] = p > -val ? p + val : 0.;
dstdata[d + 3] = p;
} }
} }
} }
@@ -156,7 +156,7 @@ pipi_image_t *pipi_contrast(pipi_image_t *src, double val)
p = (srcdata[d + 2] - 0.5) * val + 0.5; p = (srcdata[d + 2] - 0.5) * val + 0.5;
dstdata[d + 2] = p < 0. ? 0. : p > 1. ? 1. : p; dstdata[d + 2] = p < 0. ? 0. : p > 1. ? 1. : p;
p = (srcdata[d + 3] - 0.5) * val + 0.5; p = (srcdata[d + 3] - 0.5) * val + 0.5;
dstdata[d + 3] = p < 0. ? 0. : p > 1. ? 1. : p;
dstdata[d + 3] = p;
} }
} }
} }
@@ -189,7 +189,7 @@ pipi_image_t *pipi_contrast(pipi_image_t *src, double val)
p = srcdata[d + 2]; p = srcdata[d + 2];
dstdata[d + 2] = (p - 0.5) * val + 0.5; dstdata[d + 2] = (p - 0.5) * val + 0.5;
p = srcdata[d + 3]; p = srcdata[d + 3];
dstdata[d + 3] = (p - 0.5) * val + 0.5;
dstdata[d + 3] = p;
} }
} }
} }


Loading…
Cancel
Save