File indexing completed on 2024-10-27 04:07:34

0001 /*
0002  * SPDX-FileCopyrightText: 2017 Jouni Pentikäinen <joupent@gmail.com>
0003  *
0004  * SPDX-License-Identifier: LGPL-2.0-or-later
0005  */
0006 
0007 #ifndef KRITA_KISREFERENCEIMAGESLAYER_H
0008 #define KRITA_KISREFERENCEIMAGESLAYER_H
0009 
0010 #include "kis_shape_layer.h"
0011 
0012 #include <kis_types.h>
0013 
0014 class KisDocument;
0015 class KoCanvasBase;
0016 
0017 class KRITAUI_EXPORT KisReferenceImagesLayer : public KisShapeLayer
0018 {
0019     Q_OBJECT
0020 
0021 public:
0022     KisReferenceImagesLayer(KoShapeControllerBase* shapeController, KisImageWSP image);
0023     KisReferenceImagesLayer(const KisReferenceImagesLayer &rhs);
0024 
0025     static KUndo2Command * addReferenceImages(KisDocument *document, QList<KoShape*> referenceImages);
0026     KUndo2Command * removeReferenceImages(KisDocument *document, QList<KoShape*> referenceImages);
0027     QVector<KisReferenceImage*> referenceImages() const;
0028 
0029     QRectF boundingImageRect() const;
0030     QColor getPixel(QPointF position) const;
0031 
0032     void paintReferences(QPainter &painter);
0033 
0034     bool allowAsChild(KisNodeSP) const override;
0035 
0036     bool accept(KisNodeVisitor&) override;
0037     void accept(KisProcessingVisitor &visitor, KisUndoAdapter *undoAdapter) override;
0038 
0039     KisNodeSP clone() const override {
0040         return new KisReferenceImagesLayer(*this);
0041     }
0042 
0043     bool isFakeNode() const override;
0044 
0045     KUndo2Command* setProfile(const KoColorProfile *profile) override;
0046     KUndo2Command* convertTo(const KoColorSpace * dstColorSpace,
0047                                  KoColorConversionTransformation::Intent renderingIntent = KoColorConversionTransformation::internalRenderingIntent(),
0048                                  KoColorConversionTransformation::ConversionFlags conversionFlags = KoColorConversionTransformation::internalConversionFlags()) override;
0049 
0050 
0051 Q_SIGNALS:
0052     /**
0053      * The content of the layer has changed, and the canvas decoration
0054      * needs to update.
0055      */
0056     void sigUpdateCanvas(const QRectF &rect);
0057 
0058 private:
0059     void signalUpdate(const QRectF &rect);
0060     friend struct AddReferenceImagesCommand;
0061     friend struct RemoveReferenceImagesCommand;
0062     friend class ReferenceImagesCanvas;
0063 };
0064 
0065 typedef KisSharedPtr<KisReferenceImagesLayer> KisReferenceImagesLayerSP;
0066 
0067 
0068 #endif //KRITA_KISREFERENCEIMAGESLAYER_H