Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
metafile-print.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
/*
5 * Authors:
6 * Krzysztof KosiƄski <tweenk.pl@gmail.com>
7 *
8 * Copyright (C) 2013 Authors
9 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
10 */
11
12#ifndef SEEN_INKSCAPE_EXTENSION_INTERNAL_METAFILE_PRINT_H
13#define SEEN_INKSCAPE_EXTENSION_INTERNAL_METAFILE_PRINT_H
14
15#include <map>
16#include <stack>
17
18#include <glibmm/ustring.h>
20#include <2geom/affine.h>
21#include <2geom/pathvector.h>
22
23#include "colors/color.h"
25
26#include "style-enums.h" // Fill rule
27#include "livarot/LivarotDefs.h" // FillRule
28
29class SPGradient;
30class SPObject;
31
32namespace Inkscape {
33class Pixbuf;
34
35namespace Extension {
36namespace Internal {
37
38U_COLORREF toColorRef(std::optional<Colors::Color> color);
40
42 double f1; //Vertical (rotating) offset factor (* font height)
43 double f2; //Vertical (nonrotating) offset factor (* font height)
44 double f3; //Horizontal (nonrotating) offset factor (* font height)
45};
46
49{
50public:
51 PrintMetafile() = default;
52 ~PrintMetafile() override;
53
54 bool textToPath (Inkscape::Extension::Print * ext) override;
55 unsigned int bind(Inkscape::Extension::Print *module, Geom::Affine const &transform, float opacity) override;
56 unsigned int release(Inkscape::Extension::Print *module) override;
57
58protected:
59 struct GRADVALUES {
60 Geom::Point p1; // center or start
61 Geom::Point p2; // xhandle or end
62 Geom::Point p3; // yhandle or unused
63 double r; // radius or unused
64 void *grad; // to access the stops information
65 int mode; // DRAW_LINEAR_GRADIENT or DRAW_RADIAL_GRADIENT, if GRADVALUES is valid, else any value
66 U_COLORREF bgc; // document background color, this is as good a place as any to keep it
67 float rgb[3]; // also background color, but as 0-1 float.
68 };
69
70 double _width;
71 double _height;
72 double _doc_unit_scale; // to pixels, regardless of the document units
73
75
77 uint32_t hpolyfillmode; // used to minimize redundant records that set this
78 std::optional<Inkscape::Colors::Color> htextcolor_rgb; // used to minimize redundant records that set this
79
80 std::stack<Geom::Affine> m_tr_stack;
86 bool usebk;
87
89
90 static void _lookup_ppt_fontfix(Glib::ustring const &fontname, FontfixParams &);
91 static U_COLORREF _gethexcolor(uint32_t color);
92 static uint32_t _translate_weight(unsigned inkweight);
93
97
98 void hatch_classify(char *name, int *hatchType, U_COLORREF *hatchColor, U_COLORREF *bkColor);
99 void brush_classify(SPObject *parent, int depth, Inkscape::Pixbuf const **epixbuf, int *hatchType, U_COLORREF *hatchColor, U_COLORREF *bkColor);
100 static void swapRBinRGBA(char *px, int pixels);
101
102 int hold_gradient(void *gr, int mode);
103 static int snprintf_dots(char * s, size_t n, const char * format, ...);
104 static Geom::PathVector center_ellipse_as_SVG_PathV(Geom::Point ctr, double rx, double ry, double F);
105 static Geom::PathVector center_elliptical_ring_as_SVG_PathV(Geom::Point ctr, double rx1, double ry1, double rx2, double ry2, double F);
106 static Geom::PathVector center_elliptical_hole_as_SVG_PathV(Geom::Point ctr, double rx, double ry, double F);
109
110 virtual int create_brush(SPStyle const *style, PU_COLORREF fcolor) = 0;
111 virtual void destroy_brush() = 0;
112 virtual int create_pen(SPStyle const *style, const Geom::Affine &transform) = 0;
113 virtual void destroy_pen() = 0;
114};
115
116} // namespace Internal
117} // namespace Extension
118} // namespace Inkscape
119
120#endif
121
122/*
123 Local Variables:
124 mode:c++
125 c-file-style:"stroustrup"
126 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
127 indent-tabs-mode:nil
128 fill-column:99
129 End:
130*/
131// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
TODO: insert short description here.
FillRule
Definition LivarotDefs.h:67
3x3 affine transformation matrix.
3x3 matrix representing an affine transformation.
Definition affine.h:70
Sequence of subpaths.
Definition pathvector.h:122
Two-dimensional point that doubles as a vector.
Definition point.h:66
Base class for all implementations of modules.
static int snprintf_dots(char *s, size_t n, const char *format,...)
void brush_classify(SPObject *parent, int depth, Inkscape::Pixbuf const **epixbuf, int *hatchType, U_COLORREF *hatchColor, U_COLORREF *bkColor)
static void swapRBinRGBA(char *px, int pixels)
bool textToPath(Inkscape::Extension::Print *ext) override
Tell the printing engine whether text should be text or path.
virtual int create_brush(SPStyle const *style, PU_COLORREF fcolor)=0
static Geom::PathVector rect_cutter(Geom::Point ctr, Geom::Point pos, Geom::Point neg, Geom::Point width)
std::optional< Inkscape::Colors::Color > htextcolor_rgb
static U_COLORREF _gethexcolor(uint32_t color)
virtual int create_pen(SPStyle const *style, const Geom::Affine &transform)=0
unsigned int release(Inkscape::Extension::Print *module) override
static uint32_t _translate_weight(unsigned inkweight)
static void _lookup_ppt_fontfix(Glib::ustring const &fontname, FontfixParams &)
static Geom::PathVector center_elliptical_ring_as_SVG_PathV(Geom::Point ctr, double rx1, double ry1, double rx2, double ry2, double F)
unsigned int bind(Inkscape::Extension::Print *module, Geom::Affine const &transform, float opacity) override
static FillRule SPWR_to_LVFR(SPWindRule wr)
U_COLORREF weight_colors(U_COLORREF c1, U_COLORREF c2, double t)
void hatch_classify(char *name, int *hatchType, U_COLORREF *hatchColor, U_COLORREF *bkColor)
static Geom::PathVector center_elliptical_hole_as_SVG_PathV(Geom::Point ctr, double rx, double ry, double F)
static Geom::PathVector center_ellipse_as_SVG_PathV(Geom::Point ctr, double rx, double ry, double F)
Class to hold image data for raster images.
Definition cairo-utils.h:31
Gradient.
Definition sp-gradient.h:86
SPObject is an abstract base class of all of the document nodes at the SVG document level.
Definition sp-object.h:160
An SVG style object.
Definition style.h:45
static char const *const parent
Definition dir-util.cpp:70
U_COLORREF toColorRef(std::optional< Colors::Color > color)
Helper class to stream background task notifications as a series of messages.
int mode
PathVector - a sequence of subpaths.
WMF manual 2.2.2.8.
Definition uemf.h:474
WMF manual 2.2.2.19.
Definition uemf.h:576
SPStyle enums: named public enums that correspond to SVG property values.
SPWindRule
Definition style-enums.h:23
double width
Glib::ustring name
Definition toolbars.cpp:55
Structures, definitions, and function prototypes for EMF files.