58 const gchar * fn =
nullptr;
60 gsize bytesWritten = 0;
61 GError* error =
nullptr;
63 os.
setf(std::ios::fixed);
64 fn = mod->get_param_string(
"destination");
65 gchar* local_fn = g_filename_from_utf8( fn,
66 -1, &bytesRead, &bytesWritten, &error);
75 while (isspace(*fn)) fn += 1;
79 fprintf(stderr,
"inkscape: fopen(%s): %s\n", fn, strerror(errno));
88 res = fprintf(
_stream,
"%%LaTeX with PSTricks extensions\n");
93 g_warning(
"Error %d on output stream: %s", errno,
96 g_warning(
"Printing failed");
111 os <<
"%%Please note this file requires PSTricks extensions\n";
113 os <<
"\\psset{xunit=.5pt,yunit=.5pt,runit=.5pt}\n";
121 return fprintf(
_stream,
"%s", os.
str().c_str());
127 fprintf(
_stream,
"\\end{pspicture}\n");
164 if (style->
fill.isColor()) {
168 os.
setf(std::ios::fixed);
170 fill_opacity=SP_SCALE24_TO_FLOAT(style->
fill_opacity.value);
172 os <<
"{\n\\newrgbcolor{curcolor}{" <<
rgb[0] <<
" " <<
rgb[1] <<
" " <<
rgb[2] <<
"}\n";
173 os <<
"\\pscustom[linestyle=none,fillstyle=solid,fillcolor=curcolor";
174 if (fill_opacity!=1.0) {
175 os <<
",opacity="<<fill_opacity;
198 if (style->
stroke.isColor()) {
202 os.
setf(std::ios::fixed);
206 os <<
"{\n\\newrgbcolor{curcolor}{" <<
rgb[0] <<
" " <<
rgb[1] <<
" " <<
rgb[2] <<
"}\n";
208 os <<
"\\pscustom[linewidth=" << style->
stroke_width.computed*
scale<<
",linecolor=curcolor";
210 if (stroke_opacity!=1.0) {
211 os<<
",strokeopacity="<<stroke_opacity;
215 os <<
",linestyle=dashed,dash=";
240 if (pathv_in.
empty())
249 for(
const auto & it : pathv) {
251 os <<
"\\moveto(" << it.initialPoint()[
Geom::X] <<
"," << it.initialPoint()[
Geom::Y] <<
")\n";
258 os <<
"\\closepath\n";
272 os <<
"\\lineto(" <<
c.finalPoint()[X] <<
"," <<
c.finalPoint()[Y] <<
")\n";
275 std::vector<Geom::Point> points = cubic_bezier->controlPoints();
276 os <<
"\\curveto(" << points[1][X] <<
"," << points[1][Y] <<
")("
277 << points[2][X] <<
"," << points[2][Y] <<
")("
278 << points[3][X] <<
"," << points[3][Y] <<
")\n";
284 for(
const auto & iter : sbasis_path) {
303 "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI
"\">\n"
304 "<name>" N_(
"LaTeX Print")
"</name>\n"
305 "<id>" SP_MODULE_KEY_PRINT_LATEX
"</id>\n"
306 "<param gui-hidden=\"true\" name=\"destination\" type=\"string\"></param>\n"
307 "<param gui-hidden=\"true\" name=\"textToPath\" type=\"bool\">true</param>\n"
309 "</inkscape-extension>", std::make_unique<PrintLatex>());
3x3 matrix representing an affine transformation.
Coord descrim() const
Calculate the descriminant.
Bezier curve with compile-time specified order.
Abstract continuous curve on a plane defined on [0,1].
Axis-aligned rectangle that can be empty.
bool empty() const
Check whether the vector contains any paths.
Sequence of contiguous curves, aka spline.
bool get_param_bool(char const *name) const
Gets a parameter identified by name with the bool placed in value.
unsigned int setup(Inkscape::Extension::Print *module) override
bool textToPath(Inkscape::Extension::Print *ext) override
Tell the printing engine whether text should be text or path.
void print_pathvector(SVGOStringStream &os, Geom::PathVector const &pathv_in, const Geom::Affine &)
void print_2geomcurve(SVGOStringStream &os, Geom::Curve const &c)
std::stack< Geom::Affine > m_tr_stack
unsigned int finish(Inkscape::Extension::Print *module) override
unsigned int begin(Inkscape::Extension::Print *module, SPDocument *doc) override
unsigned int release(Inkscape::Extension::Print *module) override
unsigned int bind(Inkscape::Extension::Print *module, Geom::Affine const &transform, float opacity) override
unsigned int stroke(Inkscape::Extension::Print *module, Geom::PathVector const &pathv, Geom::Affine const &ctm, SPStyle const *style, Geom::OptRect const &pbox, Geom::OptRect const &dbox, Geom::OptRect const &bbox) override
unsigned int fill(Inkscape::Extension::Print *module, Geom::PathVector const &pathv, Geom::Affine const &ctm, SPStyle const *style, Geom::OptRect const &pbox, Geom::OptRect const &dbox, Geom::OptRect const &bbox) override
std::ios::fmtflags setf(std::ios::fmtflags fmtfl)
double value(Unit const *u) const
Return the quantity's value in the specified unit.
Typed SVG document implementation.
Inkscape::Util::Quantity getWidth() const
Inkscape::Util::Quantity getHeight() const
T< SPAttr::FILL, SPIPaint > fill
fill
T< SPAttr::STROKE_DASHARRAY, SPIDashArray > stroke_dasharray
stroke-dasharray
T< SPAttr::STROKE, SPIPaint > stroke
stroke
T< SPAttr::STROKE_WIDTH, SPILength > stroke_width
stroke-width
T< SPAttr::FILL_OPACITY, SPIScale24 > fill_opacity
fill-opacity
T< SPAttr::STROKE_OPACITY, SPIScale24 > stroke_opacity
stroke-opacity
A way to clear the N_ macro, which is defined as an inline function.
Specific curve type functions for Inkscape, not provided by lib2geom.
bool is_straight_curve(Geom::BezierCurve const &c)
Mini static library that contains the version of Inkscape.
Path cubicbezierpath_from_sbasis(D2< SBasis > const &B, double tol)
void build_from_mem(gchar const *buffer, std::unique_ptr< Implementation::Implementation > in_imp)
Create a module from a buffer holding an XML description.
void dump_fopen_call(char const *utf8name, char const *id)
FILE * fopen_utf8name(char const *utf8name, char const *mode)
Open a file with g_fopen().
Helper class to stream background task notifications as a series of messages.
char const * version_string
full version string
PathVector - a sequence of subpaths.
Conversion between SBasis and Bezier basis polynomials.
SPStyle - a style object for SPItem objects.