[gnumeric] gnm_xml_out_add_gocolor: handle alpha.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] gnm_xml_out_add_gocolor: handle alpha.
- Date: Mon, 18 Jun 2012 15:07:13 +0000 (UTC)
commit ca20fbec82952c1a36d02fe4aa94b77405df093a
Author: Morten Welinder <terra gnome org>
Date: Mon Jun 18 11:06:11 2012 -0400
gnm_xml_out_add_gocolor: handle alpha.
More work towards using alpha correctly. Not sure if it'll be useful,
but the lower levels of code shouldn't be making that decision.
ChangeLog | 4 ++++
src/xml-sax-write.c | 17 ++++++++++++++++-
2 files changed, 20 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 22a1a35..b7d9adb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2012-06-18 Morten Welinder <terra gnome org>
+
+ * src/xml-sax-write.c (gnm_xml_out_add_gocolor): Handle alpha.
+
2012-06-16 Andreas J. Guelzow <aguelzow pyrshep ca>
* src/sheet-filter.c (gnm_filter_set_range): new
diff --git a/src/xml-sax-write.c b/src/xml-sax-write.c
index d1a4467..3babac4 100644
--- a/src/xml-sax-write.c
+++ b/src/xml-sax-write.c
@@ -83,9 +83,24 @@ typedef struct {
void
gnm_xml_out_add_gocolor (GsfXMLOut *o, char const *id, GOColor c)
{
+ /*
+ * This uses format "rrrr:gggg:bbbb" or "rrrr:gggg:bbbb:aaaa"
+ * using hex numbers, i.e., the numbers are in the range from
+ * 0 to FFFF.
+ *
+ * Note, that while go_xml_out_add_color exists, we cannot use
+ * it as it using a 0-255 scaling and always includes alpha.
+ */
unsigned r, g, b, a;
+ char buf[4 * 4 * sizeof (unsigned int) + 1];
+
GO_COLOR_TO_RGBA (c, &r, &g, &b, &a);
- gsf_xml_out_add_color (o, id, r * 0x101, g * 0x101, b * 0x101);
+
+ sprintf (buf, "%X:%X:%X%c%X",
+ r * 0x101, g * 0x101, b * 0x101,
+ (a == 0xff ? 0 : ':'),
+ a * 0x101);
+ gsf_xml_out_add_cstr_unchecked (o, id, buf);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]