latex-pstricks.cpp revision c751b68e56ace7b9d649ee20b7f25ed1f65922e3
/*
* LaTeX Printing
*
* Author:
* Michael Forbes <miforbes@mbhs.edu>
* Abhishek Sharma
*
* Copyright (C) 2004 Authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <errno.h>
#include <signal.h>
#include "helper/geom-curves.h"
#include "latex-pstricks.h"
#include "sp-item.h"
#include "style.h"
#include "document.h"
#include <cstring>
namespace Inkscape {
namespace Extension {
namespace Internal {
PrintLatex::PrintLatex (void):
_width(0),
_height(0),
{
}
PrintLatex::~PrintLatex (void)
{
/* restore default signal handling for SIGPIPE */
#endif
return;
}
{
return TRUE;
}
{
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;
}
}
/* 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
}
m_tr_stack.push( Geom::Scale(1, -1) * Geom::Translate(0, doc->getHeight())); /// @fixme hardcoded doc2dt transform
}
{
if (_stream) {
// Flush stream to be sure.
}
return 0;
}
unsigned int PrintLatex::bind(Inkscape::Extension::Print * /*mod*/, Geom::Affine const &transform, float /*opacity*/)
{
if (!m_tr_stack.empty()) {
} else {
}
return 1;
}
{
m_tr_stack.pop();
return 1;
}
const char * comment)
{
if (!_stream) {
return 0; // XXX: fixme, returning -1 as unsigned.
}
}
{
if (!_stream) {
return 0; // XXX: fixme, returning -1 as unsigned.
}
float rgb[3];
float fill_opacity;
os << "\\pscustom[linestyle=none,fillstyle=solid,fillcolor=curcolor";
if (fill_opacity!=1.0) {
}
os << "]\n{\n";
os << "}\n}\n";
}
return 0;
}
{
if (!_stream) {
return 0; // XXX: fixme, returning -1 as unsigned.
}
float rgb[3];
float stroke_opacity;
if (stroke_opacity!=1.0) {
}
if (style->stroke_dasharray_set &&
int i;
os << ",linestyle=dashed,dash=";
if ((i)) {
os << " ";
}
}
}
os <<"]\n{\n";
os << "}\n}\n";
}
return 0;
}
// FIXME: why is 'transform' argument not used?
void
PrintLatex::print_pathvector(SVGOStringStream &os, Geom::PathVector const &pathv_in, const Geom::Affine & /*transform*/)
{
return;
// Geom::Affine tf=transform; // why was this here?
Geom::PathVector pathv = pathv_in * tf_stack; // generates new path, which is a bit slow, but this doesn't have to be performance optimized
os << "\\newpath\n";
}
os << "\\closepath\n";
}
}
}
void
{
using Geom::X;
using Geom::Y;
if( is_straight_curve(c) )
{
}
}
else {
//this case handles sbasis as well as all other curve types
}
}
}
bool
{
}
#include "clear-n_.h"
void PrintLatex::init(void)
{
/* SVG in */
"<param name=\"destination\" type=\"string\"></param>\n"
"<param name=\"textToPath\" type=\"boolean\">true</param>\n"
"<print/>\n"
"</inkscape-extension>", new PrintLatex());
}
} /* 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:fileencoding=utf-8:textwidth=99 :