summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@gnome.org>2006-12-06 22:46:47 +0000
committerBehdad Esfahbod <behdad@src.gnome.org>2006-12-06 22:46:47 +0000
commitb7c74a7787b624bdf1ef6a4f6dba2007317b9265 (patch)
treea476293161d06793ae6cae8d945f6511c186cdfa
parent520013cab0678357f8b15b8e719d6181a0246ca2 (diff)
downloadpango-b7c74a7787b624bdf1ef6a4f6dba2007317b9265.tar.gz
Bug 373856 – Wish: Function to convert a GdkColor to a string Patch from
2006-12-06 Behdad Esfahbod <behdad@gnome.org> Bug 373856 – Wish: Function to convert a GdkColor to a string Patch from Matthew Barnes * docs/pango-sections.txt: * docs/tmpl/text-attributes.sgml: * pango/pango-attributes.h: * pango/pango.def: * pango/pango-color.c (pango_color_to_string): New public function pango_color_to_string().
-rw-r--r--ChangeLog12
-rw-r--r--docs/pango-sections.txt3
-rw-r--r--docs/tmpl/text-attributes.sgml21
-rw-r--r--pango/pango-attributes.h2
-rw-r--r--pango/pango-color.c21
-rw-r--r--pango/pango.def1
6 files changed, 53 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index a8d7ef3e..93370202 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
2006-12-06 Behdad Esfahbod <behdad@gnome.org>
+ Bug 373856 – Wish: Function to convert a GdkColor to a string
+ Patch from Matthew Barnes
+
+ * docs/pango-sections.txt:
+ * docs/tmpl/text-attributes.sgml:
+ * pango/pango-attributes.h:
+ * pango/pango.def:
+ * pango/pango-color.c (pango_color_to_string):
+ New public function pango_color_to_string().
+
+2006-12-06 Behdad Esfahbod <behdad@gnome.org>
+
Red Hat Bug 216850: Issue in combination with vowels (ml_IN)
Patch from LingNing Zhang
diff --git a/docs/pango-sections.txt b/docs/pango-sections.txt
index 956c7696..afa6afe2 100644
--- a/docs/pango-sections.txt
+++ b/docs/pango-sections.txt
@@ -351,9 +351,10 @@ pango_attr_rise_new
pango_attr_letter_spacing_new
PangoColor
PANGO_TYPE_COLOR
-pango_color_free
pango_color_parse
pango_color_copy
+pango_color_free
+pango_color_to_string
PangoLanguage
PANGO_TYPE_LANGUAGE
pango_language_from_string
diff --git a/docs/tmpl/text-attributes.sgml b/docs/tmpl/text-attributes.sgml
index 871494fb..b0872b0c 100644
--- a/docs/tmpl/text-attributes.sgml
+++ b/docs/tmpl/text-attributes.sgml
@@ -530,30 +530,39 @@ The #GObject type for #PangoColor.
-<!-- ##### FUNCTION pango_color_free ##### -->
+<!-- ##### FUNCTION pango_color_parse ##### -->
<para>
</para>
@color:
+@spec:
+@Returns:
-<!-- ##### FUNCTION pango_color_parse ##### -->
+<!-- ##### FUNCTION pango_color_copy ##### -->
<para>
</para>
-@color:
-@spec:
+@src:
@Returns:
-<!-- ##### FUNCTION pango_color_copy ##### -->
+<!-- ##### FUNCTION pango_color_free ##### -->
<para>
</para>
-@src:
+@color:
+
+
+<!-- ##### FUNCTION pango_color_to_string ##### -->
+<para>
+
+</para>
+
+@color:
@Returns:
diff --git a/pango/pango-attributes.h b/pango/pango-attributes.h
index 65b69b1e..4dc31af6 100644
--- a/pango/pango-attributes.h
+++ b/pango/pango-attributes.h
@@ -45,6 +45,8 @@ PangoColor *pango_color_copy (const PangoColor *src);
void pango_color_free (PangoColor *color);
gboolean pango_color_parse (PangoColor *color,
const char *spec);
+gchar *pango_color_to_string(const PangoColor *color);
+
/* Attributes */
diff --git a/pango/pango-color.c b/pango/pango-color.c
index a471b4ce..13e38ff2 100644
--- a/pango/pango-color.c
+++ b/pango/pango-color.c
@@ -80,6 +80,27 @@ pango_color_free (PangoColor *color)
g_slice_free (PangoColor, color);
}
+/**
+ * pango_color_to_string:
+ * @color: a #PangoColor
+ *
+ * Returns a textual specification of @color in the hexadecimal form
+ * <literal>&num;rrrrggggbbbb</literal>, where <literal>r</literal>,
+ * <literal>g</literal> and <literal>b</literal> are hex digits representing
+ * the red, green, and blue components respectively.
+ *
+ * Return value: a newly-allocated text string that must be freed with g_free().
+ *
+ * Since: 1.16
+ **/
+gchar *
+pango_color_to_string (const PangoColor *color)
+{
+ g_return_val_if_fail (color != NULL, NULL);
+
+ return g_strdup_printf ("#%04x%04x%04x", color->red, color->green, color->blue);
+}
+
/* Color parsing
*/
diff --git a/pango/pango.def b/pango/pango.def
index c3815182..a8430f9c 100644
--- a/pango/pango.def
+++ b/pango/pango.def
@@ -49,6 +49,7 @@ EXPORTS
pango_color_free
pango_color_get_type
pango_color_parse
+ pango_color_to_string
pango_config_key_get
pango_context_get_base_dir
pango_context_get_base_gravity