summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2001-01-26 21:11:13 +0000
committerHavoc Pennington <hp@src.gnome.org>2001-01-26 21:11:13 +0000
commit2246697fe6b423b8837dcf49e237db8ade8ea2ff (patch)
tree6b6f12b7ef51fad7139b82d10797b0412da400a8
parent0ac9b1e4914f1ff01575fd9889e739a1b14c320a (diff)
downloadpango-2246697fe6b423b8837dcf49e237db8ade8ea2ff.tar.gz
take a PangoColor not a PangoAttrColor
2001-01-26 Havoc Pennington <hp@redhat.com> * pango/pangox.h (PangoGetGCFunc): take a PangoColor not a PangoAttrColor * pango/pango-attributes.h: add PangoColor, add PANGO_ATTR_INVALID as a placeholder for zero in the PangoAttrType enum, corresponds to G_TYPE_INVALID. * pango/pango-attributes.c: Add PangoColor type, use for PangoAttrColor (pango_color_get_type): new function (pango_color_copy): new function (pango_color_free): new function
-rw-r--r--ChangeLog15
-rw-r--r--ChangeLog.pre-1-015
-rw-r--r--ChangeLog.pre-1-1015
-rw-r--r--ChangeLog.pre-1-215
-rw-r--r--ChangeLog.pre-1-415
-rw-r--r--ChangeLog.pre-1-615
-rw-r--r--ChangeLog.pre-1-815
-rw-r--r--pango/pango-attributes.c57
-rw-r--r--pango/pango-attributes.h25
-rw-r--r--pango/pangox.c4
-rw-r--r--pango/pangox.h2
11 files changed, 179 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index 139476c7..aba390ed 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2001-01-26 Havoc Pennington <hp@redhat.com>
+
+ * pango/pangox.h (PangoGetGCFunc): take a PangoColor not a
+ PangoAttrColor
+
+ * pango/pango-attributes.h: add PangoColor, add PANGO_ATTR_INVALID
+ as a placeholder for zero in the PangoAttrType enum, corresponds
+ to G_TYPE_INVALID.
+
+ * pango/pango-attributes.c: Add PangoColor type, use for
+ PangoAttrColor
+ (pango_color_get_type): new function
+ (pango_color_copy): new function
+ (pango_color_free): new function
+
Thu Jan 25 14:47:17 2001 Owen Taylor <otaylor@redhat.com>
* pango/pango-sections.txt pango/pango-docs.sgml pango/tmpl/*:
diff --git a/ChangeLog.pre-1-0 b/ChangeLog.pre-1-0
index 139476c7..aba390ed 100644
--- a/ChangeLog.pre-1-0
+++ b/ChangeLog.pre-1-0
@@ -1,3 +1,18 @@
+2001-01-26 Havoc Pennington <hp@redhat.com>
+
+ * pango/pangox.h (PangoGetGCFunc): take a PangoColor not a
+ PangoAttrColor
+
+ * pango/pango-attributes.h: add PangoColor, add PANGO_ATTR_INVALID
+ as a placeholder for zero in the PangoAttrType enum, corresponds
+ to G_TYPE_INVALID.
+
+ * pango/pango-attributes.c: Add PangoColor type, use for
+ PangoAttrColor
+ (pango_color_get_type): new function
+ (pango_color_copy): new function
+ (pango_color_free): new function
+
Thu Jan 25 14:47:17 2001 Owen Taylor <otaylor@redhat.com>
* pango/pango-sections.txt pango/pango-docs.sgml pango/tmpl/*:
diff --git a/ChangeLog.pre-1-10 b/ChangeLog.pre-1-10
index 139476c7..aba390ed 100644
--- a/ChangeLog.pre-1-10
+++ b/ChangeLog.pre-1-10
@@ -1,3 +1,18 @@
+2001-01-26 Havoc Pennington <hp@redhat.com>
+
+ * pango/pangox.h (PangoGetGCFunc): take a PangoColor not a
+ PangoAttrColor
+
+ * pango/pango-attributes.h: add PangoColor, add PANGO_ATTR_INVALID
+ as a placeholder for zero in the PangoAttrType enum, corresponds
+ to G_TYPE_INVALID.
+
+ * pango/pango-attributes.c: Add PangoColor type, use for
+ PangoAttrColor
+ (pango_color_get_type): new function
+ (pango_color_copy): new function
+ (pango_color_free): new function
+
Thu Jan 25 14:47:17 2001 Owen Taylor <otaylor@redhat.com>
* pango/pango-sections.txt pango/pango-docs.sgml pango/tmpl/*:
diff --git a/ChangeLog.pre-1-2 b/ChangeLog.pre-1-2
index 139476c7..aba390ed 100644
--- a/ChangeLog.pre-1-2
+++ b/ChangeLog.pre-1-2
@@ -1,3 +1,18 @@
+2001-01-26 Havoc Pennington <hp@redhat.com>
+
+ * pango/pangox.h (PangoGetGCFunc): take a PangoColor not a
+ PangoAttrColor
+
+ * pango/pango-attributes.h: add PangoColor, add PANGO_ATTR_INVALID
+ as a placeholder for zero in the PangoAttrType enum, corresponds
+ to G_TYPE_INVALID.
+
+ * pango/pango-attributes.c: Add PangoColor type, use for
+ PangoAttrColor
+ (pango_color_get_type): new function
+ (pango_color_copy): new function
+ (pango_color_free): new function
+
Thu Jan 25 14:47:17 2001 Owen Taylor <otaylor@redhat.com>
* pango/pango-sections.txt pango/pango-docs.sgml pango/tmpl/*:
diff --git a/ChangeLog.pre-1-4 b/ChangeLog.pre-1-4
index 139476c7..aba390ed 100644
--- a/ChangeLog.pre-1-4
+++ b/ChangeLog.pre-1-4
@@ -1,3 +1,18 @@
+2001-01-26 Havoc Pennington <hp@redhat.com>
+
+ * pango/pangox.h (PangoGetGCFunc): take a PangoColor not a
+ PangoAttrColor
+
+ * pango/pango-attributes.h: add PangoColor, add PANGO_ATTR_INVALID
+ as a placeholder for zero in the PangoAttrType enum, corresponds
+ to G_TYPE_INVALID.
+
+ * pango/pango-attributes.c: Add PangoColor type, use for
+ PangoAttrColor
+ (pango_color_get_type): new function
+ (pango_color_copy): new function
+ (pango_color_free): new function
+
Thu Jan 25 14:47:17 2001 Owen Taylor <otaylor@redhat.com>
* pango/pango-sections.txt pango/pango-docs.sgml pango/tmpl/*:
diff --git a/ChangeLog.pre-1-6 b/ChangeLog.pre-1-6
index 139476c7..aba390ed 100644
--- a/ChangeLog.pre-1-6
+++ b/ChangeLog.pre-1-6
@@ -1,3 +1,18 @@
+2001-01-26 Havoc Pennington <hp@redhat.com>
+
+ * pango/pangox.h (PangoGetGCFunc): take a PangoColor not a
+ PangoAttrColor
+
+ * pango/pango-attributes.h: add PangoColor, add PANGO_ATTR_INVALID
+ as a placeholder for zero in the PangoAttrType enum, corresponds
+ to G_TYPE_INVALID.
+
+ * pango/pango-attributes.c: Add PangoColor type, use for
+ PangoAttrColor
+ (pango_color_get_type): new function
+ (pango_color_copy): new function
+ (pango_color_free): new function
+
Thu Jan 25 14:47:17 2001 Owen Taylor <otaylor@redhat.com>
* pango/pango-sections.txt pango/pango-docs.sgml pango/tmpl/*:
diff --git a/ChangeLog.pre-1-8 b/ChangeLog.pre-1-8
index 139476c7..aba390ed 100644
--- a/ChangeLog.pre-1-8
+++ b/ChangeLog.pre-1-8
@@ -1,3 +1,18 @@
+2001-01-26 Havoc Pennington <hp@redhat.com>
+
+ * pango/pangox.h (PangoGetGCFunc): take a PangoColor not a
+ PangoAttrColor
+
+ * pango/pango-attributes.h: add PangoColor, add PANGO_ATTR_INVALID
+ as a placeholder for zero in the PangoAttrType enum, corresponds
+ to G_TYPE_INVALID.
+
+ * pango/pango-attributes.c: Add PangoColor type, use for
+ PangoAttrColor
+ (pango_color_get_type): new function
+ (pango_color_copy): new function
+ (pango_color_free): new function
+
Thu Jan 25 14:47:17 2001 Owen Taylor <otaylor@redhat.com>
* pango/pango-sections.txt pango/pango-docs.sgml pango/tmpl/*:
diff --git a/pango/pango-attributes.c b/pango/pango-attributes.c
index afcd8530..cc72fc30 100644
--- a/pango/pango-attributes.c
+++ b/pango/pango-attributes.c
@@ -210,7 +210,9 @@ pango_attr_color_copy (const PangoAttribute *attr)
const PangoAttrColor *color_attr = (PangoAttrColor *)attr;
return pango_attr_color_new (attr->klass,
- color_attr->red, color_attr->green, color_attr->blue);
+ color_attr->color.red,
+ color_attr->color.green,
+ color_attr->color.blue);
}
static void
@@ -225,10 +227,10 @@ pango_attr_color_equal (const PangoAttribute *attr1,
{
const PangoAttrColor *color_attr1 = (const PangoAttrColor *)attr1;
const PangoAttrColor *color_attr2 = (const PangoAttrColor *)attr2;
-
- return (color_attr1->red == color_attr2->red &&
- color_attr1->blue == color_attr2->blue &&
- color_attr1->green == color_attr2->green);
+
+ return (color_attr1->color.red == color_attr2->color.red &&
+ color_attr1->color.blue == color_attr2->color.blue &&
+ color_attr1->color.green == color_attr2->color.green);
}
static PangoAttribute *
@@ -239,9 +241,9 @@ pango_attr_color_new (const PangoAttrClass *klass,
{
PangoAttrColor *result = g_new (PangoAttrColor, 1);
result->attr.klass = klass;
- result->red = red;
- result->green = green;
- result->blue = blue;
+ result->color.red = red;
+ result->color.green = green;
+ result->color.blue = blue;
return (PangoAttribute *)result;
}
@@ -1474,3 +1476,42 @@ pango_attr_iterator_get_font (PangoAttrIterator *iterator,
}
}
}
+
+GType
+pango_color_get_type (void)
+{
+ static GType our_type = 0;
+
+ if (our_type == 0)
+ {
+ g_type_init ();
+
+ our_type = g_boxed_type_register_static ("PangoColor",
+ pango_color_copy,
+ pango_color_free);
+ }
+
+ return our_type;
+}
+
+PangoColor*
+pango_color_copy (const PangoColor *src)
+{
+ PangoColor *ret;
+
+ g_return_val_if_fail (src != NULL, NULL);
+
+ ret = g_new (PangoColor, 1);
+
+ *ret = *src;
+
+ return ret;
+}
+
+void
+pango_color_free (PangoColor *color)
+{
+ g_return_if_fail (color != NULL);
+
+ g_free (color);
+}
diff --git a/pango/pango-attributes.h b/pango/pango-attributes.h
index d7859441..59012cc3 100644
--- a/pango/pango-attributes.h
+++ b/pango/pango-attributes.h
@@ -23,11 +23,31 @@
#define __PANGO_ATTRIBUTES_H__
#include <pango/pango-font.h>
+#include <glib-object.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
+/* PangoColor */
+
+typedef struct _PangoColor PangoColor;
+
+struct _PangoColor
+{
+ guint16 red;
+ guint16 green;
+ guint16 blue;
+};
+
+#define PANGO_TYPE_COLOR pango_color_get_type ()
+GType pango_color_get_type (void) G_GNUC_CONST;
+
+PangoColor *pango_color_copy (const PangoColor *src);
+void pango_color_free (PangoColor *color);
+
+/* Attributes */
+
typedef struct _PangoAttribute PangoAttribute;
typedef struct _PangoAttrClass PangoAttrClass;
@@ -43,6 +63,7 @@ typedef struct _PangoAttrIterator PangoAttrIterator;
typedef enum
{
+ PANGO_ATTR_INVALID, /* 0 is an invalid attribute type */
PANGO_ATTR_LANG, /* PangoAttrString */
PANGO_ATTR_FAMILY, /* PangoAttrString */
PANGO_ATTR_STYLE, /* PangoAttrInt */
@@ -103,9 +124,7 @@ struct _PangoAttrFloat
struct _PangoAttrColor
{
PangoAttribute attr;
- guint16 red;
- guint16 green;
- guint16 blue;
+ PangoColor color;
};
struct _PangoAttrShape
diff --git a/pango/pangox.c b/pango/pangox.c
index 3ea6a249..d429ca59 100644
--- a/pango/pangox.c
+++ b/pango/pangox.c
@@ -1290,7 +1290,7 @@ pango_x_render_layout_line (Display *display,
pango_x_get_item_properties (run->item, &uline, &fg_color, &fg_set, &bg_color, &bg_set);
if (fg_set && info->get_gc_func)
- fg_gc = info->get_gc_func (context, &fg_color, gc);
+ fg_gc = info->get_gc_func (context, &fg_color.color, gc);
else
fg_gc = gc;
@@ -1303,7 +1303,7 @@ pango_x_render_layout_line (Display *display,
if (bg_set && info->get_gc_func)
{
- GC bg_gc = info->get_gc_func (context, &bg_color, gc);
+ GC bg_gc = info->get_gc_func (context, &bg_color.color, gc);
XFillRectangle (display, drawable, bg_gc,
x + (x_off + logical_rect.x) / PANGO_SCALE,
diff --git a/pango/pangox.h b/pango/pangox.h
index 222fddc2..85dedbe4 100644
--- a/pango/pangox.h
+++ b/pango/pangox.h
@@ -34,7 +34,7 @@ extern "C" {
#define PANGO_RENDER_TYPE_X "PangoRenderX"
-typedef GC (*PangoGetGCFunc) (PangoContext *context, PangoAttrColor *color, GC base_gc);
+typedef GC (*PangoGetGCFunc) (PangoContext *context, PangoColor *color, GC base_gc);
typedef void (*PangoFreeGCFunc) (PangoContext *context, GC gc);
/* Calls for applications