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
48#include "SvgWriter.h"
49#include "SvgParser.h"
50
51#include <kis_types.h>
52#include <kis_image.h>
53#include "kis_default_bounds.h"
54#include <kis_paint_device.h>
57#include <kis_painter.h>
58#include "kis_node_visitor.h"
60#include "kis_effect_mask.h"
65#include <QThread>
66#include <QApplication>
67
69
70
73{
74public:
76 : q(parent)
77 {
78 }
79
80 void add(KoShape *child) override {
82
88 if (inheritsTransform(child)) {
89 QTransform parentTransform = q->absoluteTransformation();
90 child->applyAbsoluteTransformation(parentTransform.inverted());
91 }
93 }
94
95 void remove(KoShape *child) override {
97 if (inheritsTransform(child)) {
98 QTransform parentTransform = q->absoluteTransformation();
99 child->applyAbsoluteTransformation(parentTransform);
100 }
101
103 }
104
105 void setResolution(qreal xRes, qreal yRes) {
106 if (!qFuzzyCompare(m_xRes, xRes) || !qFuzzyCompare(m_yRes, yRes)) {
107 m_xRes = xRes;
108 m_yRes = yRes;
109 Q_FOREACH (KoShape *shape, shapes()) {
110 shape->setResolution(xRes, yRes);
111 }
112 }
113 }
114
115private:
117 qreal m_xRes{72.0};
118 qreal m_yRes{72.0};
119};
120
121
141
142
144 KisImageWSP image,
145 const QString &name,
146 quint8 opacity)
147 : KisShapeLayer(controller, image, name, opacity,
148 [&] () { return new KisShapeLayerCanvas(image->colorSpace(), new KisDefaultBounds(image), this);})
149{
150}
151
153 : KisShapeLayer(rhs,
154 rhs.m_d->controller)
155{
156}
157
159 : KisShapeLayer(rhs,
160 controller,
161 [&] () {
162 const KisShapeLayerCanvas* shapeLayerCanvas = dynamic_cast<const KisShapeLayerCanvas*>(rhs.m_d->canvas);
163 KIS_ASSERT(shapeLayerCanvas);
164 return new KisShapeLayerCanvas(*shapeLayerCanvas, this);})
165{
166}
167
169 std::function<KisShapeLayerCanvasBase *()> canvasFactory)
170 : KisExternalLayer(_rhs)
171 , KoShapeLayer(new ShapeLayerContainerModel(this)) //no _rhs here otherwise both layer have the same KoShapeContainerModel
172 , m_d(new Private())
173{
174 initShapeLayerImpl(controller, canvasFactory());
176
181 const QTransform thisInvertedTransform = this->absoluteTransformation().inverted();
182
184
185 Q_FOREACH (KoShape *shape, _rhs.shapes()) {
186 KoShape *clonedShape = shape->cloneShape();
187 KIS_SAFE_ASSERT_RECOVER(clonedShape) { continue; }
188 clonedShape->setTransformation(shape->absoluteTransformation() * thisInvertedTransform);
189 addShape(clonedShape);
190 }
191
193}
194
196 : KisExternalLayer(_rhs)
197 , KoShapeLayer(new ShapeLayerContainerModel(this)) //no _merge here otherwise both layer have the same KoShapeContainerModel
198 , m_d(new Private())
199{
200 // Make sure our new layer is visible otherwise the shapes cannot be painted.
201 setVisible(true);
202
204
205 const KisShapeLayerCanvas* shapeLayerCanvas = dynamic_cast<const KisShapeLayerCanvas*>(_rhs.canvas());
206 KIS_ASSERT(shapeLayerCanvas);
207 initShapeLayerImpl(_rhs.m_d->controller, new KisShapeLayerCanvas(*shapeLayerCanvas, this));
208
214 const QTransform thisInvertedTransform = this->absoluteTransformation().inverted();
215
216 QList<KoShape *> shapesAbove;
217 QList<KoShape *> shapesBelow;
218
219 // copy in _rhs's shapes
220 Q_FOREACH (KoShape *shape, _rhs.shapes()) {
221 KoShape *clonedShape = shape->cloneShape();
222 KIS_SAFE_ASSERT_RECOVER(clonedShape) { continue; }
223 clonedShape->setTransformation(shape->absoluteTransformation() * thisInvertedTransform);
224 shapesBelow.append(clonedShape);
225 }
226
227 // copy in _addShapes's shapes
228 Q_FOREACH (KoShape *shape, _addShapes.shapes()) {
229 KoShape *clonedShape = shape->cloneShape();
230 KIS_SAFE_ASSERT_RECOVER(clonedShape) { continue; }
231 clonedShape->setTransformation(shape->absoluteTransformation() * thisInvertedTransform);
232 shapesAbove.append(clonedShape);
233 }
234
236 KoShapeReorderCommand::mergeDownShapes(shapesBelow, shapesAbove);
238 cmd.redo();
239
240 Q_FOREACH (KoShape *shape, shapesBelow + shapesAbove) {
241 addShape(shape);
242 }
243}
244
246 KisImageWSP image,
247 const QString &name,
248 quint8 opacity,
249 std::function<KisShapeLayerCanvasBase *()> canvasFactory)
250 : KisExternalLayer(image, name, opacity)
252 , m_d(new Private())
253{
254 initShapeLayerImpl(controller, canvasFactory());
255}
256
258{
263
264 Q_FOREACH (KoShape *shape, shapes()) {
265 shape->setParent(0);
266 delete shape;
267 }
268
269 delete m_d->canvas;
270 delete m_d;
271}
272
275{
276 setSupportsLodMoves(false);
278
280
282
283 m_d->canvas = canvas;
284 m_d->canvas->moveToThread(this->thread());
285 m_d->controller = controller;
286
287 m_d->canvas->shapeManager()->selection()->disconnect(this);
288
289 connect(m_d->canvas->selectedShapesProxy(), SIGNAL(selectionChanged()), this, SIGNAL(selectionChanged()));
291 this, SIGNAL(currentLayerChanged(const KoShapeLayer*)));
292
293 connect(this, SIGNAL(sigMoveShapes(QPointF)), SLOT(slotMoveShapes(QPointF)));
294
297 model->setAssociatedRootShapeManager(m_d->canvas->shapeManager());
298
299 if (this->image()) {
300 m_d->imageConnections.addUniqueConnection(this->image(), SIGNAL(sigResolutionChanged(double, double)), this, SLOT(slotImageResolutionChanged()));
302 }
303}
304
306{
307 return node->inherits("KisMask");
308}
309
311{
313 KisLayer::setImage(_image);
314 m_d->canvas->setImage(_image);
315 if (m_d->paintDevice) {
317 }
318 if (_image) {
319 m_d->imageConnections.addUniqueConnection(_image, SIGNAL(sigResolutionChanged(double, double)), this, SLOT(slotImageResolutionChanged()));
321 }
322}
323
324
333
335{
336 Q_FOREACH (const KisBaseNode::Property &property, properties) {
337 if (property.name == i18n("Anti-aliasing")) {
338 setAntialiased(property.state.toBool());
339 }
340 }
341
343}
344
346{
347 KisShapeLayer *prevShape = dynamic_cast<KisShapeLayer*>(prevLayer.data());
348
349 if (prevShape)
350 return new KisShapeLayer(*prevShape, *this);
351 else
353}
354
355void KisShapeLayer::fillMergedLayerTemplate(KisLayerSP dstLayer, KisLayerSP prevLayer, bool skipPaintingThisLayer)
356{
357 if (!dynamic_cast<KisShapeLayer*>(dstLayer.data())) {
358 KisLayer::fillMergedLayerTemplate(dstLayer, prevLayer, skipPaintingThisLayer);
359 }
360}
361
363{
364 Q_UNUSED(parent);
366}
367
369{
370 return KisIconUtils::loadIcon("vectorLayer");
371}
372
377
379{
380 return 0;
381}
382
384{
385 return kisGrowRect(m_d->canvas->viewConverter()->documentToView(this->boundingRect()).toAlignedRect(), 1);
386}
387
388qint32 KisShapeLayer::x() const
389{
390 return m_d->x;
391}
392
393qint32 KisShapeLayer::y() const
394{
395 return m_d->y;
396}
397
399{
400 qint32 delta = x - this->x();
401 QPointF diff = QPointF(m_d->canvas->viewConverter()->viewToDocumentX(delta), 0);
402 Q_EMIT sigMoveShapes(diff);
403
404 // Save new value to satisfy LSP
405 m_d->x = x;
406}
407
409{
410 qint32 delta = y - this->y();
411 QPointF diff = QPointF(0, m_d->canvas->viewConverter()->viewToDocumentY(delta));
412 Q_EMIT sigMoveShapes(diff);
413
414 // Save new value to satisfy LSP
415 m_d->y = y;
416}
417namespace {
418void filterTransformableShapes(QList<KoShape*> &shapes)
419{
420 auto it = shapes.begin();
421 while (it != shapes.end()) {
422 if (shapes.size() == 1) break;
423
424 if ((*it)->inheritsTransformFromAny(shapes)) {
425 it = shapes.erase(it);
426 } else {
427 ++it;
428 }
429 }
430}
431}
432
434{
436
437 // We expect that **all** the shapes inherit the transform from its parent
438
439 // SANITY_CHECK: we expect all the shapes inside the
440 // shape layer to inherit transform!
441 Q_FOREACH (KoShape *shape, shapes) {
442 if (shape->parent()) {
444 break;
445 }
446 }
447 }
448
449 shapes << this;
450 filterTransformableShapes(shapes);
451 return shapes;
452}
453
454void KisShapeLayer::slotMoveShapes(const QPointF &diff)
455{
457 if (shapes.isEmpty()) return;
458
459 KoShapeMoveCommand cmd(shapes, diff);
460 cmd.redo();
461}
462
463void KisShapeLayer::slotTransformShapes(const QTransform &newTransform)
464{
465 KoShapeTransformCommand cmd({this}, {transformation()}, {newTransform});
466 cmd.redo();
467}
468
470{
471 return visitor.visit(this);
472}
473
475{
476 return visitor.visit(this, undoAdapter);
477}
478
483
485{
486 return m_d->canvas->viewConverter();
487}
488
489bool KisShapeLayer::visible(bool recursive) const
490{
491 return KisExternalLayer::visible(recursive);
492}
493
494void KisShapeLayer::setVisible(bool visible, bool isLoading)
495{
496 const bool oldVisible = this->visible(false);
497
500
501 if (visible && !oldVisible &&
503
505 }
506}
507
513
514bool KisShapeLayer::isShapeEditable(bool recursive) const
515{
516 return KoShapeLayer::isShapeEditable(recursive) && isEditable(true);
517}
518
519// we do not override KoShape::setGeometryProtected() as we consider
520// the user not being able to access the layer shape from Krita UI!
521
526
531
536
541
542bool KisShapeLayer::saveShapesToStore(KoStore *store, QList<KoShape *> shapes, const QSizeF &sizeInPt)
543{
544 if (!store->open("content.svg")) {
545 return false;
546 }
547
548 KoStoreDevice storeDev(store);
549 storeDev.open(QIODevice::WriteOnly);
550
551 std::sort(shapes.begin(), shapes.end(), KoShape::compareShapeZIndex);
552
553 SvgWriter writer(shapes);
554 writer.save(storeDev, sizeInPt);
555
556 if (!store->close()) {
557 return false;
558 }
559
560 return true;
561}
562
563QList<KoShape *> KisShapeLayer::createShapesFromSvg(QIODevice *device, const QString &baseXmlDir, const QRectF &rectInPixels, qreal resolutionPPI, KoDocumentResourceManager *resourceManager, bool loadingFromKra, QSizeF *fragmentSize, QStringList *warnings, QStringList *errors)
564{
565
566 QString errorMsg;
567 int errorLine = 0;
568 int errorColumn;
569
570 QDomDocument doc = SvgParser::createDocumentFromSvg(device, &errorMsg, &errorLine, &errorColumn);
571 if (doc.isNull()) {
572 errKrita << "Parsing error in contents.svg! Aborting!" << Qt::endl
573 << " In line: " << errorLine << ", column: " << errorColumn << Qt::endl
574 << " Error message: " << errorMsg << Qt::endl;
575
576 if (errors) {
577 *errors << i18n("Parsing error in the main document at line %1, column %2\nError message: %3"
578 , errorLine , errorColumn , errorMsg);
579 }
580 return QList<KoShape*>();
581 }
582
583 SvgParser parser(resourceManager);
584 parser.setXmlBaseDir(baseXmlDir);
585 parser.setResolution(rectInPixels /* px */, resolutionPPI /* ppi */);
586
587 if (loadingFromKra) {
596 parser.setDefaultKraTextVersion(1);
597 }
598
599 QList<KoShape *> result = parser.parseSvg(doc.documentElement(), fragmentSize);
600
601 if (warnings) {
602 *warnings = parser.warnings();
603 }
604
605 return result;
606}
607
608
610{
611 // FIXME: we handle xRes() only!
612
613 const QSizeF sizeInPx = image()->bounds().size();
614 const QSizeF sizeInPt(sizeInPx.width() / image()->xRes(), sizeInPx.height() / image()->yRes());
615
616 return saveShapesToStore(store, this->shapes(), sizeInPt);
617}
618
619bool KisShapeLayer::loadSvg(QIODevice *device, const QString &baseXmlDir, QStringList *warnings)
620{
621 QSizeF fragmentSize; // unused!
622 KisImageSP image = this->image();
623
624 // FIXME: we handle xRes() only!
626 const qreal resolutionPPI = 72.0 * image->xRes();
627
629 createShapesFromSvg(device, baseXmlDir,
630 image->bounds(), resolutionPPI,
632 true,
633 &fragmentSize,
634 warnings);
635
636 Q_FOREACH (KoShape *shape, shapes) {
637 addShape(shape);
638 }
639
640 return true;
641}
642
644{
645 if (!store) {
646 warnKrita << "No store backend";
647 return false;
648 }
649
650 if (store->open("content.svg")) {
651 KoStoreDevice storeDev(store);
652 storeDev.open(QIODevice::ReadOnly);
653
654 loadSvg(&storeDev, "", warnings);
655
656 store->close();
657
658 return true;
659 }
660
661 return false;
662
663}
664
666{
668}
669
671{
672 QPoint oldPos(x(), y());
673 QPoint newPos = oldPos - rect.topLeft();
674
675 return new KisNodeMoveCommand2(this, oldPos, newPos);
676}
677
679{
680public:
681 TransformShapeLayerDeferred(KisShapeLayer *shapeLayer, const QTransform &globalDocTransform)
682 : m_shapeLayer(shapeLayer),
683 m_globalDocTransform(globalDocTransform),
684 m_blockingConnection(std::bind(&KisShapeLayer::slotTransformShapes, shapeLayer, std::placeholders::_1))
685 {
686 }
687
688 void undo() override
689 {
690 KIS_SAFE_ASSERT_RECOVER_NOOP(QThread::currentThread() != qApp->thread());
692 }
693
694 void redo() override
695 {
697
698 const QTransform globalTransform = m_shapeLayer->absoluteTransformation();
699 const QTransform localTransform = globalTransform * m_globalDocTransform * globalTransform.inverted();
700
701 KIS_SAFE_ASSERT_RECOVER_NOOP(QThread::currentThread() != qApp->thread());
703 }
704
705private:
710};
711
712
713KUndo2Command* KisShapeLayer::transform(const QTransform &transform)
714{
716 if (shapes.isEmpty()) return 0;
717 KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE(shapes.size() == 1 && shapes.first() == this, 0);
718
723 const KisImageViewConverter *converter = dynamic_cast<const KisImageViewConverter*>(this->converter());
724 KIS_ASSERT(converter);
725 QTransform docSpaceTransform = converter->documentToView() *
727
728 return new TransformShapeLayerDeferred(this, docSpaceTransform);
729}
730
732{
733 using namespace KisDoSomethingCommandOps;
734
735 KUndo2Command *cmd = new KUndo2Command();
737 m_d->paintDevice->setProfile(profile, cmd);
739
740 return cmd;
741}
742
743KUndo2Command *KisShapeLayer::convertTo(const KoColorSpace *dstColorSpace, KoColorConversionTransformation::Intent renderingIntent, KoColorConversionTransformation::ConversionFlags conversionFlags)
744{
745 using namespace KisDoSomethingCommandOps;
746
747 KUndo2Command *cmd = new KUndo2Command();
749 m_d->paintDevice->convertTo(dstColorSpace, renderingIntent, conversionFlags, cmd);
751 return cmd;
752}
753
758
763
765{
768 if (this->image()) {
769 model->setResolution(image()->xRes() * 72.0, image()->yRes() * 72.0);
770 }
771}
772
773
775{
776 return m_d->isAntialiased;
777}
778
779void KisShapeLayer::setAntialiased(const bool antialiased)
780{
781 const bool oldAntialiased = m_d->isAntialiased;
782
783 if (antialiased != oldAntialiased) {
785 // is it the best way to rerender the vector layer?
787 }
788}
float value(const T *src, size_t ch)
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:95
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:970
void applyAbsoluteTransformation(const QTransform &matrix)
Definition KoShape.cpp:353
virtual void setResolution(qreal xRes, qreal yRes)
Definition KoShape.cpp:1213
static bool compareShapeZIndex(KoShape *s1, KoShape *s2)
Definition KoShape.cpp:393
KoShapeContainer * parent() const
Definition KoShape.cpp:862
QTransform absoluteTransformation() const
Definition KoShape.cpp:335
void setTransformation(const QTransform &matrix)
Definition KoShape.cpp:374
virtual KoShape * cloneShape() const
creates a deep copy of the shape or shape's subtree
Definition KoShape.cpp:172
QTransform transformation() const
Returns the shapes local transformation matrix.
Definition KoShape.cpp:383
void setGeometryProtected(bool on)
Definition KoShape.cpp:842
void setVisible(bool on)
Definition KoShape.cpp:795
void setParent(KoShapeContainer *parent)
Definition KoShape.cpp:464
void setShapeId(const QString &id)
Definition KoShape.cpp:885
QTransform transform() const
return the current matrix that contains the rotation/scale/position of this shape
Definition KoShape.cpp:950
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