[gnumeric] StyleColor: improve alpha handling.



commit 6e9b70180ee5f96f09082b11857caea2c01ea11f
Author: Morten Welinder <terra gnome org>
Date:   Fri Jun 15 11:38:02 2012 -0400

    StyleColor: improve alpha handling.

 ChangeLog         |    1 +
 src/style-color.c |   10 +++++++---
 2 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index e0744f0..cee2846 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,7 @@
 
 	* src/style-color.c (style_color_new_gdk): Improve roundtrip.
 	[#667484]
+	(style_color_new_gdk): Keep alpha.
 
 2012-06-14  Andreas J. Guelzow <aguelzow pyrshep ca>
 
diff --git a/src/style-color.c b/src/style-color.c
index f635c29..4e5af9a 100644
--- a/src/style-color.c
+++ b/src/style-color.c
@@ -66,9 +66,13 @@ style_color_new_gdk (GdkRGBA const *c)
 	 * translated into GdkRGBA using /255 and back.  Using
 	 * multiplication by 256 here makes rounding unnecessary.
 	 */
-	return style_color_new_i8 (CLAMP (c->red * 256, 0, 255),
-				   CLAMP (c->green * 256, 0, 255),
-				   CLAMP (c->blue * 256, 0, 255));
+
+	guint8 r8 = CLAMP (c->red * 256, 0, 255);
+	guint8 g8 = CLAMP (c->green * 256, 0, 255);
+	guint8 b8 = CLAMP (c->blue * 256, 0, 255);
+	guint8 a8 = CLAMP (c->alpha * 256, 0, 255);
+
+	return style_color_new_go (GO_COLOR_FROM_RGBA (r8, g8, b8, a8));
 }
 
 GnmColor *



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]