]> Dogcows Code - chaz/tint2/blobdiff - src/util/common.c
lower cpu use with icon. replace HUE by ALPHA on icon (see task_icon_asb).
[chaz/tint2] / src / util / common.c
index f0f6b54886c807615de62abb7b0a27b3adb027a2..55a853b7c127f3475cc7d4add583c7ea81247349 100644 (file)
@@ -30,7 +30,7 @@
 
 
 
-void adjust_hsb(DATA32 *data, int w, int h, float hu, float satur, float bright)
+void adjust_asb(DATA32 *data, int w, int h, int alpha, float satur, float bright)
 {
        unsigned int x, y;
        unsigned int a, r, g, b, argb;
@@ -44,6 +44,8 @@ void adjust_hsb(DATA32 *data, int w, int h, float hu, float satur, float bright)
                for(id = y * w, x = 0; x < w; x++, id++) {
                        argb = data[id];
                        a = (argb >> 24) & 0xff;
+                       // transparent => nothing to do.
+                       if (a == 0) continue;
                        r = (argb >> 16) & 0xff;
                        g = (argb >> 8) & 0xff;
                        b = (argb) & 0xff;
@@ -82,9 +84,8 @@ void adjust_hsb(DATA32 *data, int w, int h, float hu, float satur, float bright)
                        brightness += bright;
                        if (brightness < 0.0) brightness = 0.0;
                        if (brightness > 1.0) brightness = 1.0;
-                       hue += hu;
-                       if (hue < 0.0) hue = 0.0;
-                       if (hue > 1.0) hue = 1.0;
+                       if (alpha != 100)
+                               a = (a * alpha)/100;
 
                        // convert HSB to RGB
                        if (saturation == 0) {
@@ -138,4 +139,3 @@ void adjust_hsb(DATA32 *data, int w, int h, float hu, float satur, float bright)
        }
 }
 
-
This page took 0.025944 seconds and 4 git commands to generate.