summaryrefslogtreecommitdiff
path: root/pango/pango-renderer.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2022-02-08 14:08:25 -0500
committerMatthias Clasen <mclasen@redhat.com>2022-02-13 14:30:32 -0600
commit5b4d403b325afef41db811ce21f541933541b56a (patch)
tree98d62ae2646b60c933ae75148d25160a87e894eb /pango/pango-renderer.c
parent47d07d41137ee206a5fd9b8041dccbec5ab60411 (diff)
downloadpango-5b4d403b325afef41db811ce21f541933541b56a.tar.gz
Add alpha to PangoColorredo-attrs
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/pango-renderer.c')
-rw-r--r--pango/pango-renderer.c79
1 files changed, 2 insertions, 77 deletions
diff --git a/pango/pango-renderer.c b/pango/pango-renderer.c
index 1a50eaa0..512a7bbe 100644
--- a/pango/pango-renderer.c
+++ b/pango/pango-renderer.c
@@ -59,7 +59,6 @@ struct _PangoRendererPrivate
{
PangoColor color[N_RENDER_PARTS];
gboolean color_set[N_RENDER_PARTS];
- guint16 alpha[N_RENDER_PARTS];
PangoLayoutLine *line;
LineState *line_state;
@@ -1243,8 +1242,6 @@ pango_renderer_deactivate (PangoRenderer *renderer)
*
* Sets the color for part of the rendering.
*
- * Also see [method@Pango.Renderer.set_alpha].
- *
* Since: 1.8
*/
void
@@ -1255,11 +1252,9 @@ pango_renderer_set_color (PangoRenderer *renderer,
g_return_if_fail (PANGO_IS_RENDERER_FAST (renderer));
g_return_if_fail (IS_VALID_PART (part));
- if ((!color && !renderer->priv->color_set[part]) ||
+ 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);
@@ -1302,60 +1297,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.
- *
- * Since: 1.38
- */
-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.
- *
- * Since: 1.38
- */
-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.
@@ -1419,8 +1360,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;
renderer->underline = PANGO_LINE_STYLE_NONE;
@@ -1470,14 +1409,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;
}
@@ -1497,12 +1428,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);
}
/**