summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 25d6e22)
raw | patch | inline | side by side (parent: 25d6e22)
author | ishmal <ishmal@users.sourceforge.net> | |
Sat, 19 May 2007 10:14:37 +0000 (10:14 +0000) | ||
committer | ishmal <ishmal@users.sourceforge.net> | |
Sat, 19 May 2007 10:14:37 +0000 (10:14 +0000) |
src/extension/internal/latex-pstricks.cpp | patch | blob | history | |
src/extension/internal/latex-pstricks.h | patch | blob | history |
index f8615944979ad96f264c0a56e130b163c4418764..990c094a421fb9a931985250fffa898256c38baf 100644 (file)
#include <signal.h>
#include <errno.h>
+
+#include "libnr/nr-matrix.h"
+#include "libnr/nr-matrix-ops.h"
+#include "libnr/nr-matrix-scale-ops.h"
+#include "libnr/nr-matrix-translate-ops.h"
+#include "libnr/nr-scale-translate-ops.h"
+#include "libnr/nr-translate-scale-ops.h"
+#include <libnr/nr-matrix-fns.h>
+
+
#include "libnr/n-art-bpath.h"
#include "sp-item.h"
os << "\\begin{pspicture}(" << sp_document_width(doc) << "," << sp_document_height(doc) << ")\n";
}
+ m_tr_stack.push( NR::scale(1, -1) * NR::translate(0, sp_document_height(doc)));
+
return fprintf(_stream, "%s", os.str().c_str());
}
return 0;
}
+unsigned int
+PrintLatex::bind(Inkscape::Extension::Print *mod, NRMatrix const *transform, float opacity)
+{
+ NR::Matrix tr = *transform;
+
+ if(m_tr_stack.size()){
+ NR::Matrix tr_top = m_tr_stack.top();
+ m_tr_stack.push(tr * tr_top);
+ }else
+ m_tr_stack.push(tr);
+
+ return 1;
+}
+
+unsigned int
+PrintLatex::release(Inkscape::Extension::Print *mod)
+{
+ m_tr_stack.pop();
+ return 1;
+}
+
unsigned int PrintLatex::comment (Inkscape::Extension::Print * module,
const char * comment)
{
@@ -203,13 +236,14 @@ PrintLatex::stroke (Inkscape::Extension::Print *mod, const NRBPath *bpath, const
if (style->stroke.type == SP_PAINT_TYPE_COLOR) {
Inkscape::SVGOStringStream os;
float rgb[3];
-
+ NR::Matrix tr_stack = m_tr_stack.top();
+ double const scale = expansion(tr_stack);
os.setf(std::ios::fixed);
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<< ",linecolor=curcolor";
+ os << "\\pscustom[linewidth=" << style->stroke_width.computed*scale<< ",linecolor=curcolor";
if (style->stroke_dasharray_set &&
style->stroke_dash.n_dash &&
@@ -241,16 +275,22 @@ PrintLatex::print_bpath(SVGOStringStream &os, const NArtBpath *bp, const NRMatri
{
unsigned int closed;
NR::Matrix tf=*transform;
-
+ NR::Matrix tf_stack=m_tr_stack.top();
os << "\\newpath\n";
closed = FALSE;
while (bp->code != NR_END) {
using NR::X;
using NR::Y;
- NR::Point const p1(bp->c(1) * tf);
- NR::Point const p2(bp->c(2) * tf);
- NR::Point const p3(bp->c(3) * tf);
+
+// NR::Point const p1(bp->c(1) * tf);
+// NR::Point const p2(bp->c(2) * tf);
+// NR::Point const p3(bp->c(3) * tf);
+
+ NR::Point const p1(bp->c(1) * tf_stack);
+ NR::Point const p2(bp->c(2) * tf_stack);
+ NR::Point const p3(bp->c(3) * tf_stack);
+
double const x1 = p1[X], y1 = p1[Y];
double const x2 = p2[X], y2 = p2[Y];
double const x3 = p3[X], y3 = p3[Y];
index 9238fe60679fa93550011cb2a7930d4155af02dc..0e15006306f74b6989ca8a9a608fc399e9cce31c 100644 (file)
#include "svg/stringstream.h"
+#include <stack>
+
namespace Inkscape {
namespace Extension {
namespace Internal {
float _width;
float _height;
FILE * _stream;
+
+ std::stack<NR::Matrix> m_tr_stack;
- void print_bpath (SVGOStringStream &os, const NArtBpath *bp, const NRMatrix *transform);
+ void print_bpath (SVGOStringStream &os, const NArtBpath *bp, const NRMatrix *transform);
public:
PrintLatex (void);
virtual unsigned int finish (Inkscape::Extension::Print * module);
/* Rendering methods */
- virtual unsigned int fill (Inkscape::Extension::Print * module, const NRBPath *bpath, const NRMatrix *ctm, const SPStyle *style,
+ virtual unsigned int bind(Inkscape::Extension::Print *module, NRMatrix const *transform, float opacity);
+ virtual unsigned int release(Inkscape::Extension::Print *module);
+
+ virtual unsigned int fill (Inkscape::Extension::Print * module, const NRBPath *bpath, const NRMatrix *ctm, const SPStyle *style,
const NRRect *pbox, const NRRect *dbox, const NRRect *bbox);
virtual unsigned int stroke (Inkscape::Extension::Print * module, const NRBPath *bpath, const NRMatrix *transform, const SPStyle *style,
const NRRect *pbox, const NRRect *dbox, const NRRect *bbox);