File indexing completed on 2024-06-23 04:21:38

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_PROJECTION_PLANE_H
0008 #define __KIS_LAYER_STYLE_FILTER_PROJECTION_PLANE_H
0009 
0010 #include "kis_abstract_projection_plane.h"
0011 
0012 #include <QScopedPointer>
0013 
0014 #include "kis_types.h"
0015 
0016 class KisLayerStyleKnockoutBlower;
0017 
0018 
0019 class KisLayerStyleFilterProjectionPlane : public KisAbstractProjectionPlane
0020 {
0021 public:
0022     KisLayerStyleFilterProjectionPlane(KisLayer *sourceLayer);
0023     KisLayerStyleFilterProjectionPlane(const KisLayerStyleFilterProjectionPlane &rhs, KisLayer *sourceLayer, KisPSDLayerStyleSP clonedStyle);
0024     ~KisLayerStyleFilterProjectionPlane() override;
0025 
0026     void setStyle(KisLayerStyleFilter *filter, KisPSDLayerStyleSP style);
0027 
0028     QRect recalculate(const QRect& rect, KisNodeSP filthyNode) override;
0029     void apply(KisPainter *painter, const QRect &rect) override;
0030 
0031     QRect needRect(const QRect &rect, KisLayer::PositionToFilthy pos) const override;
0032     QRect changeRect(const QRect &rect, KisLayer::PositionToFilthy pos) const override;
0033     QRect accessRect(const QRect &rect, KisLayer::PositionToFilthy pos) const override;
0034     QRect needRectForOriginal(const QRect &rect) const override;
0035     QRect tightUserVisibleBounds() const override;
0036 
0037     KisPaintDeviceList getLodCapableDevices() const override;
0038 
0039     /**
0040      * \returns true if a call to apply() will actually paint anything. Basically,
0041      * it is a cached version of isEnabled(), though the state may change after calling
0042      * to recalculate().
0043      */
0044     bool isEmpty() const;
0045 
0046     KisLayerStyleKnockoutBlower *knockoutBlower() const;
0047 
0048 protected:
0049 
0050     KisLayerStyleFilter* filter() const;
0051     KisPSDLayerStyleSP style() const;
0052 
0053 private:
0054     struct Private;
0055     const QScopedPointer<Private> m_d;
0056 };
0057 
0058 typedef QSharedPointer<KisLayerStyleFilterProjectionPlane> KisLayerStyleFilterProjectionPlaneSP;
0059 typedef QWeakPointer<KisLayerStyleFilterProjectionPlane> KisLayerStyleFilterProjectionPlaneWSP;
0060 
0061 #endif /* __KIS_LAYER_STYLE_FILTER_PROJECTION_PLANE_H */