File indexing completed on 2024-05-12 15:58:15
0001 /* 0002 * SPDX-FileCopyrightText: 2006 Bart Coppens <kde@bartcoppens.be> 0003 * SPDX-FileCopyrightText: 2006 Boudewijn Rempt <boud@valdyas.org> 0004 * 0005 * SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 #ifndef KIS_EXTERNAL_LAYER_IFACE_ 0008 #define KIS_EXTERNAL_LAYER_IFACE_ 0009 0010 #include "kis_icon_utils.h" 0011 0012 #include "kis_types.h" 0013 0014 #include "kis_image.h" 0015 #include "kis_layer.h" 0016 0017 class QString; 0018 class QIcon; 0019 class KUndo2Command; 0020 0021 /** 0022 A base interface for layers that are implemented outside the Krita 0023 core. 0024 */ 0025 class KRITAIMAGE_EXPORT KisExternalLayer : public KisLayer 0026 { 0027 0028 public: 0029 KisExternalLayer(KisImageWSP image, const QString &name, quint8 opacity) 0030 : KisLayer(image, name, opacity) {} 0031 0032 QIcon icon() const override { 0033 return KisIconUtils::loadIcon("view-refresh"); 0034 } 0035 0036 virtual void resetCache(); 0037 0038 virtual KUndo2Command* crop(const QRect & rect) { 0039 Q_UNUSED(rect); 0040 return 0; 0041 } 0042 0043 virtual KUndo2Command* transform(const QTransform &transform) { 0044 Q_UNUSED(transform); 0045 return 0; 0046 } 0047 0048 virtual bool supportsPerspectiveTransform() const { 0049 return false; 0050 } 0051 0052 // assign color profile without conversion of pixel data (if applicable) 0053 virtual KUndo2Command* setProfile(const KoColorProfile *profile) { 0054 Q_UNUSED(profile); 0055 return 0; 0056 } 0057 0058 // convert pixel data of the layer into \p dstColorSpace (if applicable) 0059 virtual KUndo2Command* convertTo(const KoColorSpace * dstColorSpace, 0060 KoColorConversionTransformation::Intent renderingIntent = KoColorConversionTransformation::internalRenderingIntent(), 0061 KoColorConversionTransformation::ConversionFlags conversionFlags = KoColorConversionTransformation::internalConversionFlags()) 0062 { 0063 Q_UNUSED(dstColorSpace); 0064 Q_UNUSED(renderingIntent); 0065 Q_UNUSED(conversionFlags); 0066 return 0; 0067 } 0068 0069 /** 0070 * Some external layers use original() only as a projection and render 0071 * some internal state into it, e.g. using KisSpontaneousProjection 0072 * asynchronously. theoreticalBoundingRect() is used to get real bounding 0073 * rect of a layer without relying on original(). 0074 */ 0075 virtual QRect theoreticalBoundingRect() const; 0076 }; 0077 0078 #endif // KIS_EXTERNAL_IFACE_LAYER_IFACE_