diff options
Diffstat (limited to 'graphics/asymptote/psfile.cc')
-rw-r--r-- | graphics/asymptote/psfile.cc | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/graphics/asymptote/psfile.cc b/graphics/asymptote/psfile.cc index 6d882f4bed..924f3c1872 100644 --- a/graphics/asymptote/psfile.cc +++ b/graphics/asymptote/psfile.cc @@ -183,22 +183,37 @@ void psfile::epilogue() void psfile::setcolor(const pen& p, const string& begin="", const string& end="") { + ostringstream buf; if(p.cmyk() && (!lastpen.cmyk() || (p.cyan() != lastpen.cyan() || p.magenta() != lastpen.magenta() || p.yellow() != lastpen.yellow() || p.black() != lastpen.black()))) { - *out << begin << p.cyan() << " " << p.magenta() << " " << p.yellow() << " " - << p.black() << (pdf ? " k" : " setcmykcolor") << end << newl; + buf << begin << p.cyan() << " " << p.magenta() << " " << p.yellow() << " " + << p.black(); + if(pdf) { + *out << buf.str() << " k" << end << newl; + *out << buf.str() << " K" << end << newl; + } else + *out << buf.str() << " setcmykcolor" << end << newl; } else if(p.rgb() && (!lastpen.rgb() || (p.red() != lastpen.red() || p.green() != lastpen.green() || p.blue() != lastpen.blue()))) { - *out << begin << p.red() << " " << p.green() << " " << p.blue() - << (pdf ? " rg" : " setrgbcolor") << end << newl; + buf << begin << p.red() << " " << p.green() << " " << p.blue(); + if(pdf) { + *out << buf.str() << " rg" << end << newl; + *out << buf.str() << " RG" << end << newl; + } else + *out << buf.str() << " setrgbcolor" << end << newl; } else if(p.grayscale() && (!lastpen.grayscale() || p.gray() != lastpen.gray())) { - *out << begin << p.gray() << (pdf ? " g" : " setgray") << end << newl; + buf << begin << p.gray(); + if(pdf) { + *out << begin << p.gray() << " g" << end << newl; + *out << begin << p.gray() << " G" << end << newl; + } else + *out << begin << p.gray() << " setgray" << end << newl; } } |