/*
6 * Krzysztof KosiĆski <tweenk.pl@gmail.com>
8 * Copyright (C) 2013 Authors
9 * Released under GNU GPL v2+, read the file
'COPYING' for more information.
15#include <glibmm/miscutils.h>
38 return U_RGBA(255 *
c[0], 255 *
c[1], 255 *
c[2], 255 *
c[3]);
46 static std::map<Glib::ustring, FontfixParams> _ppt_fixable_fonts;
48 if (_ppt_fixable_fonts.empty()) {
49 _ppt_fixable_fonts = {
51 {{
"Arial"}, { 0.05, -0.055, -0.065}},
52 {{
"Times New Roman"}, { 0.05, -0.055, -0.065}},
53 {{
"Lucida Sans"}, {-0.025, -0.055, -0.065}},
54 {{
"Sans"}, { 0.05, -0.055, -0.065}},
55 {{
"Microsoft Sans Serif"}, {-0.05, -0.055, -0.065}},
56 {{
"Serif"}, { 0.05, -0.055, -0.065}},
57 {{
"Garamond"}, { 0.05, -0.055, -0.065}},
58 {{
"Century Schoolbook"}, { 0.25, 0.025, 0.025}},
59 {{
"Verdana"}, { 0.025, 0.0, 0.0}},
60 {{
"Tahoma"}, { 0.045, 0.025, 0.025}},
61 {{
"Symbol"}, { 0.025, 0.0, 0.0}},
62 {{
"Wingdings"}, { 0.05, 0.0, 0.0}},
63 {{
"Zapf Dingbats"}, { 0.025, 0.0, 0.0}},
64 {{
"Convert To Symbol"}, { 0.025, 0.0, 0.0}},
65 {{
"Convert To Wingdings"}, { 0.05, 0.0, 0.0}},
66 {{
"Convert To Zapf Dingbats"}, { 0.025, 0.0, 0.0}},
67 {{
"Sylfaen"}, { 0.1, 0.0, 0.0}},
68 {{
"Palatino Linotype"}, { 0.175, 0.125, 0.125}},
69 {{
"Segoe UI"}, { 0.1, 0.0, 0.0}},
73 return _ppt_fixable_fonts;
104 auto it = fixable_fonts.find(fontname);
105 if (it != fixable_fonts.end()) {
114 (color >> 16) & 0xFF,
135 default:
return U_FW_NORMAL;
142 return v1 * op + v2 * (1.0 - op);
179#define clrweight(a,b,t) ((1-t)*((double) a) + (t)*((double) b))
181 t = ( t > 1.0 ? 1.0 : ( t < 0.0 ? 0.0 : t));
191 if (
result.Reserved != 255) {
210 if (0 != strncmp(&
name[1],
"MFhatch", 7)) {
216 val = 10 * val + *
name -
'0';
220 if (*
name !=
'_' || val > U_HS_DITHEREDBKCLR) {
224 if (2 != sscanf(
name,
"%X_%X", &hcolor, &bcolor)) {
225 if (1 != sscanf(
name,
"%X", &hcolor)) {
236 if (*hatchType > U_HS_SOLIDCLR) {
237 *hatchType = U_HS_SOLIDCLR;
253 *hatchColor = U_RGB(0, 0, 0);
254 *bkColor = U_RGB(255, 255, 255);
258 if (is<SPPattern>(
parent)) {
259 for (
auto pat_i = cast_unsafe<SPPattern>(
parent); pat_i; pat_i = pat_i->ref.getObject()) {
261 strncpy(temp, pat_i->getAttribute(
"id"),
sizeof(temp)-1);
262 temp[
sizeof(temp)-1] =
'\0';
264 if (*hatchType != -1) {
269 for (
auto&
child: pat_i->children) {
270 if (*epixbuf || *hatchType != -1) {
276 }
else if (
auto img = cast<SPImage>(
parent)) {
277 *epixbuf = img->pixbuf.get();
281 if (*epixbuf || *hatchType != -1) {
293 for (
int i = 0; i < pixels * 4; px += 4, i += 4) {
326 g_error(
"Fatal programming error, hold_gradient() in metafile-print.cpp called with invalid draw mode");
357 double x1, y1, x2, y2;
360 x1 = ctr[X] + cos(F) * rx * cos(0) + sin(-F) * ry * sin(0);
361 y1 = ctr[Y] + sin(F) * rx * cos(0) + cos(F) * ry * sin(0);
362 x2 = ctr[X] + cos(F) * rx * cos(M_PI) + sin(-F) * ry * sin(M_PI);
363 y2 = ctr[Y] + sin(F) * rx * cos(M_PI) + cos(F) * ry * sin(M_PI);
366 snprintf(
text, 256,
" M %f,%f A %f %f %f 0 0 %f %f A %f %f %f 0 0 %f %f z",
367 x1, y1, rx, ry, F * 360. / (2.*M_PI), x2, y2, rx, ry, F * 360. / (2.*M_PI), x1, y1);
380 double x11, y11, x12, y12;
381 double x21, y21, x22, y22;
382 double degrot = F * 360. / (2.*M_PI);
384 x11 = ctr[X] + cos(F) * rx1 * cos(0) + sin(-F) * ry1 * sin(0);
385 y11 = ctr[Y] + sin(F) * rx1 * cos(0) + cos(F) * ry1 * sin(0);
386 x12 = ctr[X] + cos(F) * rx1 * cos(M_PI) + sin(-F) * ry1 * sin(M_PI);
387 y12 = ctr[Y] + sin(F) * rx1 * cos(M_PI) + cos(F) * ry1 * sin(M_PI);
389 x21 = ctr[X] + cos(F) * rx2 * cos(0) + sin(-F) * ry2 * sin(0);
390 y21 = ctr[Y] + sin(F) * rx2 * cos(0) + cos(F) * ry2 * sin(0);
391 x22 = ctr[X] + cos(F) * rx2 * cos(M_PI) + sin(-F) * ry2 * sin(M_PI);
392 y22 = ctr[Y] + sin(F) * rx2 * cos(M_PI) + cos(F) * ry2 * sin(M_PI);
395 snprintf(
text, 512,
" M %f,%f A %f %f %f 0 1 %f %f A %f %f %f 0 1 %f %f z M %f,%f A %f %f %f 0 0 %f %f A %f %f %f 0 0 %f %f z",
396 x11, y11, rx1, ry1, degrot, x12, y12, rx1, ry1, degrot, x11, y11,
397 x21, y21, rx2, ry2, degrot, x22, y22, rx2, ry2, degrot, x21, y21);
408 double x1, y1, x2, y2;
411 x1 = ctr[X] + cos(F) * rx * cos(0) + sin(-F) * ry * sin(0);
412 y1 = ctr[Y] + sin(F) * rx * cos(0) + cos(F) * ry * sin(0);
413 x2 = ctr[X] + cos(F) * rx * cos(M_PI) + sin(-F) * ry * sin(M_PI);
414 y2 = ctr[Y] + sin(F) * rx * cos(M_PI) + cos(F) * ry * sin(M_PI);
417 snprintf(
text, 256,
" M %f,%f A %f %f %f 0 0 %f %f A %f %f %f 0 0 %f %f z M 50000,50000 50000,-50000 -50000,-50000 -50000,50000 z",
418 x1, y1, rx, ry, F * 360. / (2.*M_PI), x2, y2, rx, ry, F * 360. / (2.*M_PI), x1, y1);
3x3 matrix representing an affine transformation.
void push_back(Path const &path)
Append a path at the end.
Sequence of contiguous curves, aka spline.
void close(bool closed=true)
Set whether the path is closed.
void appendNew(Args &&... args)
Append a new curve to the path.
void start(Point const &p)
Two-dimensional point that doubles as a vector.
bool get_param_bool(char const *name) const
Gets a parameter identified by name with the bool placed in value.
virtual unsigned text(Inkscape::Extension::Print *, char const *, Geom::Point const &, SPStyle const *)
Class to hold image data for raster images.
SPGradientVector vector
Linear and Radial Gradients.
Geom::Affine gradientTransform
gradientTransform attribute
unsigned int gradientTransform_set
SPObject is an abstract base class of all of the document nodes at the SVG document level.
static char const *const parent
void parse_svg_path(char const *str, PathSink &sink)
Feed SVG path data to the specified sink.
float opweight(float v1, float v2, float op)
U_COLORREF toColorRef(std::optional< Colors::Color > color)
static std::map< Glib::ustring, FontfixParams > const & get_ppt_fixable_fonts()
Helper class to stream background task notifications as a series of messages.
TODO: insert short description here.
SVG <image> implementation.
TODO: insert short description here.
SVG <pattern> implementation.
TODO: insert short description here.
std::vector< SPGradientStop > stops
uint8_t Red
Red color (0-255)
uint8_t Reserved
Not used.
uint8_t Blue
Blue color (0-255)
uint8_t Green
Green color (0-255)
SPStyle - a style object for SPItem objects.
parse SVG path specifications