File indexing completed on 2024-05-26 04:27:35

0001 /*
0002  *  SPDX-FileCopyrightText: 2015 Dmitry Kazakov <dimula73@gmail.com>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #ifndef __KIS_LAYER_STYLE_FILTER_H
0008 #define __KIS_LAYER_STYLE_FILTER_H
0009 
0010 #include "kis_types.h"
0011 #include "kis_shared.h"
0012 #include "kritaimage_export.h"
0013 #include "kis_psd_layer_style.h"
0014 #include <QScopedPointer>
0015 
0016 class KisLayerStyleFilterEnvironment;
0017 class KisMultipleProjection;
0018 class KisLayerStyleKnockoutBlower;
0019 
0020 class KRITAIMAGE_EXPORT KisLayerStyleFilter : public KisShared
0021 {
0022 public:
0023     KisLayerStyleFilter(const KoID &id);
0024     virtual ~KisLayerStyleFilter();
0025 
0026     /**
0027      * \return Unique identifier for this filter
0028      */
0029     QString id() const;
0030 
0031     virtual KisLayerStyleFilter* clone() const = 0;
0032 
0033     virtual void processDirectly(KisPaintDeviceSP src,
0034                                  KisMultipleProjection *dst,
0035                                  KisLayerStyleKnockoutBlower *blower,
0036                                  const QRect &applyRect,
0037                                  KisPSDLayerStyleSP style,
0038                                  KisLayerStyleFilterEnvironment *env) const = 0;
0039 
0040     /**
0041      * Some filters need pixels outside the current processing rect to compute the new
0042      * value (for instance, convolution filters)
0043      */
0044     virtual QRect neededRect(const QRect & rect, KisPSDLayerStyleSP style, KisLayerStyleFilterEnvironment *env) const = 0;
0045 
0046     /**
0047      * Similar to \ref neededRect: some filters will alter a lot of pixels that are
0048      * near to each other at the same time. So when you changed a single rectangle
0049      * in a device, the actual rectangle that will feel the influence of this change
0050      * might be bigger. Use this function to determine that rect.
0051      */
0052     virtual QRect changedRect(const QRect & rect, KisPSDLayerStyleSP style, KisLayerStyleFilterEnvironment *env) const = 0;
0053 
0054 protected:
0055     KisLayerStyleFilter(const KisLayerStyleFilter &rhs);
0056 
0057 private:
0058     struct Private;
0059     const QScopedPointer<Private> m_d;
0060 };
0061 
0062 #endif /* __KIS_LAYER_STYLE_FILTER_H */