[dia] svg-import: better handling of DIA_SVG_COLOUR_NONE
- From: Hans Breuer <hans src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia] svg-import: better handling of DIA_SVG_COLOUR_NONE
- Date: Sun, 7 Oct 2012 13:03:19 +0000 (UTC)
commit 2ea1f8fafbec9516fb45c0843bbe63a0bd252042
Author: Hans Breuer <hans breuer org>
Date: Sat Oct 6 21:05:06 2012 +0200
svg-import: better handling of DIA_SVG_COLOUR_NONE
we can do transparency now,; also it was not handling the Dia special
color codes fg/bg etc. pp.
plug-ins/svg/svg-import.c | 27 +++++++++++++++++----------
1 files changed, 17 insertions(+), 10 deletions(-)
---
diff --git a/plug-ins/svg/svg-import.c b/plug-ins/svg/svg-import.c
index 00cc96d..74e2f6c 100644
--- a/plug-ins/svg/svg-import.c
+++ b/plug-ins/svg/svg-import.c
@@ -277,15 +277,15 @@ apply_style(DiaObject *obj, xmlNodePtr node, DiaSvgStyle *parent_style)
g_assert(props->len == 5);
cprop = g_ptr_array_index(props,0);
- if(gs->stroke != (-1)) {
+ if(gs->stroke == DIA_SVG_COLOUR_NONE) /* transparent */
+ cprop->color_data = get_colour(0xFFFFFF, 0.0);
+ else if (gs->stroke == DIA_SVG_COLOUR_FOREGROUND)
+ cprop->color_data = attributes_get_foreground();
+ else if (gs->stroke == DIA_SVG_COLOUR_BACKGROUND)
+ cprop->color_data = attributes_get_background();
+ else
cprop->color_data = get_colour(gs->stroke, gs->stroke_opacity);
- } else {
- if(gs->fill == DIA_SVG_COLOUR_NONE) {
- cprop->color_data = get_colour(0x000000, 1.0);
- } else {
- cprop->color_data = get_colour(gs->fill, gs->fill_opacity);
- }
- }
+
rprop = g_ptr_array_index(props,1);
rprop->real_data = gs->line_width * scale;
@@ -294,10 +294,17 @@ apply_style(DiaObject *obj, xmlNodePtr node, DiaSvgStyle *parent_style)
lsprop->dash = gs->dashlength * scale;
cprop = g_ptr_array_index(props,3);
- cprop->color_data = get_colour(gs->fill, gs->fill_opacity);
+ if(gs->fill == DIA_SVG_COLOUR_NONE) /* transparent */
+ cprop->color_data = get_colour(0x000000, 0.0);
+ else if (gs->fill == DIA_SVG_COLOUR_FOREGROUND)
+ cprop->color_data = attributes_get_foreground();
+ else if (gs->fill == DIA_SVG_COLOUR_BACKGROUND)
+ cprop->color_data = attributes_get_background();
+ else
+ cprop->color_data = get_colour(gs->fill, gs->fill_opacity);
bprop = g_ptr_array_index(props,4);
- if(gs->fill == (-1)) {
+ if(gs->fill == DIA_SVG_COLOUR_NONE) {
bprop->bool_data = FALSE;
} else {
bprop->bool_data = TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]