latex-pstricks.cpp revision 22c86d6dc2d3dc9508a464e6ccb0e75430b88c86
#define __SP_LATEX_C__
/*
* LaTeX Printing
*
* Author:
* Michael Forbes <miforbes@mbhs.edu>
*
* Copyright (C) 2004 Authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#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"
#include "style.h"
#include "latex-pstricks.h"
#include <unit-constants.h>
namespace Inkscape {
namespace Extension {
namespace Internal {
{
}
PrintLatex::~PrintLatex (void)
{
/* restore default signal handling for SIGPIPE */
#endif
return;
}
unsigned int
{
return TRUE;
}
unsigned int
{
int res;
gsize bytesWritten = 0;
/* TODO: Replace the below fprintf's with something that does the right thing whether in
* gui or batch mode (e.g. --print=blah). Consider throwing an exception: currently one of
* the callers (sp_print_document_to_file, "ret = mod->begin(doc)") wrongly ignores the
* return code.
*/
if (!osf) {
return 0;
}
}
if (_stream) {
/* fixme: this is kinda icky */
#endif
}
/* flush this to test output stream as early as possible */
/*g_print("caught error in sp_module_print_plain_begin\n");*/
g_strerror(errno));
}
g_print("Printing failed\n");
/* fixme: should use pclose() for pipes */
return 0;
}
// width and height in pt
if (res >= 0) {
os << "%%Please note this file requires PSTricks extensions\n";
os << "\\psset{xunit=.5pt,yunit=.5pt,runit=.5pt}\n";
// from now on we can output px, but they will be treated as pt
}
}
unsigned int
{
int res;
if (!_stream) return 0;
/* Flush stream to be sure. */
return 0;
}
unsigned int
{
if(m_tr_stack.size()){
}else
return 1;
}
unsigned int
{
m_tr_stack.pop();
return 1;
}
const char * comment)
{
if (!_stream) return 0; // XXX: fixme, returning -1 as unsigned.
}
unsigned int
{
if (!_stream) return 0; // XXX: fixme, returning -1 as unsigned.
float rgb[3];
os << "\\pscustom[linestyle=none,fillstyle=solid,fillcolor=curcolor]\n{\n";
os << "}\n}\n";
}
return 0;
}
unsigned int
PrintLatex::stroke (Inkscape::Extension::Print *mod, const NRBPath *bpath, const NRMatrix *transform, const SPStyle *style,
{
if (!_stream) return 0; // XXX: fixme, returning -1 as unsigned.
float rgb[3];
if (style->stroke_dasharray_set &&
int i;
os << ",linestyle=dashed,dash=";
if ((i)) {
os << " ";
}
}
}
os <<"]\n{\n";
os << "}\n}\n";
}
return 0;
}
void
{
unsigned int closed;
os << "\\newpath\n";
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);
case NR_MOVETO:
if (closed) {
os << "\\closepath\n";
}
break;
case NR_MOVETO_OPEN:
if (closed) {
os << "\\closepath\n";
}
break;
case NR_LINETO:
break;
case NR_CURVETO:
break;
default:
break;
}
bp += 1;
}
if (closed) {
os << "\\closepath\n";
}
}
bool
{
}
#include "clear-n_.h"
void
PrintLatex::init (void)
{
/* SVG in */
"<inkscape-extension>\n"
"<param name=\"destination\" type=\"string\"></param>\n"
"<param name=\"textToPath\" type=\"boolean\">TRUE</param>\n"
"<print/>\n"
"</inkscape-extension>", new PrintLatex());
return;
}
} /* namespace Internal */
} /* namespace Extension */
} /* namespace Inkscape */
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :