summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2015-08-11 15:48:25 -0400
committerMatthias Clasen <mclasen@redhat.com>2015-08-11 20:39:14 -0400
commit5dd3585270746fd88b267d06ce20eb9c19cab5e5 (patch)
tree0c290d402e6fafe3ad2e86da131666ab58a07ef5
parent6489105c20bdebc720c223894d947fd5e3cebe49 (diff)
downloadpango-5dd3585270746fd88b267d06ce20eb9c19cab5e5.tar.gz
Add attribute types for fg and bg alpha
Add attributes types for foreground and background alpha.
-rw-r--r--docs/pango-sections.txt2
-rw-r--r--pango/pango-attributes.c48
-rw-r--r--pango/pango-attributes.h8
3 files changed, 57 insertions, 1 deletions
diff --git a/docs/pango-sections.txt b/docs/pango-sections.txt
index 0401a158..fa45b245 100644
--- a/docs/pango-sections.txt
+++ b/docs/pango-sections.txt
@@ -381,6 +381,8 @@ pango_attr_fallback_new
pango_attr_gravity_new
pango_attr_gravity_hint_new
pango_attr_font_features_new
+pango_attr_foreground_alpha_new
+pango_attr_background_alpha_new
PangoColor
PANGO_TYPE_COLOR
pango_color_parse
diff --git a/pango/pango-attributes.c b/pango/pango-attributes.c
index da9fefeb..b8544316 100644
--- a/pango/pango-attributes.c
+++ b/pango/pango-attributes.c
@@ -1127,6 +1127,54 @@ pango_attr_font_features_new (const gchar *features)
return pango_attr_string_new (&klass, features);
}
+/**
+ * pango_attr_foreground_alpha_new:
+ * @alpha: the alpha value, between 1 and 65536
+ *
+ * Create a new foreground alpha attribute.
+ *
+ * Return value: (transfer full): the new allocated #PangoAttribute,
+ * which should be freed with pango_attribute_destroy().
+ *
+ * Since: 1.38
+ */
+PangoAttribute *
+pango_attr_foreground_alpha_new (guint16 alpha)
+{
+ static const PangoAttrClass klass = {
+ PANGO_ATTR_FOREGROUND_ALPHA,
+ pango_attr_int_copy,
+ pango_attr_int_destroy,
+ pango_attr_int_equal
+ };
+
+ return pango_attr_int_new (&klass, (int)alpha);
+}
+
+/**
+ * pango_attr_background_alpha_new:
+ * @alpha: the alpha value, between 1 and 65536
+ *
+ * Create a new background alpha attribute.
+ *
+ * Return value: (transfer full): the new allocated #PangoAttribute,
+ * which should be freed with pango_attribute_destroy().
+ *
+ * Since: 1.38
+ */
+PangoAttribute *
+pango_attr_background_alpha_new (guint16 alpha)
+{
+ static const PangoAttrClass klass = {
+ PANGO_ATTR_BACKGROUND_ALPHA,
+ pango_attr_int_copy,
+ pango_attr_int_destroy,
+ pango_attr_int_equal
+ };
+
+ return pango_attr_int_new (&klass, (int)alpha);
+}
+
/*
* Attribute List
*/
diff --git a/pango/pango-attributes.h b/pango/pango-attributes.h
index 3f783e45..1844fcde 100644
--- a/pango/pango-attributes.h
+++ b/pango/pango-attributes.h
@@ -137,6 +137,8 @@ typedef struct _PangoAttrIterator PangoAttrIterator;
* @PANGO_ATTR_GRAVITY: base text gravity (#PangoAttrInt)
* @PANGO_ATTR_GRAVITY_HINT: gravity hint (#PangoAttrInt)
* @PANGO_ATTR_FONT_FEATURES: OpenType font features (#PangoAttrString). Since 1.38
+ * @PANGO_ATTR_FOREGROUND_ALPHA: foreground alpha (#PangoAttrInt). Since 1.38
+ * @PANGO_ATTR_BACKGROUND_ALPHA: background alpha (#PangoAttrInt). Since 1.38
*
* The #PangoAttrType
* distinguishes between different types of attributes. Along with the
@@ -170,7 +172,9 @@ typedef enum
PANGO_ATTR_ABSOLUTE_SIZE, /* PangoAttrSize */
PANGO_ATTR_GRAVITY, /* PangoAttrInt */
PANGO_ATTR_GRAVITY_HINT, /* PangoAttrInt */
- PANGO_ATTR_FONT_FEATURES /* PangoAttrString */
+ PANGO_ATTR_FONT_FEATURES, /* PangoAttrString */
+ PANGO_ATTR_FOREGROUND_ALPHA, /* PangoAttrInt */
+ PANGO_ATTR_BACKGROUND_ALPHA /* PangoAttrInt */
} PangoAttrType;
/**
@@ -476,6 +480,8 @@ PangoAttribute *pango_attr_shape_new_with_data (const PangoRectangle *ink_
PangoAttribute *pango_attr_gravity_new (PangoGravity gravity);
PangoAttribute *pango_attr_gravity_hint_new (PangoGravityHint hint);
PangoAttribute *pango_attr_font_features_new (const gchar *features);
+PangoAttribute *pango_attr_foreground_alpha_new (guint16 alpha);
+PangoAttribute *pango_attr_background_alpha_new (guint16 alpha);
GType pango_attr_list_get_type (void) G_GNUC_CONST;
PangoAttrList * pango_attr_list_new (void);