Krita Source Code Documentation
Loading...
Searching...
No Matches
kis_shape_layer.cc
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2008 Boudewijn Rempt <boud@valdyas.org>
3 * SPDX-FileCopyrightText: 2007 Thomas Zander <zander@kde.org>
4 * SPDX-FileCopyrightText: 2009 Cyrille Berger <cberger@cberger.net>
5 * SPDX-FileCopyrightText: 2011 Jan Hambrecht <jaham@gmx.net>
6 *
7 * SPDX-License-Identifier: GPL-2.0-or-later
8 */
9
10#include "kis_shape_layer.h"
11
12#include <QPainter>
13#include <QPainterPath>
14#include <QRect>
15#include <QDomElement>
16#include <QDomDocument>
17#include <QString>
18#include <QList>
19#include <QMap>
20#include <kis_debug.h>
21#include <kundo2command.h>
23#include <QMimeData>
24
25#include <kis_icon.h>
26#include <KoColorSpace.h>
27#include <KoCompositeOp.h>
28#include <KisDocument.h>
29#include <KoUnit.h>
30#include <KoShapeContainer.h>
31#include <KoShapeLayer.h>
32#include <KoShapeGroup.h>
34#include <KoShapeManager.h>
36#include <KoShapeRegistry.h>
38#include <KoStore.h>
40#include <KoStoreDevice.h>
41#include <KoViewConverter.h>
42#include <KoXmlNS.h>
43#include <KoXmlWriter.h>
44#include <KoSelection.h>
45#include <KoShapeMoveCommand.h>
47#include <KoShapeShadow.h>
49
50#include "SvgWriter.h"
51#include "SvgParser.h"
52
53#include <kis_types.h>
54#include <kis_image.h>
55#include "kis_default_bounds.h"
56#include <kis_paint_device.h>
59#include <kis_painter.h>
60#include "kis_node_visitor.h"
62#include "kis_effect_mask.h"
67#include <QThread>
68#include <QApplication>
69
71
72
75{
76public:
78 : q(parent)
79 {
80 }
81
82 void add(KoShape *child) override {
84
90 if (inheritsTransform(child)) {
91 QTransform parentTransform = q->absoluteTransformation();
92 child->applyAbsoluteTransformation(parentTransform.inverted());
93 }
95 }
96
97 void remove(KoShape *child) override {
99 if (inheritsTransform(child)) {
100 QTransform parentTransform = q->absoluteTransformation();
101 child->applyAbsoluteTransformation(parentTransform);
102 }
103
105 }
106
107 void setResolution(qreal xRes, qreal yRes) {
108 if (!qFuzzyCompare(m_xRes, xRes) || !qFuzzyCompare(m_yRes, yRes)) {
109 m_xRes = xRes;
110 m_yRes = yRes;
111 Q_FOREACH (KoShape *shape, shapes()) {
112 shape->setResolution(xRes, yRes);
113 }
114 }
115 }
116
117private:
119 qreal m_xRes{72.0};
120 qreal m_yRes{72.0};
121};
122
123
143
144
146 KisImageWSP image,
147 const QString &name,
148 quint8 opacity)
149 : KisShapeLayer(controller, image, name, opacity,
150 [&] () { return new KisShapeLayerCanvas(image->colorSpace(), new KisDefaultBounds(image), this);})
151{
152}
153
155 : KisShapeLayer(rhs,
156 rhs.m_d->controller)
157{
158}
159
161 : KisShapeLayer(rhs,
162 controller,
163 [&] () {
164 const KisShapeLayerCanvas* shapeLayerCanvas = dynamic_cast<const KisShapeLayerCanvas*>(rhs.m_d->canvas);
165 KIS_ASSERT(shapeLayerCanvas);
166 return new KisShapeLayerCanvas(*shapeLayerCanvas, this);})
167{
168}
169
171 std::function<KisShapeLayerCanvasBase *()> canvasFactory)
172 : KisExternalLayer(_rhs)
173 , KoShapeLayer(new ShapeLayerContainerModel(this)) //no _rhs here otherwise both layer have the same KoShapeContainerModel
174 , m_d(new Private())
175{
176 initShapeLayerImpl(controller, canvasFactory());
178
183 const QTransform thisInvertedTransform = this->absoluteTransformation().inverted();
184
186
187 Q_FOREACH (KoShape *shape, _rhs.shapes()) {
188 KoShape *clonedShape = shape->cloneShape();
189 KIS_SAFE_ASSERT_RECOVER(clonedShape) { continue; }
190 clonedShape->setTransformation(shape->absoluteTransformation() * thisInvertedTransform);
191 addShape(clonedShape);
192 }
193
195}
196
198 : KisExternalLayer(_rhs)
199 , KoShapeLayer(new ShapeLayerContainerModel(this)) //no _merge here otherwise both layer have the same KoShapeContainerModel
200 , m_d(new Private())
201{
202 // Make sure our new layer is visible otherwise the shapes cannot be painted.
203 setVisible(true);
204
206
207 const KisShapeLayerCanvas* shapeLayerCanvas = dynamic_cast<const KisShapeLayerCanvas*>(_rhs.canvas());
208 KIS_ASSERT(shapeLayerCanvas);
209 initShapeLayerImpl(_rhs.m_d->controller, new KisShapeLayerCanvas(*shapeLayerCanvas, this));
210
216 const QTransform thisInvertedTransform = this->absoluteTransformation().inverted();
217
218 QList<KoShape *> shapesAbove;
219 QList<KoShape *> shapesBelow;
220
221 // copy in _rhs's shapes
222 Q_FOREACH (KoShape *shape, _rhs.shapes()) {
223 KoShape *clonedShape = shape->cloneShape();
224 KIS_SAFE_ASSERT_RECOVER(clonedShape) { continue; }
225 clonedShape->setTransformation(shape->absoluteTransformation() * thisInvertedTransform);
226 shapesBelow.append(clonedShape);
227 }
228
229 // copy in _addShapes's shapes
230 Q_FOREACH (KoShape *shape, _addShapes.shapes()) {
231 KoShape *clonedShape = shape->cloneShape();
232 KIS_SAFE_ASSERT_RECOVER(clonedShape) { continue; }
233 clonedShape->setTransformation(shape->absoluteTransformation() * thisInvertedTransform);
234 shapesAbove.append(clonedShape);
235 }
236
238 KoShapeReorderCommand::mergeDownShapes(shapesBelow, shapesAbove);
240 cmd.redo();
241
242 Q_FOREACH (KoShape *shape, shapesBelow + shapesAbove) {
243 addShape(shape);
244 }
245}
246
248 KisImageWSP image,
249 const QString &name,
250 quint8 opacity,
251 std::function<KisShapeLayerCanvasBase *()> canvasFactory)
252 : KisExternalLayer(image, name, opacity)
254 , m_d(new Private())
255{
256 initShapeLayerImpl(controller, canvasFactory());
257}
258
260{
265
266 Q_FOREACH (KoShape *shape, shapes()) {
267 shape->setParent(0);
268 delete shape;
269 }
270
271 delete m_d->canvas;
272 delete m_d;
273}
274
277{
278 setSupportsLodMoves(false);
280
282
284
285 m_d->canvas = canvas;
286 m_d->canvas->moveToThread(this->thread());
287 m_d->controller = controller;
288
289 m_d->canvas->shapeManager()->selection()->disconnect(this);
290
293 this, SIGNAL(currentLayerChanged(const KoShapeLayer*)));
294
295 connect(this, SIGNAL(sigMoveShapes(QPointF)), SLOT(slotMoveShapes(QPointF)));
296
299 model->setAssociatedRootShapeManager(m_d->canvas->shapeManager());
300
301 if (this->image()) {
302 m_d->imageConnections.addUniqueConnection(this->image(), SIGNAL(sigResolutionChanged(double, double)), this, SLOT(slotImageResolutionChanged()));
304 }
305}
306
308{
309 return node->inherits("KisMask");
310}
311
313{
315 KisLayer::setImage(_image);
316 m_d->canvas->setImage(_image);
317 if (m_d->paintDevice) {
319 }
320 if (_image) {
321 m_d->imageConnections.addUniqueConnection(_image, SIGNAL(sigResolutionChanged(double, double)), this, SLOT(slotImageResolutionChanged()));
323 }
324}
325
326
335
337{
338 Q_FOREACH (const KisBaseNode::Property &property, properties) {
339 if (property.name == i18n("Anti-aliasing")) {
340 setAntialiased(property.state.toBool());
341 }
342 }
343
345}
346
348{
349 KisShapeLayer *prevShape = dynamic_cast<KisShapeLayer*>(prevLayer.data());
350
351 if (prevShape)
352 return new KisShapeLayer(*prevShape, *this);
353 else
355}
356
357void KisShapeLayer::fillMergedLayerTemplate(KisLayerSP dstLayer, KisLayerSP prevLayer, bool skipPaintingThisLayer)
358{
359 if (!dynamic_cast<KisShapeLayer*>(dstLayer.data())) {
360 KisLayer::fillMergedLayerTemplate(dstLayer, prevLayer, skipPaintingThisLayer);
361 }
362}
363
365{
366 Q_UNUSED(parent);
368}
369
371{
372 return KisIconUtils::loadIcon("vectorLayer");
373}
374
379
381{
382 return 0;
383}
384
386{
387 return kisGrowRect(m_d->canvas->viewConverter()->documentToView(this->boundingRect()).toAlignedRect(), 1);
388}
389
390qint32 KisShapeLayer::x() const
391{
392 return m_d->x;
393}
394
395qint32 KisShapeLayer::y() const
396{
397 return m_d->y;
398}
399
401{
402 qint32 delta = x - this->x();
403 QPointF diff = QPointF(m_d->canvas->viewConverter()->viewToDocumentX(delta), 0);
404 Q_EMIT sigMoveShapes(diff);
405
406 // Save new value to satisfy LSP
407 m_d->x = x;
408}
409
411{
412 qint32 delta = y - this->y();
413 QPointF diff = QPointF(0, m_d->canvas->viewConverter()->viewToDocumentY(delta));
414 Q_EMIT sigMoveShapes(diff);
415
416 // Save new value to satisfy LSP
417 m_d->y = y;
418}
419namespace {
420void filterTransformableShapes(QList<KoShape*> &shapes)
421{
422 auto it = shapes.begin();
423 while (it != shapes.end()) {
424 if (shapes.size() == 1) break;
425
426 if ((*it)->inheritsTransformFromAny(shapes)) {
427 it = shapes.erase(it);
428 } else {
429 ++it;
430 }
431 }
432}
433}
434
436{
438
439 // We expect that **all** the shapes inherit the transform from its parent
440
441 // SANITY_CHECK: we expect all the shapes inside the
442 // shape layer to inherit transform!
443 Q_FOREACH (KoShape *shape, shapes) {
444 if (shape->parent()) {
446 break;
447 }
448 }
449 }
450
451 shapes << this;
452 filterTransformableShapes(shapes);
453 return shapes;
454}
455
456void KisShapeLayer::slotMoveShapes(const QPointF &diff)
457{
459 if (shapes.isEmpty()) return;
460
461 KoShapeMoveCommand cmd(shapes, diff);
462 cmd.redo();
463}
464
465void KisShapeLayer::slotTransformShapes(const QTransform &newTransform)
466{
467 KoShapeTransformCommand cmd({this}, {transformation()}, {newTransform});
468 cmd.redo();
469}
470
472{
473 return visitor.visit(this);
474}
475
477{
478 return visitor.visit(this, undoAdapter);
479}
480
485
487{
488 return m_d->canvas->viewConverter();
489}
490
491bool KisShapeLayer::visible(bool recursive) const
492{
493 return KisExternalLayer::visible(recursive);
494}
495
496void KisShapeLayer::setVisible(bool visible, bool isLoading)
497{
498 const bool oldVisible = this->visible(false);
499
502
503 if (visible && !oldVisible &&
505
507 }
508}
509
515
516bool KisShapeLayer::isShapeEditable(bool recursive) const
517{
518 return KoShapeLayer::isShapeEditable(recursive) && isEditable(true);
519}
520
521// we do not override KoShape::setGeometryProtected() as we consider
522// the user not being able to access the layer shape from Krita UI!
523
528
533
538
543
544bool KisShapeLayer::saveShapesToStore(KoStore *store, QList<KoShape *> shapes, const QSizeF &sizeInPt)
545{
546 if (!store->open("content.svg")) {
547 return false;
548 }
549
550 KoStoreDevice storeDev(store);
551 storeDev.open(QIODevice::WriteOnly);
552
553 std::sort(shapes.begin(), shapes.end(), KoShape::compareShapeZIndex);
554
555 SvgWriter writer(shapes);
556 writer.save(storeDev, sizeInPt);
557
558 if (!store->close()) {
559 return false;
560 }
561
562 return true;
563}
564
565QList<KoShape *> KisShapeLayer::createShapesFromSvg(QIODevice *device, const QString &baseXmlDir, const QRectF &rectInPixels, qreal resolutionPPI, KoDocumentResourceManager *resourceManager, bool loadingFromKra, QSizeF *fragmentSize, QStringList *warnings, QStringList *errors)
566{
567
568 QString errorMsg;
569 int errorLine = 0;
570 int errorColumn;
571
572 QDomDocument doc = SvgParser::createDocumentFromSvg(device, &errorMsg, &errorLine, &errorColumn);
573 if (doc.isNull()) {
574 errKrita << "Parsing error in contents.svg! Aborting!" << Qt::endl
575 << " In line: " << errorLine << ", column: " << errorColumn << Qt::endl
576 << " Error message: " << errorMsg << Qt::endl;
577
578 if (errors) {
579 *errors << i18n("Parsing error in the main document at line %1, column %2\nError message: %3"
580 , errorLine , errorColumn , errorMsg);
581 }
582 return QList<KoShape*>();
583 }
584
585 SvgParser parser(resourceManager);
586 parser.setXmlBaseDir(baseXmlDir);
587 parser.setResolution(rectInPixels /* px */, resolutionPPI /* ppi */);
588
589 if (loadingFromKra) {
598 parser.setDefaultKraTextVersion(1);
599 }
600
601 QList<KoShape *> result = parser.parseSvg(doc.documentElement(), fragmentSize);
602
603 if (warnings) {
604 *warnings = parser.warnings();
605 }
606
607 return result;
608}
609
610
612{
613 // FIXME: we handle xRes() only!
614
615 const QSizeF sizeInPx = image()->bounds().size();
616 const QSizeF sizeInPt(sizeInPx.width() / image()->xRes(), sizeInPx.height() / image()->yRes());
617
618 return saveShapesToStore(store, this->shapes(), sizeInPt);
619}
620
621bool KisShapeLayer::loadSvg(QIODevice *device, const QString &baseXmlDir, QStringList *warnings)
622{
623 QSizeF fragmentSize; // unused!
624 KisImageSP image = this->image();
625
626 // FIXME: we handle xRes() only!
628 const qreal resolutionPPI = 72.0 * image->xRes();
629
631 createShapesFromSvg(device, baseXmlDir,
632 image->bounds(), resolutionPPI,
634 true,
635 &fragmentSize,
636 warnings);
637
638 Q_FOREACH (KoShape *shape, shapes) {
639 addShape(shape);
640 }
641
642 return true;
643}
644
646{
647 if (!store) {
648 warnKrita << "No store backend";
649 return false;
650 }
651
652 if (store->open("content.svg")) {
653 KoStoreDevice storeDev(store);
654 storeDev.open(QIODevice::ReadOnly);
655
656 loadSvg(&storeDev, "", warnings);
657
658 store->close();
659
660 return true;
661 }
662
663 return false;
664
665}
666
668{
670}
671
673{
674 QPoint oldPos(x(), y());
675 QPoint newPos = oldPos - rect.topLeft();
676
677 return new KisNodeMoveCommand2(this, oldPos, newPos);
678}
679
681{
682public:
683 TransformShapeLayerDeferred(KisShapeLayer *shapeLayer, const QTransform &globalDocTransform)
684 : m_shapeLayer(shapeLayer),
685 m_globalDocTransform(globalDocTransform),
686 m_blockingConnection(std::bind(&KisShapeLayer::slotTransformShapes, shapeLayer, std::placeholders::_1))
687 {
688 }
689
690 void undo() override
691 {
692 KIS_SAFE_ASSERT_RECOVER_NOOP(QThread::currentThread() != qApp->thread());
694 }
695
696 void redo() override
697 {
699
700 const QTransform globalTransform = m_shapeLayer->absoluteTransformation();
701 const QTransform localTransform = globalTransform * m_globalDocTransform * globalTransform.inverted();
702
703 KIS_SAFE_ASSERT_RECOVER_NOOP(QThread::currentThread() != qApp->thread());
705 }
706
707private:
712};
713
714
715KUndo2Command* KisShapeLayer::transform(const QTransform &transform)
716{
718 if (shapes.isEmpty()) return 0;
719 KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE(shapes.size() == 1 && shapes.first() == this, 0);
720
725 const KisImageViewConverter *converter = dynamic_cast<const KisImageViewConverter*>(this->converter());
726 KIS_ASSERT(converter);
727 QTransform docSpaceTransform = converter->documentToView() *
729
730 return new TransformShapeLayerDeferred(this, docSpaceTransform);
731}
732
734{
735 using namespace KisDoSomethingCommandOps;
736
737 KUndo2Command *cmd = new KUndo2Command();
739 m_d->paintDevice->setProfile(profile, cmd);
741
742 return cmd;
743}
744
745KUndo2Command *KisShapeLayer::convertTo(const KoColorSpace *dstColorSpace, KoColorConversionTransformation::Intent renderingIntent, KoColorConversionTransformation::ConversionFlags conversionFlags)
746{
747 using namespace KisDoSomethingCommandOps;
748
749 KUndo2Command *cmd = new KUndo2Command();
751 m_d->paintDevice->convertTo(dstColorSpace, renderingIntent, conversionFlags, cmd);
753 return cmd;
754}
755
760
765
767{
770 if (this->image()) {
771 model->setResolution(image()->xRes() * 72.0, image()->yRes() * 72.0);
772 }
773}
774
775
777{
778 return m_d->isAntialiased;
779}
780
781void KisShapeLayer::setAntialiased(const bool antialiased)
782{
783 const bool oldAntialiased = m_d->isAntialiased;
784
785 if (antialiased != oldAntialiased) {
787 // is it the best way to rerender the vector layer?
789 }
790}
float value(const T *src, size_t ch)
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
const KoColorSpace * colorSpace() const
double xRes() const
double yRes() const
QRect bounds() const override
static KisBaseNode::Property getProperty(const KoID &id, bool state)
virtual bool visit(KisNode *node)=0
void setDefaultBounds(KisDefaultBoundsBaseSP bounds)
bool setProfile(const KoColorProfile *profile, KUndo2Command *parentCommand)
void convertTo(const KoColorSpace *dstColorSpace, KoColorConversionTransformation::Intent renderingIntent=KoColorConversionTransformation::internalRenderingIntent(), KoColorConversionTransformation::ConversionFlags conversionFlags=KoColorConversionTransformation::internalConversionFlags(), KUndo2Command *parentCommand=nullptr, KoUpdater *progressUpdater=nullptr)
virtual void visit(KisNode *node, KisUndoAdapter *undoAdapter)=0
virtual KisPaintDeviceSP projection() const =0
virtual bool hasPendingUpdates() const =0
const KoViewConverter * viewConverter() const override
virtual void setImage(KisImageWSP image)
virtual void resetCache(const KoColorSpace *colorSpace)=0
virtual void forceRepaint()=0
virtual void rerenderAfterBeingInvisible()=0
KoShapeManager * shapeManager() const override
virtual void forceRepaintWithHiddenAreas()
KoSelectedShapesProxy * selectedShapesProxy() const override
selectedShapesProxy() is a special interface for keeping a persistent connections to selectionChanged...
QRect theoreticalBoundingRect() const override
KUndo2Command * crop(const QRect &rect) override
KisLayerSP createMergedLayerTemplate(KisLayerSP prevLayer) override
void setSectionModelProperties(const KisBaseNode::PropertyList &properties) override
bool antialiased() const
void fillMergedLayerTemplate(KisLayerSP dstLayer, KisLayerSP prevLayer, bool skipPaintingThisLayer) override
void slotMoveShapes(const QPointF &diff)
bool saveLayer(KoStore *store) const
void setVisible(bool visible, bool isLoading=false) override
KoShapeManager * shapeManager() const
void selectionChanged()
void setY(qint32) override
void setParent(KoShapeContainer *parent)
bool accept(KisNodeVisitor &) override
Private *const m_d
void setX(qint32) override
QList< KoShape * > shapesToBeTransformed()
bool loadLayer(KoStore *store, QStringList *warnings=0)
qint32 y() const override
bool isShapeEditable(bool recursive) const override
checks recursively if the shape or one of its parents is not visible or locked
static QList< KoShape * > createShapesFromSvg(QIODevice *device, const QString &baseXmlDir, const QRectF &rectInPixels, qreal resolutionPPI, KoDocumentResourceManager *resourceManager, bool loadingFromKra, QSizeF *fragmentSize, QStringList *warnings=0, QStringList *errors=0)
void slotTransformShapes(const QTransform &transform)
void resetCache(const KoColorSpace *colorSpace) override
KisPaintDeviceSP original() const override
KisShapeLayer(KoShapeControllerBase *shapeController, KisImageWSP image, const QString &name, quint8 opacity)
KisPaintDeviceSP paintDevice() const override
friend class TransformShapeLayerDeferred
void initShapeLayerImpl(KoShapeControllerBase *controller, KisShapeLayerCanvasBase *overrideCanvas)
KoSelectedShapesProxy * selectedShapesProxy()
selectedShapesProxy
void setUserLocked(bool value) override
static bool saveShapesToStore(KoStore *store, QList< KoShape * > shapes, const QSizeF &sizeInPt)
void currentLayerChanged(const KoShapeLayer *layer)
bool hasPendingTimedUpdates() const override
KUndo2Command * convertTo(const KoColorSpace *dstColorSpace, KoColorConversionTransformation::Intent renderingIntent=KoColorConversionTransformation::internalRenderingIntent(), KoColorConversionTransformation::ConversionFlags conversionFlags=KoColorConversionTransformation::internalConversionFlags()) override
void slotImageResolutionChanged()
QIcon icon() const override
void sigMoveShapes(const QPointF &diff)
KUndo2Command * setProfile(const KoColorProfile *profile) override
KisShapeLayerCanvasBase * canvas() const
KoShapeControllerBase * shapeController() const
KisBaseNode::PropertyList sectionModelProperties() const override
qint32 x() const override
bool allowAsChild(KisNodeSP) const override
void setImage(KisImageWSP image) override
const KoViewConverter * converter() const
bool visible(bool recursive=false) const override
~KisShapeLayer() override
void setAntialiased(const bool antialiased)
bool loadSvg(QIODevice *device, const QString &baseXmlDir, QStringList *warnings=0)
void forceUpdateHiddenAreaOnOriginal() override
void forceUpdateTimedNode() override
void addUniqueConnection(Sender sender, Signal signal, Receiver receiver, Method method)
The KoSelectedShapesProxy class is a special interface of KoCanvasBase to have a stable connection to...
QList< KoShape * > shapes() const
void addShape(KoShape *shape)
bool inheritsTransform(const KoShape *shape) const
KoShapeContainerModel * model
virtual KoDocumentResourceManager * resourceManager() const
QList< KoShape * > shapes
void setUpdatesBlocked(bool value)
KoSelection * selection
The undo / redo command for shape moving.
void redo() override
redo the command
This command allows you to change the zIndex of a number of shapes.
static QList< IndexedShape > mergeDownShapes(QList< KoShape * > shapesBelow, QList< KoShape * > shapesAbove)
void redo() override
redo the command
void redo() override
redo the command
KoShapeContainer * parent
Definition KoShape_p.h:80
virtual bool isShapeEditable(bool recursive=true) const
checks recursively if the shape or one of its parents is not visible or locked
Definition KoShape.cpp:1165
void applyAbsoluteTransformation(const QTransform &matrix)
Definition KoShape.cpp:400
virtual void setResolution(qreal xRes, qreal yRes)
Definition KoShape.cpp:1416
static bool compareShapeZIndex(KoShape *s1, KoShape *s2)
Definition KoShape.cpp:434
KoShapeContainer * parent() const
Definition KoShape.cpp:1039
QTransform absoluteTransformation() const
Definition KoShape.cpp:382
void setTransformation(const QTransform &matrix)
Definition KoShape.cpp:417
virtual KoShape * cloneShape() const
creates a deep copy of the shape or shape's subtree
Definition KoShape.cpp:200
QTransform transformation() const
Returns the shapes local transformation matrix.
Definition KoShape.cpp:424
void setGeometryProtected(bool on)
Definition KoShape.cpp:1019
void setVisible(bool on)
Definition KoShape.cpp:972
void setParent(KoShapeContainer *parent)
Definition KoShape.cpp:535
void setShapeId(const QString &id)
Definition KoShape.cpp:1062
QTransform transform() const
return the current matrix that contains the rotation/scale/position of this shape
Definition KoShape.cpp:1145
bool open(OpenMode m) override
bool close()
Definition KoStore.cpp:156
bool open(const QString &name)
Definition KoStore.cpp:109
virtual qreal viewToDocumentY(qreal viewY) const
virtual qreal viewToDocumentX(qreal viewX) const
virtual QPointF viewToDocument(const QPointF &viewPoint) const
virtual QPointF documentToView(const QPointF &documentPoint) const
void add(KoShape *child) override
void remove(KoShape *child) override
void setResolution(qreal xRes, qreal yRes)
ShapeLayerContainerModel(KisShapeLayer *parent)
void add(KoShape *child) override
QList< KoShape * > shapes() const override
void remove(KoShape *shape) override
bool inheritsTransform(const KoShape *shape) const override
static QDomDocument createDocumentFromSvg(QIODevice *device, QString *errorMsg=0, int *errorLine=0, int *errorColumn=0)
void setXmlBaseDir(const QString &baseDir)
Sets the initial xml base directory (the directory form where the file is read)
QStringList warnings() const
QList< KoShape * > parseSvg(const QDomElement &e, QSizeF *fragmentSize=0)
Parses a svg fragment, returning the list of top level child shapes.
void setResolution(const QRectF boundsInPixels, qreal pixelsPerInch)
void setDefaultKraTextVersion(int version)
Implements exporting shapes to SVG.
Definition SvgWriter.h:33
bool save(QIODevice &outputDevice, const QSizeF &pageSize)
Writes svg to specified output device.
Definition SvgWriter.cpp:82
TransformShapeLayerDeferred(KisShapeLayer *shapeLayer, const QTransform &globalDocTransform)
KisSafeBlockingQueueConnectionProxy< QTransform > m_blockingConnection
static bool qFuzzyCompare(half p1, half p2)
#define KIS_SAFE_ASSERT_RECOVER(cond)
Definition kis_assert.h:126
#define KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE(cond, val)
Definition kis_assert.h:129
#define KIS_SAFE_ASSERT_RECOVER_RETURN(cond)
Definition kis_assert.h:128
#define KIS_ASSERT_RECOVER_RETURN(cond)
Definition kis_assert.h:75
#define KIS_SAFE_ASSERT_RECOVER_NOOP(cond)
Definition kis_assert.h:130
#define KIS_ASSERT(cond)
Definition kis_assert.h:33
#define errKrita
Definition kis_debug.h:107
#define warnKrita
Definition kis_debug.h:87
T kisGrowRect(const T &rect, U offset)
Definition kis_global.h:186
const QString KIS_SHAPE_LAYER_ID
QIcon loadIcon(const QString &name)
void setSupportsLodMoves(bool value)
virtual void setUserLocked(bool l)
bool isEditable(bool checkVisibility=true) const
virtual void setVisible(bool visible, bool loading=false)
KoProperties properties
KisImageWSP image
virtual bool visible(bool recursive=false) const
void setImage(KisImageWSP image) override
Definition kis_layer.cc:378
virtual void fillMergedLayerTemplate(KisLayerSP dstLayer, KisLayerSP prevLayer, bool skipPaintingThisLayer=false)
Definition kis_layer.cc:416
virtual KisLayerSP createMergedLayerTemplate(KisLayerSP prevLayer)
Definition kis_layer.cc:401
const KoColorSpace * colorSpace() const override
returns the image's colorSpace or null, if there is no image
Definition kis_layer.cc:225
void setSectionModelProperties(const KisBaseNode::PropertyList &properties) override
Definition kis_layer.cc:297
KisBaseNode::PropertyList sectionModelProperties() const override
Definition kis_layer.cc:272
KisShapeLayerCanvasBase * canvas
KisSignalAutoConnectionsStore imageConnections
KisPaintDeviceSP paintDevice
KoShapeControllerBase * controller