Krita Source Code Documentation
Loading...
Searching...
No Matches
KisDabCacheUtils.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2017 Dmitry Kazakov <dimula73@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
7#ifndef KISDABCACHEUTILS_H
8#define KISDABCACHEUTILS_H
9
10#include <QRect>
11#include <QSize>
12
13#include "kis_types.h"
14
15#include <KoColor.h>
17#include <KisMirrorProperties.h>
18#include "kis_dab_shape.h"
19
20#include "kritapaintop_export.h"
21#include <functional>
22
23class KisBrush;
25
26class KisColorSource;
29
30
31namespace KisDabCacheUtils
32{
33
34struct PAINTOP_EXPORT DabRenderingResources
35{
37 virtual ~DabRenderingResources();
38
39 virtual void syncResourcesToSeqNo(int seqNo, const KisPaintInformation &info);
40
42 QScopedPointer<KisColorSource> colorSource;
43
44 QScopedPointer<KisSharpnessOption> sharpnessOption;
45 QScopedPointer<KisTextureOption> textureOption;
46
48
49private:
51};
52
53typedef std::function<DabRenderingResources*()> ResourcesFactory;
54
55struct PAINTOP_EXPORT DabRequestInfo
56{
57 DabRequestInfo(const KoColor &_color,
58 const QPointF &_cursorPoint,
59 const KisDabShape &_shape,
60 const KisPaintInformation &_info,
61 qreal _softnessFactor,
62 qreal _lightnessStrength = 1.0)
63 : color(_color),
64 cursorPoint(_cursorPoint),
65 shape(_shape),
66 info(_info),
67 softnessFactor(_softnessFactor),
68 lightnessStrength(_lightnessStrength)
69 {
70 }
71
72 const KoColor &color;
73 const QPointF &cursorPoint;
76 const qreal softnessFactor;
77 const qreal lightnessStrength;
78
79private:
81};
82
83struct PAINTOP_EXPORT DabGenerationInfo
84{
88 QPointF subPixel;
89 bool solidColorFill = true;
92 qreal softnessFactor = 1.0;
93 qreal lightnessStrength = 1.0;
94
95 bool needsPostprocessing = false;
96};
97
98PAINTOP_EXPORT QRect correctDabRectWhenFetchedFromCache(const QRect &dabRect,
99 const QSize &realDabSize);
100
101PAINTOP_EXPORT void generateDab(const DabGenerationInfo &di,
102 DabRenderingResources *resources,
104 bool forceImageStamp = false);
105
106PAINTOP_EXPORT void postProcessDab(KisFixedPaintDeviceSP dab,
107 const QPoint &dabTopLeft,
108 const KisPaintInformation& info,
109 DabRenderingResources *resources);
110
111}
112
113template<class T> class QSharedPointer;
116
117#endif // KISDABCACHEUTILS_H
QSharedPointer< KisBrush > KisBrushSP
QSharedPointer< KisDabRenderingJob > KisDabRenderingJobSP
void postProcessDab(KisFixedPaintDeviceSP dab, const QPoint &dabTopLeft, const KisPaintInformation &info, DabRenderingResources *resources)
void generateDab(const DabGenerationInfo &di, DabRenderingResources *resources, KisFixedPaintDeviceSP *dab, bool forceNormalizedRGBAImageStamp)
QRect correctDabRectWhenFetchedFromCache(const QRect &dabRect, const QSize &realDabSize)
std::function< DabRenderingResources *()> ResourcesFactory
QScopedPointer< KisColorSource > colorSource
DabRenderingResources(const DabRenderingResources &rhs)=delete
QScopedPointer< KisSharpnessOption > sharpnessOption
QScopedPointer< KisTextureOption > textureOption
DabRequestInfo(const DabRequestInfo &rhs)
DabRequestInfo(const KoColor &_color, const QPointF &_cursorPoint, const KisDabShape &_shape, const KisPaintInformation &_info, qreal _softnessFactor, qreal _lightnessStrength=1.0)
const KisPaintInformation & info