File indexing completed on 2024-12-22 04:16:03

0001 /*
0002  *  SPDX-FileCopyrightText: 2021 Dmitry Kazakov <dimula73@gmail.com>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #ifndef KRITA_KISCOLORSMUDGESTRATEGYLIGHTNESS_H
0008 #define KRITA_KISCOLORSMUDGESTRATEGYLIGHTNESS_H
0009 
0010 #include "KisColorSmudgeStrategyBase.h"
0011 #include "kis_painter.h"
0012 #include "KisPaintThicknessOptionData.h"
0013 
0014 class KisColorSmudgeStrategyLightness : public KisColorSmudgeStrategyBase
0015 {
0016 public:
0017 
0018     KisColorSmudgeStrategyLightness(KisPainter *painter,
0019                                     bool smearAlpha,
0020                                     bool useDullingMode, 
0021                                     KisPaintThicknessOptionData::ThicknessMode thicknessMode);
0022 
0023     void initializePainting() override;
0024 
0025     DabColoringStrategy &coloringStrategy() override;
0026 
0027     void updateMask(KisDabCache *dabCache,
0028                     const KisPaintInformation& info,
0029                     const KisDabShape &shape,
0030                     const QPointF &cursorPoint,
0031                     QRect *dstDabRect, qreal lightnessStrength) override;
0032 
0033     QVector<QRect> paintDab(const QRect &srcRect, const QRect &dstRect, const KoColor &currentPaintColor, qreal opacity,
0034                             qreal colorRateValue, qreal smudgeRateValue, qreal maxPossibleSmudgeRateValue,
0035                             qreal lightnessStrengthValue, qreal smudgeRadiusValue) override;
0036 private:
0037     KisFixedPaintDeviceSP m_maskDab;
0038     KisFixedPaintDeviceSP m_origDab;
0039     KisPaintDeviceSP m_heightmapDevice;
0040     KisPaintDeviceSP m_colorOnlyDevice;
0041     KisPaintDeviceSP m_projectionDevice;
0042     KisOverlayPaintDeviceWrapper *m_layerOverlayDevice {nullptr};
0043     KisColorSmudgeSourceSP m_sourceWrapperDevice;
0044     KisPainter m_finalPainter;
0045     KisPainter m_heightmapPainter;
0046     bool m_shouldPreserveOriginalDab {true};
0047     DabColoringStrategyMask m_coloringStrategy;
0048     bool m_smearAlpha {true};
0049     KisPainter *m_initializationPainter {nullptr};
0050     KisPaintThicknessOptionData::ThicknessMode m_thicknessMode;
0051 };
0052 
0053 
0054 #endif //KRITA_KISCOLORSMUDGESTRATEGYLIGHTNESS_H