Enlightenment CVS committal

Author  : rbdpngn
Project : e17
Module  : apps/e

Dir     : e17/apps/e/src/modules/flame


Modified Files:
        e_mod_main.c 


Log Message:
Use luma value to set a reasonable alpha value on the flame in order to blend
without the black backing.

===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/modules/flame/e_mod_main.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- e_mod_main.c        23 Dec 2004 06:38:27 -0000      1.3
+++ e_mod_main.c        25 Dec 2004 03:34:17 -0000      1.4
@@ -339,7 +339,7 @@
 static void
 _flame_palette_default_set (Flame_Face *ff)
 {
-   int i, r, g, b;
+   int i, r, g, b, a;
    
    for (i = 0 ; i < 300 ; i++)
      {
@@ -353,14 +353,9 @@
        if (g > 255) g = 255;
        if (b < 0)   b = 0;
        if (b > 255) b = 255;
-       
-       if ((r*r + g*g + b*b) <= 100)
-         ff->palette[i] = ((r*r + g*g + b*b)                |
-                           (((unsigned char)r) << 16) |
-                           (((unsigned char)g) << 8)  |
-                           ((unsigned char)b));
-       else
-         ff->palette[i] = ((255 << 24)                |
+       a = (int)((r * 0.299) + (g * 0.587) + (b * 0.114));
+       ff->palette[i] = ((((unsigned char)
+                           a) << 24) |
                            (((unsigned char)r) << 16) |
                            (((unsigned char)g) << 8)  |
                            ((unsigned char)b));
@@ -371,21 +366,15 @@
 static void
 _flame_palette_plasma_set (Flame_Face *ff)
 {
-   int i, r, g, b;
+   int i, r, g, b, a;
    
    for (i = 0 ; i < 80 ; i++)
      {
        r = 0;
        g = 0;
        b = (i*255) / 80;
-       
-       if ((r*r + g*g + b*b) <= 100)
-         ff->palette[i] = ((r*r + g*g + b*b)                |
-                           (((unsigned char)r) << 16) |
-                           (((unsigned char)g) << 8)  |
-                           ((unsigned char)b));
-       else
-         ff->palette[i] = ((255 << 24)        |
+       a = (int)((r * 0.299) + (g * 0.587) + (b * 0.114));
+       ff->palette[i] = ((((unsigned char)a) << 24) |
                            (((unsigned char)r) << 16) |
                            (((unsigned char)g) << 8)  |
                            ((unsigned char)b));




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to