summaryrefslogtreecommitdiff
path: root/pango
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2022-06-12 22:53:53 -0400
committerMatthias Clasen <mclasen@redhat.com>2022-06-22 13:54:02 -0400
commit99edfcbb6c0f1bc34fcb595048ea7b47f85b4378 (patch)
tree0d6966b230cb905329040d0733504b001876042d /pango
parent06dcb2a65177282d5ad09a855f5169edeef3b8f5 (diff)
downloadpango-99edfcbb6c0f1bc34fcb595048ea7b47f85b4378.tar.gz
Add alpha to PangoColor
Adapt all users. This drops the alpha attributes and alpha in markup, and adds alpha support to underlines, overlines and strikethroughs.
Diffstat (limited to 'pango')
-rw-r--r--pango/pango-attr-list.c8
-rw-r--r--pango/pango-attr.c2
-rw-r--r--pango/pango-attributes.c32
-rw-r--r--pango/pango-attributes.h8
-rw-r--r--pango/pango-color.c83
-rw-r--r--pango/pango-color.h16
-rw-r--r--pango/pango-markup.c95
-rw-r--r--pango/pango-renderer.c73
-rw-r--r--pango/pango-renderer.h8
-rw-r--r--pango/pangocairo-render.c8
-rw-r--r--pango/serializer.c8
11 files changed, 55 insertions, 286 deletions
diff --git a/pango/pango-attr-list.c b/pango/pango-attr-list.c
index 96b90ce6..c7ad4015 100644
--- a/pango/pango-attr-list.c
+++ b/pango/pango-attr-list.c
@@ -1189,14 +1189,6 @@ pango_attr_list_from_string (const char *text)
ENUM_ATTR(gravity_hint, PangoGravityHint, PANGO_GRAVITY_HINT_NATURAL, PANGO_GRAVITY_HINT_LINE);
break;
- case PANGO_ATTR_FOREGROUND_ALPHA:
- INT_ATTR(foreground_alpha, int);
- break;
-
- case PANGO_ATTR_BACKGROUND_ALPHA:
- INT_ATTR(background_alpha, int);
- break;
-
case PANGO_ATTR_ALLOW_BREAKS:
BOOLEAN_ATTR(allow_breaks, gboolean);
break;
diff --git a/pango/pango-attr.c b/pango/pango-attr.c
index bde91956..9640e009 100644
--- a/pango/pango-attr.c
+++ b/pango/pango-attr.c
@@ -86,8 +86,6 @@ is_valid_attr_type (guint type)
case PANGO_ATTR_GRAVITY:
case PANGO_ATTR_GRAVITY_HINT:
case PANGO_ATTR_FONT_FEATURES:
- case PANGO_ATTR_FOREGROUND_ALPHA:
- case PANGO_ATTR_BACKGROUND_ALPHA:
case PANGO_ATTR_ALLOW_BREAKS:
case PANGO_ATTR_SHOW:
case PANGO_ATTR_INSERT_HYPHENS:
diff --git a/pango/pango-attributes.c b/pango/pango-attributes.c
index 53bc01d1..cbd110f6 100644
--- a/pango/pango-attributes.c
+++ b/pango/pango-attributes.c
@@ -584,38 +584,6 @@ pango_attr_font_features_new (const char *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 newly allocated
- * `PangoAttribute`, which should be freed with
- * [method@Pango.Attribute.destroy]
- */
-PangoAttribute *
-pango_attr_foreground_alpha_new (guint16 alpha)
-{
- return pango_attr_int_new (PANGO_ATTR_FOREGROUND_ALPHA, (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 newly allocated
- * `PangoAttribute`, which should be freed with
- * [method@Pango.Attribute.destroy]
- */
-PangoAttribute *
-pango_attr_background_alpha_new (guint16 alpha)
-{
- return pango_attr_int_new (PANGO_ATTR_BACKGROUND_ALPHA, (int)alpha);
-}
-
-/**
* pango_attr_allow_breaks_new:
* @allow_breaks: %TRUE if we line breaks are allowed
*
diff --git a/pango/pango-attributes.h b/pango/pango-attributes.h
index 7e8310e3..37ad85e2 100644
--- a/pango/pango-attributes.h
+++ b/pango/pango-attributes.h
@@ -57,8 +57,6 @@ G_BEGIN_DECLS
* @PANGO_ATTR_GRAVITY: base text gravity
* @PANGO_ATTR_GRAVITY_HINT: gravity hint
* @PANGO_ATTR_FONT_FEATURES: OpenType font features
- * @PANGO_ATTR_FOREGROUND_ALPHA: foreground alpha
- * @PANGO_ATTR_BACKGROUND_ALPHA: background alpha
* @PANGO_ATTR_ALLOW_BREAKS: whether line breaks are allowed
* @PANGO_ATTR_SHOW: how to render invisible characters
* @PANGO_ATTR_INSERT_HYPHENS: whether to insert hyphens at intra-word line breaks
@@ -106,8 +104,6 @@ typedef enum
PANGO_ATTR_GRAVITY = PANGO_ATTR_TYPE (INT, ITEMIZATION, OVERRIDES),
PANGO_ATTR_GRAVITY_HINT = PANGO_ATTR_TYPE (INT, ITEMIZATION, OVERRIDES),
PANGO_ATTR_FONT_FEATURES = PANGO_ATTR_TYPE (STRING, SHAPING, ACCUMULATES),
- PANGO_ATTR_FOREGROUND_ALPHA = PANGO_ATTR_TYPE (INT, RENDERING, OVERRIDES),
- PANGO_ATTR_BACKGROUND_ALPHA = PANGO_ATTR_TYPE (INT, RENDERING, OVERRIDES),
PANGO_ATTR_ALLOW_BREAKS = PANGO_ATTR_TYPE (BOOLEAN, BREAKING, OVERRIDES),
PANGO_ATTR_SHOW = PANGO_ATTR_TYPE (INT, SHAPING, OVERRIDES),
PANGO_ATTR_INSERT_HYPHENS = PANGO_ATTR_TYPE (BOOLEAN, SHAPING, OVERRIDES),
@@ -239,10 +235,6 @@ PangoAttribute * pango_attr_gravity_hint_new (PangoGravityHin
PANGO_AVAILABLE_IN_ALL
PangoAttribute * pango_attr_font_features_new (const char *features);
PANGO_AVAILABLE_IN_ALL
-PangoAttribute * pango_attr_foreground_alpha_new (guint16 alpha);
-PANGO_AVAILABLE_IN_ALL
-PangoAttribute * pango_attr_background_alpha_new (guint16 alpha);
-PANGO_AVAILABLE_IN_ALL
PangoAttribute * pango_attr_allow_breaks_new (gboolean allow_breaks);
PANGO_AVAILABLE_IN_ALL
PangoAttribute * pango_attr_word_new (void);
diff --git a/pango/pango-color.c b/pango/pango-color.c
index 03929a1b..b2d85562 100644
--- a/pango/pango-color.c
+++ b/pango/pango-color.c
@@ -77,14 +77,35 @@ pango_color_free (PangoColor *color)
}
/**
+ * pango_color_equal:
+ * @color1: (nullable): a `PangoColor`
+ * @color2: (nullable): another `PangoColor`
+ *
+ * Compares two colors for quality.
+ *
+ * Returns: `TRUE` if the colors are equal
+ */
+gboolean
+pango_color_equal (const PangoColor *color1,
+ const PangoColor *color2)
+{
+ return color1 == color2 ||
+ (color1 && color2 &&
+ color1->red == color2->red &&
+ color1->green == color2->green &&
+ color1->blue == color2->blue &&
+ color1->alpha == color2->alpha);
+}
+
+/**
* pango_color_to_string:
* @color: a `PangoColor`
*
* Returns a textual specification of @color.
*
- * The string is in the hexadecimal form `#rrrrggggbbbb`,
- * where `r`, `g` and `b` are hex digits representing the
- * red, green, and blue components respectively.
+ * The string is in the hexadecimal form `#rrrrggggbbbbaaaa`,
+ * where `r`, `g`, `b` and `a` are hex digits representing the
+ * red, green, blue and alpha components respectively.
*
* Return value: a newly-allocated text string that must
* be freed with [GLib.free]
@@ -94,7 +115,11 @@ 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);
+ return g_strdup_printf ("#%04x%04x%04x%04x",
+ color->red,
+ color->green,
+ color->blue,
+ color->alpha);
}
/* Color parsing
@@ -209,10 +234,8 @@ hex (const char *spec,
/**
- * pango_color_parse_with_alpha:
- * @color: (nullable): a `PangoColor` structure in which
- * to store the result
- * @alpha: (out) (optional): return location for alpha
+ * pango_color_parse:
+ * @color: a `PangoColor` structure in which to store the result
* @spec: a string specifying the new color
*
* Fill in the fields of a color from a string specification.
@@ -226,23 +249,21 @@ hex (const char *spec,
* `#fff`, `#ffffff`, `#fffffffff` and `#ffffffffffff`.)
*
* Additionally, parse strings of the form `#rgba`, `#rrggbbaa`,
- * `#rrrrggggbbbbaaaa`, if @alpha is not %NULL, and set @alpha
+ * `#rrrrggggbbbbaaaa`, and set the alpha component of @color
* to the value specified by the hex digits for `a`. If no alpha
- * component is found in @spec, @alpha is set to 0xffff (for a
+ * component is found in @spec, alpha is set to 0xffff (for a
* solid color).
*
* Return value: %TRUE if parsing of the specifier succeeded,
* otherwise %FALSE
*/
gboolean
-pango_color_parse_with_alpha (PangoColor *color,
- guint16 *alpha,
- const char *spec)
+pango_color_parse (PangoColor *color,
+ const char *spec)
{
g_return_val_if_fail (spec != NULL, FALSE);
- if (alpha)
- *alpha = 0xffff;
+ color->alpha = 0xffff;
if (spec[0] == '#')
{
@@ -264,8 +285,6 @@ pango_color_parse_with_alpha (PangoColor *color,
case 4:
case 8:
case 16:
- if (!alpha)
- return FALSE;
len /= 4;
has_alpha = TRUE;
break;
@@ -297,7 +316,7 @@ pango_color_parse_with_alpha (PangoColor *color,
color->blue = b;
}
- if (alpha && has_alpha)
+ if (has_alpha)
{
int bits = len * 4;
a <<= 16 - bits;
@@ -306,7 +325,7 @@ pango_color_parse_with_alpha (PangoColor *color,
a |= (a >> bits);
bits *= 2;
}
- *alpha = a;
+ color->alpha = a;
}
}
else
@@ -316,29 +335,3 @@ pango_color_parse_with_alpha (PangoColor *color,
}
return TRUE;
}
-
-/**
- * pango_color_parse:
- * @color: (nullable): a `PangoColor` structure in which
- * to store the result
- * @spec: a string specifying the new color
- *
- * Fill in the fields of a color from a string specification.
- *
- * The string can either one of a large set of standard names.
- * (Taken from the CSS Color [specification](https://www.w3.org/TR/css-color-4/#named-colors),
- * or it can be a value in the form `#rgb`, `#rrggbb`,
- * `#rrrgggbbb` or `#rrrrggggbbbb`, where `r`, `g` and `b`
- * are hex digits of the red, green, and blue components
- * of the color, respectively. (White in the four forms is
- * `#fff`, `#ffffff`, `#fffffffff` and `#ffffffffffff`.)
- *
- * Return value: %TRUE if parsing of the specifier succeeded,
- * otherwise %FALSE
- */
-gboolean
-pango_color_parse (PangoColor *color,
- const char *spec)
-{
- return pango_color_parse_with_alpha (color, NULL, spec);
-}
diff --git a/pango/pango-color.h b/pango/pango-color.h
index f184d4b6..abf4b643 100644
--- a/pango/pango-color.h
+++ b/pango/pango-color.h
@@ -29,9 +29,10 @@ typedef struct _PangoColor PangoColor;
/**
* PangoColor:
- * @red: value of red component
- * @green: value of green component
- * @blue: value of blue component
+ * @red: value of the red component
+ * @green: value of the green component
+ * @blue: value of the blue component
+ * @alpha: value of the alpha component
*
* The `PangoColor` structure is used to
* represent a color in an uncalibrated RGB color-space.
@@ -41,6 +42,7 @@ struct _PangoColor
guint16 red;
guint16 green;
guint16 blue;
+ guint16 alpha;
};
#define PANGO_TYPE_COLOR (pango_color_get_type ())
@@ -55,12 +57,10 @@ PANGO_AVAILABLE_IN_ALL
void pango_color_free (PangoColor *color);
PANGO_AVAILABLE_IN_ALL
-gboolean pango_color_parse (PangoColor *color,
- const char *spec);
-
+gboolean pango_color_equal (const PangoColor *color1,
+ const PangoColor *color2);
PANGO_AVAILABLE_IN_ALL
-gboolean pango_color_parse_with_alpha (PangoColor *color,
- guint16 *alpha,
+gboolean pango_color_parse (PangoColor *color,
const char *spec);
PANGO_AVAILABLE_IN_ALL
diff --git a/pango/pango-markup.c b/pango/pango-markup.c
index aea2c3ca..1786bfba 100644
--- a/pango/pango-markup.c
+++ b/pango/pango-markup.c
@@ -1209,11 +1209,10 @@ static gboolean
span_parse_color (const char *attr_name,
const char *attr_val,
PangoColor *color,
- guint16 *alpha,
int line_number,
GError **error)
{
- if (!pango_color_parse_with_alpha (color, alpha, attr_val))
+ if (!pango_color_parse (color, attr_val))
{
g_set_error (error,
G_MARKUP_ERROR,
@@ -1229,56 +1228,6 @@ span_parse_color (const char *attr_name,
}
static gboolean
-span_parse_alpha (const char *attr_name,
- const char *attr_val,
- guint16 *val,
- int line_number,
- GError **error)
-{
- const char *end = attr_val;
- int int_val;
-
- if (_pango_scan_int (&end, &int_val))
- {
- if (*end == '\0' && int_val > 0 && int_val <= 0xffff)
- {
- *val = (guint16)int_val;
- return TRUE;
- }
- else if (*end == '%' && int_val > 0 && int_val <= 100)
- {
- *val = (guint16)(int_val * 0xffff / 100);
- return TRUE;
- }
- else
- {
- g_set_error (error,
- G_MARKUP_ERROR,
- G_MARKUP_ERROR_INVALID_CONTENT,
- _("Value of '%s' attribute on <span> tag "
- "on line %d could not be parsed; "
- "should be between 0 and 65536 or a "
- "percentage, not '%s'"),
- attr_name, line_number, attr_val);
- return FALSE;
- }
- }
- else
- {
- g_set_error (error,
- G_MARKUP_ERROR,
- G_MARKUP_ERROR_INVALID_CONTENT,
- _("Value of '%s' attribute on <span> tag "
- "on line %d could not be parsed; "
- "should be an integer, not '%s'"),
- attr_name, line_number, attr_val);
- return FALSE;
- }
-
- return TRUE;
-}
-
-static gboolean
span_parse_enum (const char *attr_name,
const char *attr_val,
GType type,
@@ -1394,8 +1343,6 @@ span_parse_func (MarkupData *md G_GNUC_UNUSED,
const char *gravity = NULL;
const char *gravity_hint = NULL;
const char *font_features = NULL;
- const char *alpha = NULL;
- const char *background_alpha = NULL;
const char *allow_breaks = NULL;
const char *insert_hyphens = NULL;
const char *show = NULL;
@@ -1433,13 +1380,10 @@ span_parse_func (MarkupData *md G_GNUC_UNUSED,
switch (names[i][0]) {
case 'a':
CHECK_ATTRIBUTE (allow_breaks);
- CHECK_ATTRIBUTE (alpha);
break;
case 'b':
CHECK_ATTRIBUTE (background);
CHECK_ATTRIBUTE2(background, "bgcolor");
- CHECK_ATTRIBUTE (background_alpha);
- CHECK_ATTRIBUTE2(background_alpha, "bgalpha");
CHECK_ATTRIBUTE(baseline_shift);
break;
case 'c':
@@ -1461,7 +1405,6 @@ span_parse_func (MarkupData *md G_GNUC_UNUSED,
CHECK_ATTRIBUTE (foreground);
CHECK_ATTRIBUTE2(foreground, "fgcolor");
- CHECK_ATTRIBUTE2(alpha, "fgalpha");
CHECK_ATTRIBUTE (font_features);
break;
@@ -1665,47 +1608,21 @@ span_parse_func (MarkupData *md G_GNUC_UNUSED,
if (G_UNLIKELY (foreground))
{
PangoColor color;
- guint16 alpha;
- if (!span_parse_color ("foreground", foreground, &color, &alpha, line_number, error))
+ if (!span_parse_color ("foreground", foreground, &color, line_number, error))
goto error;
add_attribute (tag, pango_attr_foreground_new (&color));
- if (alpha != 0xffff)
- add_attribute (tag, pango_attr_foreground_alpha_new (alpha));
}
if (G_UNLIKELY (background))
{
PangoColor color;
- guint16 alpha;
- if (!span_parse_color ("background", background, &color, &alpha, line_number, error))
+ if (!span_parse_color ("background", background, &color, line_number, error))
goto error;
add_attribute (tag, pango_attr_background_new (&color));
- if (alpha != 0xffff)
- add_attribute (tag, pango_attr_background_alpha_new (alpha));
- }
-
- if (G_UNLIKELY (alpha))
- {
- guint16 val;
-
- if (!span_parse_alpha ("alpha", alpha, &val, line_number, error))
- goto error;
-
- add_attribute (tag, pango_attr_foreground_alpha_new (val));
- }
-
- if (G_UNLIKELY (background_alpha))
- {
- guint16 val;
-
- if (!span_parse_alpha ("background_alpha", background_alpha, &val, line_number, error))
- goto error;
-
- add_attribute (tag, pango_attr_background_alpha_new (val));
}
if (G_UNLIKELY (underline))
@@ -1732,7 +1649,7 @@ span_parse_func (MarkupData *md G_GNUC_UNUSED,
{
PangoColor color;
- if (!span_parse_color ("underline_color", underline_color, &color, NULL, line_number, error))
+ if (!span_parse_color ("underline_color", underline_color, &color, line_number, error))
goto error;
add_attribute (tag, pango_attr_underline_color_new (&color));
@@ -1752,7 +1669,7 @@ span_parse_func (MarkupData *md G_GNUC_UNUSED,
{
PangoColor color;
- if (!span_parse_color ("overline_color", overline_color, &color, NULL, line_number, error))
+ if (!span_parse_color ("overline_color", overline_color, &color, line_number, error))
goto error;
add_attribute (tag, pango_attr_overline_color_new (&color));
@@ -1805,7 +1722,7 @@ span_parse_func (MarkupData *md G_GNUC_UNUSED,
{
PangoColor color;
- if (!span_parse_color ("strikethrough_color", strikethrough_color, &color, NULL, line_number, error))
+ if (!span_parse_color ("strikethrough_color", strikethrough_color, &color, line_number, error))
goto error;
add_attribute (tag, pango_attr_strikethrough_color_new (&color));
diff --git a/pango/pango-renderer.c b/pango/pango-renderer.c
index 4ef9b873..37eb8dfc 100644
--- a/pango/pango-renderer.c
+++ b/pango/pango-renderer.c
@@ -63,7 +63,6 @@ struct _PangoRendererPrivate
PangoColor color[N_RENDER_PARTS];
gboolean color_set[N_RENDER_PARTS];
- guint16 alpha[N_RENDER_PARTS];
PangoLines *lines;
PangoLine *line;
@@ -1233,8 +1232,6 @@ pango_renderer_deactivate (PangoRenderer *renderer)
* @color: (nullable): the new color or %NULL to unset the current color
*
* Sets the color for part of the rendering.
- *
- * Also see [method@Pango.Renderer.set_alpha].
*/
void
pango_renderer_set_color (PangoRenderer *renderer,
@@ -1246,9 +1243,7 @@ pango_renderer_set_color (PangoRenderer *renderer,
if ((!color && !renderer->priv->color_set[part]) ||
(color && renderer->priv->color_set[part] &&
- renderer->priv->color[part].red == color->red &&
- renderer->priv->color[part].green == color->green &&
- renderer->priv->color[part].blue == color->blue))
+ pango_color_equal (color, &renderer->priv->color[part])))
return;
pango_renderer_part_changed (renderer, part);
@@ -1289,56 +1284,6 @@ pango_renderer_get_color (PangoRenderer *renderer,
}
/**
- * pango_renderer_set_alpha:
- * @renderer: a `PangoRenderer`
- * @part: the part to set the alpha for
- * @alpha: an alpha value between 1 and 65536, or 0 to unset the alpha
- *
- * Sets the alpha for part of the rendering.
- *
- * Note that the alpha may only be used if a color is
- * specified for @part as well.
- */
-void
-pango_renderer_set_alpha (PangoRenderer *renderer,
- PangoRenderPart part,
- guint16 alpha)
-{
- g_return_if_fail (PANGO_IS_RENDERER_FAST (renderer));
- g_return_if_fail (IS_VALID_PART (part));
-
- if ((!alpha && !renderer->priv->alpha[part]) ||
- (alpha && renderer->priv->alpha[part] &&
- renderer->priv->alpha[part] == alpha))
- return;
-
- pango_renderer_part_changed (renderer, part);
-
- renderer->priv->alpha[part] = alpha;
-}
-
-/**
- * pango_renderer_get_alpha:
- * @renderer: a `PangoRenderer`
- * @part: the part to get the alpha for
- *
- * Gets the current alpha for the specified part.
- *
- * Return value: the alpha for the specified part,
- * or 0 if it hasn't been set and should be
- * inherited from the environment.
- */
-guint16
-pango_renderer_get_alpha (PangoRenderer *renderer,
- PangoRenderPart part)
-{
- g_return_val_if_fail (PANGO_IS_RENDERER_FAST (renderer), 0);
- g_return_val_if_fail (IS_VALID_PART (part), 0);
-
- return renderer->priv->alpha[part];
-}
-
-/**
* pango_renderer_part_changed:
* @renderer: a `PangoRenderer`
* @part: the part for which rendering has changed.
@@ -1398,8 +1343,6 @@ pango_renderer_default_prepare_run (PangoRenderer *renderer,
PangoColor *underline_color = NULL;
PangoColor *overline_color = NULL;
PangoColor *strikethrough_color = NULL;
- guint16 fg_alpha = 0;
- guint16 bg_alpha = 0;
GSList *l;
PangoGlyphItem *glyph_item;
@@ -1452,14 +1395,6 @@ pango_renderer_default_prepare_run (PangoRenderer *renderer,
strikethrough_color = &attr->color_value;
break;
- case PANGO_ATTR_FOREGROUND_ALPHA:
- fg_alpha = attr->int_value;
- break;
-
- case PANGO_ATTR_BACKGROUND_ALPHA:
- bg_alpha = attr->int_value;
- break;
-
default:
break;
}
@@ -1479,12 +1414,6 @@ pango_renderer_default_prepare_run (PangoRenderer *renderer,
pango_renderer_set_color (renderer, PANGO_RENDER_PART_UNDERLINE, underline_color);
pango_renderer_set_color (renderer, PANGO_RENDER_PART_STRIKETHROUGH, strikethrough_color);
pango_renderer_set_color (renderer, PANGO_RENDER_PART_OVERLINE, overline_color);
-
- pango_renderer_set_alpha (renderer, PANGO_RENDER_PART_FOREGROUND, fg_alpha);
- pango_renderer_set_alpha (renderer, PANGO_RENDER_PART_BACKGROUND, bg_alpha);
- pango_renderer_set_alpha (renderer, PANGO_RENDER_PART_UNDERLINE, fg_alpha);
- pango_renderer_set_alpha (renderer, PANGO_RENDER_PART_STRIKETHROUGH, fg_alpha);
- pango_renderer_set_alpha (renderer, PANGO_RENDER_PART_OVERLINE, fg_alpha);
}
/**
diff --git a/pango/pango-renderer.h b/pango/pango-renderer.h
index 3baf4ca8..4de0bb32 100644
--- a/pango/pango-renderer.h
+++ b/pango/pango-renderer.h
@@ -256,14 +256,6 @@ PangoColor *pango_renderer_get_color (PangoRenderer *renderer,
PangoRenderPart part);
PANGO_AVAILABLE_IN_ALL
-void pango_renderer_set_alpha (PangoRenderer *renderer,
- PangoRenderPart part,
- guint16 alpha);
-PANGO_AVAILABLE_IN_ALL
-guint16 pango_renderer_get_alpha (PangoRenderer *renderer,
- PangoRenderPart part);
-
-PANGO_AVAILABLE_IN_ALL
void pango_renderer_set_matrix (PangoRenderer *renderer,
const PangoMatrix *matrix);
PANGO_AVAILABLE_IN_ALL
diff --git a/pango/pangocairo-render.c b/pango/pangocairo-render.c
index 80a6cc19..7fb0bbe4 100644
--- a/pango/pangocairo-render.c
+++ b/pango/pangocairo-render.c
@@ -62,10 +62,9 @@ set_color (PangoCairoRenderer *crenderer,
PangoRenderPart part)
{
PangoColor *color = pango_renderer_get_color ((PangoRenderer *) (crenderer), part);
- guint16 a = pango_renderer_get_alpha ((PangoRenderer *) (crenderer), part);
gdouble red, green, blue, alpha;
- if (!a && !color)
+ if (!color)
return;
if (color)
@@ -73,7 +72,7 @@ set_color (PangoCairoRenderer *crenderer,
red = color->red / 65535.;
green = color->green / 65535.;
blue = color->blue / 65535.;
- alpha = 1.;
+ alpha = color->alpha / 65535.;
}
else
{
@@ -90,9 +89,6 @@ set_color (PangoCairoRenderer *crenderer,
}
}
- if (a)
- alpha = a / 65535.;
-
cairo_set_source_rgba (crenderer->cr, red, green, blue, alpha);
}
diff --git a/pango/serializer.c b/pango/serializer.c
index 154cf28d..8b6ba419 100644
--- a/pango/serializer.c
+++ b/pango/serializer.c
@@ -1057,14 +1057,6 @@ attr_for_type (GtkJsonParser *parser,
g_free (str);
break;
- case PANGO_ATTR_FOREGROUND_ALPHA:
- attr = pango_attr_foreground_alpha_new ((int) gtk_json_parser_get_number (parser));
- break;
-
- case PANGO_ATTR_BACKGROUND_ALPHA:
- attr = pango_attr_background_alpha_new ((int) gtk_json_parser_get_number (parser));
- break;
-
case PANGO_ATTR_ALLOW_BREAKS:
attr = pango_attr_allow_breaks_new (gtk_json_parser_get_boolean (parser));
break;