[dia] vdx: transparency/alpha support for export and import



commit 6d775680bbce02fd71647acc2bf024433375e563
Author: Hans Breuer <hans breuer org>
Date:   Sun Jun 26 13:09:11 2011 +0200

    vdx: transparency/alpha support for export and import

 plug-ins/vdx/vdx-export.c |    2 ++
 plug-ins/vdx/vdx-import.c |    7 +++++++
 2 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/plug-ins/vdx/vdx-export.c b/plug-ins/vdx/vdx-export.c
index aecd504..1970655 100644
--- a/plug-ins/vdx/vdx-export.c
+++ b/plug-ins/vdx/vdx-export.c
@@ -510,6 +510,7 @@ create_Line(VDXRenderer *renderer, Color *color, struct vdx_Line *Line,
         break;
     }
     Line->LineColor = *color;
+    Line->LineColorTrans = 1.0 - color->alpha;
     Line->LineWeight = renderer->linewidth / vdx_Line_Scale;
     if (start_arrow || end_arrow) 
     {
@@ -531,6 +532,7 @@ create_Fill(VDXRenderer *renderer, Color *color, struct vdx_Fill *Fill)
     memset(Fill, 0, sizeof(*Fill));
     Fill->any.type = vdx_types_Fill;
     Fill->FillForegnd = *color;
+    Fill->FillForegndTrans = 1.0 - color->alpha;
     Fill->FillPattern = 1;      /* Solid fill */
 }
 
diff --git a/plug-ins/vdx/vdx-import.c b/plug-ins/vdx/vdx-import.c
index ad975b3..5aba7ad 100644
--- a/plug-ins/vdx/vdx-import.c
+++ b/plug-ins/vdx/vdx-import.c
@@ -634,6 +634,7 @@ vdx_simple_properties(DiaObject *obj,
 
         cprop = g_ptr_array_index(props,1);
         cprop->color_data = Line->LineColor;
+	cprop->color_data.alpha = 1.0 - Line->LineColorTrans;
 
         if (!Line->LinePattern)
         { cprop->color_data = vdx_parse_color("#FFFFFF", theDoc); }
@@ -671,9 +672,15 @@ vdx_simple_properties(DiaObject *obj,
            I've chosen the background colour for all patterns except solid */
 
         if (Fill->FillPattern == 1)
+	{
             cprop->color_data = Fill->FillForegnd;
+	    cprop->color_data.alpha = 1.0 - Fill->FillForegndTrans;
+	}
         else
+	{
             cprop->color_data = Fill->FillBkgnd;
+	    cprop->color_data.alpha = 1.0 - Fill->FillBkgndTrans;
+	}
 
         if (theDoc->debug_comments)
         {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]