13#include <QPainterPath>
16#include <QDomDocument>
68#include <QApplication>
226 shapesBelow.append(clonedShape);
234 shapesAbove.append(clonedShape);
242 Q_FOREACH (
KoShape *shape, shapesBelow + shapesAbove) {
286 m_d->
canvas->moveToThread(this->thread());
309 return node->inherits(
"KisMask");
339 if (property.
name == i18n(
"Anti-aliasing")) {
402 qint32 delta =
x - this->
x();
412 qint32 delta =
y - this->
y();
422 auto it = shapes.begin();
423 while (it != shapes.end()) {
424 if (shapes.size() == 1)
break;
426 if ((*it)->inheritsTransformFromAny(shapes)) {
427 it = shapes.erase(it);
452 filterTransformableShapes(
shapes);
459 if (
shapes.isEmpty())
return;
473 return visitor.
visit(
this);
478 return visitor.
visit(
this, undoAdapter);
498 const bool oldVisible = this->
visible(
false);
546 if (!store->
open(
"content.svg")) {
551 storeDev.
open(QIODevice::WriteOnly);
556 writer.
save(storeDev, sizeInPt);
558 if (!store->
close()) {
574 errKrita <<
"Parsing error in contents.svg! Aborting!" << Qt::endl
575 <<
" In line: " << errorLine <<
", column: " << errorColumn << Qt::endl
576 <<
" Error message: " << errorMsg << Qt::endl;
579 *errors << i18n(
"Parsing error in the main document at line %1, column %2\nError message: %3"
580 , errorLine , errorColumn , errorMsg);
589 if (loadingFromKra) {
616 const QSizeF sizeInPt(sizeInPx.width() /
image()->xRes(), sizeInPx.height() /
image()->yRes());
628 const qreal resolutionPPI = 72.0 *
image->
xRes();
652 if (store->
open(
"content.svg")) {
654 storeDev.
open(QIODevice::ReadOnly);
656 loadSvg(&storeDev,
"", warnings);
674 QPoint oldPos(
x(),
y());
675 QPoint newPos = oldPos -
rect.topLeft();
701 const QTransform localTransform = globalTransform *
m_globalDocTransform * globalTransform.inverted();
718 if (
shapes.isEmpty())
return 0;
float value(const T *src, size_t ch)
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
const KoColorSpace * colorSpace() const
QRect bounds() const override
static const KoID antialiased
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
void prepareForDestroying()
bool hasChangedWhileBeingInvisible()
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
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 setY(qint32) override
void setParent(KoShapeContainer *parent)
bool accept(KisNodeVisitor &) override
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)
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
KoShapeContainer * parent
virtual bool isShapeEditable(bool recursive=true) const
checks recursively if the shape or one of its parents is not visible or locked
void applyAbsoluteTransformation(const QTransform &matrix)
virtual void setResolution(qreal xRes, qreal yRes)
static bool compareShapeZIndex(KoShape *s1, KoShape *s2)
KoShapeContainer * parent() const
QTransform absoluteTransformation() const
void setTransformation(const QTransform &matrix)
virtual KoShape * cloneShape() const
creates a deep copy of the shape or shape's subtree
QTransform transformation() const
Returns the shapes local transformation matrix.
void setGeometryProtected(bool on)
void setParent(KoShapeContainer *parent)
void setShapeId(const QString &id)
QTransform transform() const
return the current matrix that contains the rotation/scale/position of this shape
bool open(OpenMode m) override
bool open(const QString &name)
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.
bool save(QIODevice &outputDevice, const QSizeF &pageSize)
Writes svg to specified output device.
static bool qFuzzyCompare(half p1, half p2)
#define KIS_SAFE_ASSERT_RECOVER(cond)
#define KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE(cond, val)
#define KIS_SAFE_ASSERT_RECOVER_RETURN(cond)
#define KIS_ASSERT_RECOVER_RETURN(cond)
#define KIS_SAFE_ASSERT_RECOVER_NOOP(cond)
T kisGrowRect(const T &rect, U offset)
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)
virtual bool visible(bool recursive=false) const
void setImage(KisImageWSP image) override
virtual void fillMergedLayerTemplate(KisLayerSP dstLayer, KisLayerSP prevLayer, bool skipPaintingThisLayer=false)
virtual KisLayerSP createMergedLayerTemplate(KisLayerSP prevLayer)
const KoColorSpace * colorSpace() const override
returns the image's colorSpace or null, if there is no image
void setSectionModelProperties(const KisBaseNode::PropertyList &properties) override
KisBaseNode::PropertyList sectionModelProperties() const override
KisShapeLayerCanvasBase * canvas
KisSignalAutoConnectionsStore imageConnections
KisPaintDeviceSP paintDevice
KoShapeControllerBase * controller