Enlightenment CVS committal
Author : titan
Project : e17
Module : apps/ephoto
Dir : e17/apps/ephoto/src/bin
Modified Files:
ephoto_imaging.c
Log Message:
Fix the alpha issues with grayscale and sepia conversions, thanks
rasties and rephorm
===================================================================
RCS file: /cvs/e/e17/apps/ephoto/src/bin/ephoto_imaging.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -3 -r1.17 -r1.18
--- ephoto_imaging.c 31 May 2007 06:02:36 -0000 1.17
+++ ephoto_imaging.c 17 Jun 2007 03:21:51 -0000 1.18
@@ -290,7 +290,16 @@
r = (int)((im_data[i] >> 16) & 0xff);
a = (int)((im_data[i] >> 24) & 0xff);
+ if (a > 0 && a < 255)
+ {
+ b = b * (255 / a);
+ g = g * (255 / a);
+ r = r * (255 / a);
+ }
+
gray = (int)((0.3 * r) + (0.59 * g) + (0.11 * b));
+
+ if (a >= 0 && a < 255) gray = (gray * a) / 255;
im_data_new[i] = (a << 24) | (gray << 16) | (gray << 8) | gray;
}
@@ -313,6 +322,13 @@
g = (int)((im_data[i] >> 8) & 0xff);
r = (int)((im_data[i] >> 16) & 0xff);
a = (int)((im_data[i] >> 24) & 0xff);
+
+ if (a > 0 && a < 255)
+ {
+ b = b * (255 / a);
+ g = g * (255 / a);
+ r = r * (255 / a);
+ }
rr = (int)(((r + g + b)/3)+40);
if (rr < 0) rr = 0;
@@ -323,6 +339,13 @@
bb = (int)(((r + g + b)/3)+2);
if (bb < 0) bb = 0;
if (bb > 255) bb = 255;
+
+ if (a >= 0 && a < 255)
+ {
+ rr = (rr * a) / 255;
+ gg = (gg * a) / 255;
+ bb = (bb * a) / 255;
+ }
im_data_new[i] = (a << 24) | (rr << 16) | (gg << 8) | bb;
}
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs