Krita Source Code Documentation
Loading...
Searching...
No Matches
KoPathShapeLoaderPrivate Class Reference

Public Member Functions

void calculateArc (bool relative, qreal &curx, qreal &cury, qreal angle, qreal x, qreal y, qreal r1, qreal r2, bool largeArcFlag, bool sweepFlag)
 
const char * getCoord (const char *, qreal &)
 
const char * getFlag (const char *ptr, bool &flag)
 
 KoPathShapeLoaderPrivate (KoPathShape *p)
 
void parseSvg (const QString &svgInputData, bool process=false)
 
void svgArcTo (qreal x, qreal y, qreal r1, qreal r2, qreal angle, bool largeArcFlag, bool sweepFlag, bool abs=true)
 
void svgClosePath ()
 
void svgCurveToCubic (qreal x1, qreal y1, qreal x2, qreal y2, qreal x, qreal y, bool abs=true)
 
void svgCurveToCubicSmooth (qreal x, qreal y, qreal x2, qreal y2, bool abs=true)
 
void svgCurveToQuadratic (qreal x, qreal y, qreal x1, qreal y1, bool abs=true)
 
void svgCurveToQuadraticSmooth (qreal x, qreal y, bool abs=true)
 
void svgLineTo (qreal x1, qreal y1, bool abs=true)
 
void svgLineToHorizontal (qreal x, bool abs=true)
 
void svgLineToVertical (qreal y, bool abs=true)
 
void svgMoveTo (qreal x1, qreal y1, bool abs=true)
 

Public Attributes

QPointF lastPoint
 
KoPathShapepath
 the path shape to work on
 

Detailed Description

Definition at line 13 of file KoPathShapeLoader.cpp.

Constructor & Destructor Documentation

◆ KoPathShapeLoaderPrivate()

KoPathShapeLoaderPrivate::KoPathShapeLoaderPrivate ( KoPathShape * p)
inline

Definition at line 16 of file KoPathShapeLoader.cpp.

16 : path(p) {
17 Q_ASSERT(path);
18 path->clear();
19 }
const Params2D p
KoPathShape * path
the path shape to work on

Member Function Documentation

◆ calculateArc()

void KoPathShapeLoaderPrivate::calculateArc ( bool relative,
qreal & curx,
qreal & cury,
qreal angle,
qreal x,
qreal y,
qreal r1,
qreal r2,
bool largeArcFlag,
bool sweepFlag )

Definition at line 400 of file KoPathShapeLoader.cpp.

401{
402 // if radii are zero or the endpoints of ellipse are same as its start point, then use lineTo/don't do
403 // anything.
404 if (qFuzzyCompare(rx, 0.0) || qFuzzyCompare(ry, 0.0)
405 || (!relative && qFuzzyCompare(curx - x, 0) && qFuzzyCompare(cury - y, 0))
406 || (relative && qFuzzyCompare(x, 0) && qFuzzyCompare(y, 0))) {
407 qreal x2 = x;
408 qreal y2 = y;
409
410 if (relative) {
411 x2 += curx;
412 y2 += cury;
413 }
414 svgLineTo(x2, y2);
415 return;
416 }
417
418 const qreal angleRadians = angle * (M_PI / 180.0);
419 const qreal sin_th = sin(angleRadians);
420 const qreal cos_th = cos(angleRadians);
421
422 qreal dx;
423 qreal x2 = x;
424 if (!relative) {
425 dx = (curx - x) / 2.0;
426 } else {
427 dx = -(x / 2.0);
428 x2 = curx + x;
429 }
430
431 qreal dy;
432 qreal y2 = y;
433 if (!relative) {
434 dy = (cury - y) / 2.0;
435 } else {
436 dy = -(y / 2.0);
437 y2 = cury + y;
438 }
439
440 // From SVG spec
441
442 // Step 1: Compute (x1_prime, y1_prime)
443 const qreal x1Prime = cos_th * dx + sin_th * dy;
444 const qreal y1Prime = -sin_th * dx + cos_th * dy;
445
446 // eq. 5.1
447 const qreal x1PrimeSq = x1Prime * x1Prime;
448 const qreal y1PrimeSq = y1Prime * y1Prime;
449
450 // Step 2: Compute (c_x_prime, c_y_prime)
451 qreal rxSq = rx * rx;
452 qreal rySq = ry * ry;
453
454 // Spec : check if radii are large enough
455 // eq. 6.2
456 const qreal check = x1PrimeSq / rxSq + y1PrimeSq / rySq;
457 if (check > 1) {
458 // eq. 6.3
459 rx = rx * sqrt(check);
460 ry = ry * sqrt(check);
461
462 rxSq = rx * rx;
463 rySq = ry * ry;
464 }
465
466 // Step 2: Compute (c_x_prime, c_y_prime)
467 const qreal radiiSq = rxSq * rySq;
468 const qreal ellipseValue = rxSq * y1PrimeSq + rySq * x1PrimeSq;
469
470 qreal coef = sqrt(std::fabs((radiiSq - ellipseValue) / ellipseValue));
471 if (sweepFlag == largeArcFlag) {
472 coef = -coef;
473 }
474 // eq. 5.2
475 const qreal cxPrime = coef * (rx * y1Prime) / ry;
476 const qreal cyPrime = coef * -(ry * x1Prime) / rx;
477
478 // Step 3: Compute (c_x, c_y) from (c_x_prime, c_y_prime)
479 // eq. 5.3
480 const qreal cx = cos_th * cxPrime - sin_th * cyPrime + (curx + x2) * 0.5;
481 const qreal cy = sin_th * cxPrime + cos_th * cyPrime + (cury + y2) * 0.5;
482
483 // Step 4: Compute angle and delta
484 const QPointF v = {(x1Prime - cxPrime) / rx, (y1Prime - cyPrime) / ry};
485 // eq. 5.5
486 const qreal theta = KisAlgebra2D::angleBetweenVectors({1.0, 0.0}, v);
487 // eq. 5.6
488 qreal delta = std::fmod(
489 KisAlgebra2D::angleBetweenVectors(v, {(-x1Prime - cxPrime) / rx, (-y1Prime - cyPrime) / ry}),
490 M_PI * 2);
491
492 if (sweepFlag && delta < 0) {
493 delta += (M_PI * 2);
494 } else if (!sweepFlag && delta > 0) {
495 delta -= (M_PI * 2);
496 }
497
498 int n_segs = (int)ceil(fabs(delta / (M_PI * 0.25)));
499
500 // From: http://www.spaceroots.org/documents/ellipse/elliptical-arc.pdf
501 for (int i = 0; i < n_segs; ++i) {
502 const qreal eta1 = theta + i * delta / n_segs;
503 const qreal eta2 = theta + (i + 1) * delta / n_segs;
504
505 const qreal etaHalf = 0.5 * (eta2 - eta1);
506
507 const qreal cosAngle = cos(angleRadians);
508 const qreal sinAngle = sin(angleRadians);
509
510 auto ellipseArcToPoint = [sinAngle, cosAngle](qreal cx, qreal cy, qreal eta, qreal rx, qreal ry) {
511 qreal x = cx + (rx * cosAngle * cos(eta)) - (ry * sinAngle * sin(eta));
512 qreal y = cy + (rx * sinAngle * cos(eta)) + (ry * cosAngle * sin(eta));
513 return QPointF(x, y);
514 };
515 auto ellipseDerivativeArcToPoint = [sinAngle, cosAngle](qreal eta, qreal rx, qreal ry) {
516 qreal x = -(rx * cosAngle * sin(eta)) - (ry * sinAngle * cos(eta));
517 qreal y = -(rx * sinAngle * sin(eta)) + (ry * cosAngle * cos(eta));
518 return QPointF(x, y);
519 };
520
521 // bezier control points
522 const QPointF p1 = ellipseArcToPoint(cx, cy, eta1, rx, ry);
523 const QPointF p2 = ellipseArcToPoint(cx, cy, eta2, rx, ry);
524
525 const qreal alpha = sin(eta2 - eta1) * (sqrt(4 + 3 * tan(etaHalf) * tan(etaHalf)) - 1) / 3;
526
527 const QPointF q1 = p1 + alpha * ellipseDerivativeArcToPoint(eta1, rx, ry);
528 const QPointF q2 = p2 - alpha * ellipseDerivativeArcToPoint(eta2, rx, ry);
529
530 svgCurveToCubic(q1.x(), q1.y(), q2.x(), q2.y(), p2.x(), p2.y());
531 }
532
533 if (!relative)
534 curx = x;
535 else
536 curx += x;
537
538 if (!relative)
539 cury = y;
540 else
541 cury += y;
542}
QPointF q1
qreal v
QPointF p2
QPointF q2
QPointF p1
void svgCurveToCubic(qreal x1, qreal y1, qreal x2, qreal y2, qreal x, qreal y, bool abs=true)
void svgLineTo(qreal x1, qreal y1, bool abs=true)
static bool qFuzzyCompare(half p1, half p2)
#define M_PI
Definition kis_global.h:111
qreal angleBetweenVectors(const QPointF &v1, const QPointF &v2)

References KisAlgebra2D::angleBetweenVectors(), M_PI, p1, p2, q1, q2, qFuzzyCompare(), svgCurveToCubic(), svgLineTo(), and v.

◆ getCoord()

const char * KoPathShapeLoaderPrivate::getCoord ( const char * ptr,
qreal & number )

Definition at line 325 of file KoPathShapeLoader.cpp.

326{
327 int integer, exponent;
328 qreal decimal, frac;
329 int sign, expsign;
330
331 exponent = 0;
332 integer = 0;
333 frac = 1.0;
334 decimal = 0;
335 sign = 1;
336 expsign = 1;
337
338 // read the sign
339 if (*ptr == '+')
340 ++ptr;
341 else if (*ptr == '-') {
342 ++ptr;
343 sign = -1;
344 }
345
346 // read the integer part
347 while (*ptr != '\0' && *ptr >= '0' && *ptr <= '9')
348 integer = (integer * 10) + *(ptr++) - '0';
349 if (*ptr == '.') { // read the decimals
350 ++ptr;
351 while (*ptr != '\0' && *ptr >= '0' && *ptr <= '9')
352 decimal += (*(ptr++) - '0') * (frac *= 0.1);
353 }
354
355 if (*ptr == 'e' || *ptr == 'E') { // read the exponent part
356 ++ptr;
357
358 // read the sign of the exponent
359 if (*ptr == '+')
360 ++ptr;
361 else if (*ptr == '-') {
362 ++ptr;
363 expsign = -1;
364 }
365
366 exponent = 0;
367 while (*ptr != '\0' && *ptr >= '0' && *ptr <= '9') {
368 exponent *= 10;
369 exponent += *ptr - '0';
370 ++ptr;
371 }
372 }
373 number = integer + decimal;
374 number *= sign * pow((qreal)10, qreal(expsign * exponent));
375
376 // skip the following space
377 if (*ptr == ' ')
378 ++ptr;
379
380 return ptr;
381}

References sign().

◆ getFlag()

const char * KoPathShapeLoaderPrivate::getFlag ( const char * ptr,
bool & flag )

Definition at line 383 of file KoPathShapeLoader.cpp.

384{
385 // check for '0' or '1'
386 if (*ptr != '0' && *ptr != '1') {
387 return ptr;
388 }
389 flag = (*ptr == '1');
390 ++ptr;
391
392 if (*ptr == ' ') {
393 ++ptr;
394 }
395 return ptr;
396}

◆ parseSvg()

void KoPathShapeLoaderPrivate::parseSvg ( const QString & svgInputData,
bool process = false )

Definition at line 42 of file KoPathShapeLoader.cpp.

43{
44 if (!s.isEmpty()) {
45 QString d = s;
46 d.replace(',', ' ');
47 d = d.simplified();
48
49 const QByteArray buffer = d.toLatin1();
50 const char *ptr = buffer.constData();
51 const char *end = buffer.constData() + buffer.length() + 1;
52
53 qreal curx = 0.0;
54 qreal cury = 0.0;
55 qreal contrlx, contrly, subpathx, subpathy, tox, toy, x1, y1, x2, y2, xc, yc;
56 qreal px1, py1, px2, py2, px3, py3;
57 bool relative;
58 char command = *(ptr++), lastCommand = ' ';
59
60 subpathx = subpathy = curx = cury = contrlx = contrly = 0.0;
61 while (ptr < end) {
62 if (*ptr == ' ')
63 ++ptr;
64
65 relative = false;
66
67 switch (command) {
68 case 'm':
69 relative = true;
70 Q_FALLTHROUGH();
71 case 'M': {
72 ptr = getCoord(ptr, tox);
73 ptr = getCoord(ptr, toy);
74
75 if (process) {
76 subpathx = curx = relative ? curx + tox : tox;
77 subpathy = cury = relative ? cury + toy : toy;
78
79 svgMoveTo(curx, cury);
80 } else
81 svgMoveTo(tox, toy, !relative);
82 break;
83 }
84 case 'l':
85 relative = true;
86 Q_FALLTHROUGH();
87 case 'L': {
88 ptr = getCoord(ptr, tox);
89 ptr = getCoord(ptr, toy);
90
91 if (process) {
92 curx = relative ? curx + tox : tox;
93 cury = relative ? cury + toy : toy;
94
95 svgLineTo(curx, cury);
96 } else
97 svgLineTo(tox, toy, !relative);
98 break;
99 }
100 case 'h': {
101 ptr = getCoord(ptr, tox);
102 if (process) {
103 curx = curx + tox;
104 svgLineTo(curx, cury);
105 } else
106 svgLineToHorizontal(tox, false);
107 break;
108 }
109 case 'H': {
110 ptr = getCoord(ptr, tox);
111 if (process) {
112 curx = tox;
113 svgLineTo(curx, cury);
114 } else
116 break;
117 }
118 case 'v': {
119 ptr = getCoord(ptr, toy);
120 if (process) {
121 cury = cury + toy;
122 svgLineTo(curx, cury);
123 } else
124 svgLineToVertical(toy, false);
125 break;
126 }
127 case 'V': {
128 ptr = getCoord(ptr, toy);
129 if (process) {
130 cury = toy;
131 svgLineTo(curx, cury);
132 } else
134 break;
135 }
136 case 'z':
137 Q_FALLTHROUGH();
138 case 'Z': {
139 // reset curx, cury for next path
140 if (process) {
141 curx = subpathx;
142 cury = subpathy;
143 }
144 svgClosePath();
145 break;
146 }
147 case 'c':
148 relative = true;
149 Q_FALLTHROUGH();
150 case 'C': {
151 ptr = getCoord(ptr, x1);
152 ptr = getCoord(ptr, y1);
153 ptr = getCoord(ptr, x2);
154 ptr = getCoord(ptr, y2);
155 ptr = getCoord(ptr, tox);
156 ptr = getCoord(ptr, toy);
157
158 if (process) {
159 px1 = relative ? curx + x1 : x1;
160 py1 = relative ? cury + y1 : y1;
161 px2 = relative ? curx + x2 : x2;
162 py2 = relative ? cury + y2 : y2;
163 px3 = relative ? curx + tox : tox;
164 py3 = relative ? cury + toy : toy;
165
166 svgCurveToCubic(px1, py1, px2, py2, px3, py3);
167
168 contrlx = relative ? curx + x2 : x2;
169 contrly = relative ? cury + y2 : y2;
170 curx = relative ? curx + tox : tox;
171 cury = relative ? cury + toy : toy;
172 } else
173 svgCurveToCubic(x1, y1, x2, y2, tox, toy, !relative);
174
175 break;
176 }
177 case 's':
178 relative = true;
179 Q_FALLTHROUGH();
180 case 'S': {
181 ptr = getCoord(ptr, x2);
182 ptr = getCoord(ptr, y2);
183 ptr = getCoord(ptr, tox);
184 ptr = getCoord(ptr, toy);
185 if (!(lastCommand == 'c' || lastCommand == 'C' ||
186 lastCommand == 's' || lastCommand == 'S')) {
187 contrlx = curx;
188 contrly = cury;
189 }
190
191 if (process) {
192 px1 = 2 * curx - contrlx;
193 py1 = 2 * cury - contrly;
194 px2 = relative ? curx + x2 : x2;
195 py2 = relative ? cury + y2 : y2;
196 px3 = relative ? curx + tox : tox;
197 py3 = relative ? cury + toy : toy;
198
199 svgCurveToCubic(px1, py1, px2, py2, px3, py3);
200
201 contrlx = relative ? curx + x2 : x2;
202 contrly = relative ? cury + y2 : y2;
203 curx = relative ? curx + tox : tox;
204 cury = relative ? cury + toy : toy;
205 } else
206 svgCurveToCubicSmooth(x2, y2, tox, toy, !relative);
207 break;
208 }
209 case 'q':
210 relative = true;
211 Q_FALLTHROUGH();
212 case 'Q': {
213 ptr = getCoord(ptr, x1);
214 ptr = getCoord(ptr, y1);
215 ptr = getCoord(ptr, tox);
216 ptr = getCoord(ptr, toy);
217
218 if (process) {
219 px1 = relative ? (curx + 2 * (x1 + curx)) * (1.0 / 3.0) : (curx + 2 * x1) * (1.0 / 3.0);
220 py1 = relative ? (cury + 2 * (y1 + cury)) * (1.0 / 3.0) : (cury + 2 * y1) * (1.0 / 3.0);
221 px2 = relative ? ((curx + tox) + 2 * (x1 + curx)) * (1.0 / 3.0) : (tox + 2 * x1) * (1.0 / 3.0);
222 py2 = relative ? ((cury + toy) + 2 * (y1 + cury)) * (1.0 / 3.0) : (toy + 2 * y1) * (1.0 / 3.0);
223 px3 = relative ? curx + tox : tox;
224 py3 = relative ? cury + toy : toy;
225
226 svgCurveToCubic(px1, py1, px2, py2, px3, py3);
227
228 contrlx = relative ? curx + x1 : x1;
229 contrly = relative ? cury + y1 : y1;
230 curx = relative ? curx + tox : tox;
231 cury = relative ? cury + toy : toy;
232 } else
233 svgCurveToQuadratic(x1, y1, tox, toy, !relative);
234 break;
235 }
236 case 't':
237 relative = true;
238 Q_FALLTHROUGH();
239 case 'T': {
240 ptr = getCoord(ptr, tox);
241 ptr = getCoord(ptr, toy);
242 if (!(lastCommand == 'q' || lastCommand == 'Q' ||
243 lastCommand == 't' || lastCommand == 'T')) {
244 contrlx = curx;
245 contrly = cury;
246 }
247
248 if (process) {
249 xc = 2 * curx - contrlx;
250 yc = 2 * cury - contrly;
251
252 px1 = (curx + 2 * xc) * (1.0 / 3.0);
253 py1 = (cury + 2 * yc) * (1.0 / 3.0);
254 px2 = relative ? ((curx + tox) + 2 * xc) * (1.0 / 3.0) : (tox + 2 * xc) * (1.0 / 3.0);
255 py2 = relative ? ((cury + toy) + 2 * yc) * (1.0 / 3.0) : (toy + 2 * yc) * (1.0 / 3.0);
256 px3 = relative ? curx + tox : tox;
257 py3 = relative ? cury + toy : toy;
258
259 svgCurveToCubic(px1, py1, px2, py2, px3, py3);
260
261 contrlx = xc;
262 contrly = yc;
263 curx = relative ? curx + tox : tox;
264 cury = relative ? cury + toy : toy;
265 } else
266 svgCurveToQuadraticSmooth(tox, toy, !relative);
267 break;
268 }
269 case 'a':
270 relative = true;
271 Q_FALLTHROUGH();
272 case 'A': {
273 bool largeArc = false;
274 bool sweep = false;
275 qreal angle, rx, ry;
276 ptr = getCoord(ptr, rx);
277 ptr = getCoord(ptr, ry);
278 ptr = getCoord(ptr, angle);
279 ptr = getFlag(ptr, largeArc);
280 ptr = getFlag(ptr, sweep);
281 ptr = getCoord(ptr, tox);
282 ptr = getCoord(ptr, toy);
283
284 // Spec: radii are nonnegative numbers
285 rx = fabs(rx);
286 ry = fabs(ry);
287
288 if (process)
289 calculateArc(relative, curx, cury, angle, tox, toy, rx, ry, largeArc, sweep);
290 else
291 svgArcTo(tox, toy, rx, ry, angle, largeArc, sweep, !relative);
292 break;
293 }
294 default: {
295 // when svg parser is used for a parsing an odf path an unknown command
296 // can be encountered, so we stop parsing here
297 debugFlake << "KoSvgPathParser::parseSVG(): unknown command \"" << command << "\"";
298 return;
299 }
300 }
301
302 lastCommand = command;
303
304 if (*ptr == '+' || *ptr == '-' || *ptr == '.' || (*ptr >= '0' && *ptr <= '9')) {
305 // there are still coords in this command
306 if (command == 'M')
307 command = 'L';
308 else if (command == 'm')
309 command = 'l';
310 } else
311 command = *(ptr++);
312
313 if (lastCommand != 'C' && lastCommand != 'c' &&
314 lastCommand != 'S' && lastCommand != 's' &&
315 lastCommand != 'Q' && lastCommand != 'q' &&
316 lastCommand != 'T' && lastCommand != 't') {
317 contrlx = curx;
318 contrly = cury;
319 }
320 }
321 }
322}
#define debugFlake
Definition FlakeDebug.h:15
const char * getFlag(const char *ptr, bool &flag)
void svgCurveToQuadraticSmooth(qreal x, qreal y, bool abs=true)
void svgArcTo(qreal x, qreal y, qreal r1, qreal r2, qreal angle, bool largeArcFlag, bool sweepFlag, bool abs=true)
void svgCurveToQuadratic(qreal x, qreal y, qreal x1, qreal y1, bool abs=true)
void calculateArc(bool relative, qreal &curx, qreal &cury, qreal angle, qreal x, qreal y, qreal r1, qreal r2, bool largeArcFlag, bool sweepFlag)
void svgCurveToCubicSmooth(qreal x, qreal y, qreal x2, qreal y2, bool abs=true)
void svgMoveTo(qreal x1, qreal y1, bool abs=true)
void svgLineToHorizontal(qreal x, bool abs=true)
const char * getCoord(const char *, qreal &)
void svgLineToVertical(qreal y, bool abs=true)

References calculateArc(), debugFlake, getCoord(), getFlag(), svgArcTo(), svgClosePath(), svgCurveToCubic(), svgCurveToCubicSmooth(), svgCurveToQuadratic(), svgCurveToQuadraticSmooth(), svgLineTo(), svgLineToHorizontal(), svgLineToVertical(), and svgMoveTo().

◆ svgArcTo()

void KoPathShapeLoaderPrivate::svgArcTo ( qreal x,
qreal y,
qreal r1,
qreal r2,
qreal angle,
bool largeArcFlag,
bool sweepFlag,
bool abs = true )

Definition at line 627 of file KoPathShapeLoader.cpp.

628{
629 Q_UNUSED(x);
630 Q_UNUSED(y);
631 Q_UNUSED(r1);
632 Q_UNUSED(r2);
633 Q_UNUSED(angle);
634 Q_UNUSED(largeArcFlag);
635 Q_UNUSED(sweepFlag);
636 Q_UNUSED(abs);
637 // TODO implement
638}
QPointF r2
QPointF r1

References r1, and r2.

◆ svgClosePath()

void KoPathShapeLoaderPrivate::svgClosePath ( )

Definition at line 640 of file KoPathShapeLoader.cpp.

641{
642 path->closeMerge();
643}

◆ svgCurveToCubic()

void KoPathShapeLoaderPrivate::svgCurveToCubic ( qreal x1,
qreal y1,
qreal x2,
qreal y2,
qreal x,
qreal y,
bool abs = true )

Definition at line 583 of file KoPathShapeLoader.cpp.

584{
585 QPointF p1, p2;
586 if (abs) {
587 p1 = QPointF(x1, y1);
588 p2 = QPointF(x2, y2);
589 lastPoint = QPointF(x, y);
590 } else {
591 p1 = lastPoint + QPointF(x1, y1);
592 p2 = lastPoint + QPointF(x2, y2);
593 lastPoint += QPointF(x, y);
594 }
595
596 path->curveTo(p1, p2, lastPoint);
597}

References lastPoint, p1, and p2.

◆ svgCurveToCubicSmooth()

void KoPathShapeLoaderPrivate::svgCurveToCubicSmooth ( qreal x,
qreal y,
qreal x2,
qreal y2,
bool abs = true )

Definition at line 599 of file KoPathShapeLoader.cpp.

600{
601 Q_UNUSED(x);
602 Q_UNUSED(y);
603 Q_UNUSED(x2);
604 Q_UNUSED(y2);
605 Q_UNUSED(abs);
606 // TODO implement
607}

◆ svgCurveToQuadratic()

void KoPathShapeLoaderPrivate::svgCurveToQuadratic ( qreal x,
qreal y,
qreal x1,
qreal y1,
bool abs = true )

Definition at line 609 of file KoPathShapeLoader.cpp.

610{
611 Q_UNUSED(x);
612 Q_UNUSED(y);
613 Q_UNUSED(x1);
614 Q_UNUSED(y1);
615 Q_UNUSED(abs);
616 // TODO implement
617}

◆ svgCurveToQuadraticSmooth()

void KoPathShapeLoaderPrivate::svgCurveToQuadraticSmooth ( qreal x,
qreal y,
bool abs = true )

Definition at line 619 of file KoPathShapeLoader.cpp.

620{
621 Q_UNUSED(x);
622 Q_UNUSED(y);
623 Q_UNUSED(abs);
624 // TODO implement
625}

◆ svgLineTo()

void KoPathShapeLoaderPrivate::svgLineTo ( qreal x1,
qreal y1,
bool abs = true )

Definition at line 553 of file KoPathShapeLoader.cpp.

554{
555 if (abs)
556 lastPoint = QPointF(x1, y1);
557 else
558 lastPoint += QPointF(x1, y1);
559
560 path->lineTo(lastPoint);
561}

References lastPoint.

◆ svgLineToHorizontal()

void KoPathShapeLoaderPrivate::svgLineToHorizontal ( qreal x,
bool abs = true )

Definition at line 563 of file KoPathShapeLoader.cpp.

564{
565 if (abs)
566 lastPoint.setX(x);
567 else
568 lastPoint.rx() += x;
569
570 path->lineTo(lastPoint);
571}

References lastPoint.

◆ svgLineToVertical()

void KoPathShapeLoaderPrivate::svgLineToVertical ( qreal y,
bool abs = true )

Definition at line 573 of file KoPathShapeLoader.cpp.

574{
575 if (abs)
576 lastPoint.setY(y);
577 else
578 lastPoint.ry() += y;
579
580 path->lineTo(lastPoint);
581}

References lastPoint.

◆ svgMoveTo()

void KoPathShapeLoaderPrivate::svgMoveTo ( qreal x1,
qreal y1,
bool abs = true )

Definition at line 544 of file KoPathShapeLoader.cpp.

545{
546 if (abs)
547 lastPoint = QPointF(x1, y1);
548 else
549 lastPoint += QPointF(x1, y1);
550 path->moveTo(lastPoint);
551}

References lastPoint.

Member Data Documentation

◆ lastPoint

QPointF KoPathShapeLoaderPrivate::lastPoint

Definition at line 39 of file KoPathShapeLoader.cpp.

◆ path

KoPathShape* KoPathShapeLoaderPrivate::path

the path shape to work on

Definition at line 38 of file KoPathShapeLoader.cpp.


The documentation for this class was generated from the following file: