Code

PStricks opacity fix.
authorJazzyNico <nicoduf@yahoo.fr>
Tue, 23 Feb 2010 11:28:49 +0000 (12:28 +0100)
committerJazzyNico <nicoduf@yahoo.fr>
Tue, 23 Feb 2010 11:28:49 +0000 (12:28 +0100)
src/extension/internal/latex-pstricks.cpp

index 789e5ea346878159e2cb150c191d41ce33fbdf0b..34b7532cee112fe1038c09feef1fff12a8f47d53 100644 (file)
@@ -203,13 +203,19 @@ PrintLatex::fill(Inkscape::Extension::Print *mod,
     if (style->fill.isColor()) {
         Inkscape::SVGOStringStream os;
         float rgb[3];
+        float fill_opacity;
 
         os.setf(std::ios::fixed);
 
+        fill_opacity=SP_SCALE24_TO_FLOAT(style->fill_opacity.value);
         sp_color_get_rgb_floatv(&style->fill.value.color, rgb);
         os << "{\n\\newrgbcolor{curcolor}{" << rgb[0] << " " << rgb[1] << " " << rgb[2] << "}\n";
+        os << "\\pscustom[linestyle=none,fillstyle=solid,fillcolor=curcolor";
+        if (fill_opacity!=1.0) {
+            os << ",opacity="<<fill_opacity;
+        }
 
-        os << "\\pscustom[linestyle=none,fillstyle=solid,fillcolor=curcolor]\n{\n";
+        os << "]\n{\n";
 
         print_pathvector(os, pathv, transform);
 
@@ -230,14 +236,20 @@ PrintLatex::stroke (Inkscape::Extension::Print *mod, Geom::PathVector const &pat
     if (style->stroke.isColor()) {
         Inkscape::SVGOStringStream os;
         float rgb[3];
+        float stroke_opacity;
         Geom::Matrix tr_stack = m_tr_stack.top();
         double const scale = tr_stack.descrim();
         os.setf(std::ios::fixed);
 
+        stroke_opacity=SP_SCALE24_TO_FLOAT(style->stroke_opacity.value);
         sp_color_get_rgb_floatv(&style->stroke.value.color, rgb);
         os << "{\n\\newrgbcolor{curcolor}{" << rgb[0] << " " << rgb[1] << " " << rgb[2] << "}\n";
 
         os << "\\pscustom[linewidth=" << style->stroke_width.computed*scale<< ",linecolor=curcolor";
+        
+        if (stroke_opacity!=1.0) {
+            os<<",strokeopacity="<<stroke_opacity;
+        }
 
         if (style->stroke_dasharray_set &&
                 style->stroke_dash.n_dash &&