[libgxps] Support opacity for LinearGradientBrush and RadialGradientBrush elements
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgxps] Support opacity for LinearGradientBrush and RadialGradientBrush elements
- Date: Tue, 1 Nov 2011 11:54:10 +0000 (UTC)
commit 6c0688cc6f1f4a7593bbb74630bd4c0a4600eaab
Author: Jason Crain <jason aquaticape us>
Date: Fri Sep 16 22:47:58 2011 -0500
Support opacity for LinearGradientBrush and RadialGradientBrush elements
https://bugzilla.gnome.org/show_bug.cgi?id=662655
libgxps/gxps-page.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/libgxps/gxps-page.c b/libgxps/gxps-page.c
index 947c968..ceff570 100644
--- a/libgxps/gxps-page.c
+++ b/libgxps/gxps-page.c
@@ -1042,6 +1042,7 @@ gxps_tile_mode_parse (const gchar *tile)
typedef struct {
GXPSRenderContext *ctx;
cairo_pattern_t *pattern;
+ gdouble opacity;
} GXPSBrush;
static GXPSBrush *
@@ -1051,6 +1052,7 @@ gxps_brush_new (GXPSRenderContext *ctx)
brush = g_slice_new0 (GXPSBrush);
brush->ctx = ctx;
+ brush->opacity = 1.0;
return brush;
}
@@ -1240,6 +1242,7 @@ brush_gradient_start_element (GMarkupParseContext *context,
return;
}
+ a *= brush->opacity;
if (a != 1.0) {
cairo_pattern_add_color_stop_rgba (brush->pattern,
offset,
@@ -1388,6 +1391,8 @@ brush_start_element (GMarkupParseContext *context,
}
} else if (strcmp (names[i], "SpreadMethod") == 0) {
extend = gxps_spread_method_parse (values[i]);
+ } else if (strcmp (names[i], "Opacity") == 0) {
+ brush->opacity = g_ascii_strtod (values[i], NULL);
} else if (strcmp (names[i], "Transform") == 0) {
if (!gxps_matrix_parse (values[i], &matrix)) {
gxps_parse_error (context,
@@ -1441,6 +1446,8 @@ brush_start_element (GMarkupParseContext *context,
r1 = g_strtod (values[i], NULL);
} else if (strcmp (names[i], "SpreadMethod") == 0) {
extend = gxps_spread_method_parse (values[i]);
+ } else if (strcmp (names[i], "Opacity") == 0) {
+ brush->opacity = g_ascii_strtod (values[i], NULL);
} else if (strcmp (names[i], "Transform") == 0) {
if (!gxps_matrix_parse (values[i], &matrix)) {
gxps_parse_error (context,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]