Krita Source Code Documentation
Loading...
Searching...
No Matches
KisHandleStyle.cpp
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#include "KisHandleStyle.h"
9
10namespace {
11void initDashedStyle(const QColor &baseColor, const QColor &handleFill, KisHandleStyle *style) {
12 QPen ants;
13 QPen outline;
14 KisPaintingTweaks::initAntsPen(&ants, &outline);
15
16 ants.setColor(baseColor);
17
18 style->lineIterations << KisHandleStyle::IterationStyle(outline, Qt::NoBrush);
19 style->lineIterations << KisHandleStyle::IterationStyle(ants, Qt::NoBrush);
20
21 QPen handlePen(baseColor);
22 handlePen.setWidth(2);
23 handlePen.setCosmetic(true);
24 handlePen.setJoinStyle(Qt::RoundJoin);
25
26 style->handleIterations << KisHandleStyle::IterationStyle(handlePen, handleFill);
27}
28
29static const QColor primaryColor(0, 0, 90, 180);
30static const QColor secondaryColor(0, 0, 255, 127);
31static const QColor gradientFillColor(255, 197, 39);
32static const QColor highlightColor(255, 100, 100);
33static const QColor highlightOutlineColor(155, 0, 0);
34static const QColor selectionColor(164, 227, 243);
35
36}
37
38
40{
41 static QScopedPointer<KisHandleStyle> style;
42
43 if (!style) {
44 style.reset(new KisHandleStyle());
46 style->handleIterations << KisHandleStyle::IterationStyle();
47 }
48
49 return *style;
50}
51
53{
54 static QScopedPointer<KisHandleStyle> style;
55
56 if (!style) {
57 style.reset(new KisHandleStyle());
58 initDashedStyle(primaryColor, Qt::white, style.data());
59 }
60
61 return *style;
62}
63
65{
66 static QScopedPointer<KisHandleStyle> style;
67
68 if (!style) {
69 style.reset(new KisHandleStyle());
70 initDashedStyle(secondaryColor, Qt::white, style.data());
71 }
72
73 return *style;
74}
75
77{
78 static QScopedPointer<KisHandleStyle> style;
79
80 if (!style) {
81 style.reset(new KisHandleStyle());
82 initDashedStyle(primaryColor, gradientFillColor, style.data());
83 }
84
85 return *style;
86}
87
92
93
95{
96 static QScopedPointer<KisHandleStyle> style;
97
98 if (!style) {
99 style.reset(new KisHandleStyle());
100 initDashedStyle(highlightOutlineColor, highlightColor, style.data());
101 }
102
103 return *style;
104}
105
107{
108 static QScopedPointer<KisHandleStyle> style;
109
110 if (!style) {
111 style.reset(new KisHandleStyle());
112 QPen h = QPen(highlightOutlineColor, 2);
113 h.setCosmetic(true);
114 style->handleIterations << KisHandleStyle::IterationStyle(h, highlightColor);
115 QPen l = QPen(highlightOutlineColor, 1);
116 l.setCosmetic(true);
117 l.setJoinStyle(Qt::RoundJoin);
118 style->lineIterations << KisHandleStyle::IterationStyle(l, Qt::NoBrush);
119 }
120
121 return *style;
122}
123
125{
126 static QScopedPointer<KisHandleStyle> style;
127
128 if (!style) {
129 style.reset(new KisHandleStyle());
130 initDashedStyle(highlightOutlineColor, selectionColor, style.data());
131 }
132
133 return *style;
134}
135
137{
138 static QScopedPointer<KisHandleStyle> style;
139
140 if (!style) {
141 style.reset(new KisHandleStyle());
142 initDashedStyle(primaryColor, selectionColor, style.data());
143 }
144
145 return *style;
146}
147
static KisHandleStyle & inheritStyle()
static KisHandleStyle & gradientHandles()
static KisHandleStyle & highlightedPrimaryHandlesWithSolidOutline()
static KisHandleStyle & highlightedPrimaryHandles()
static KisHandleStyle & gradientArrows()
static KisHandleStyle & selectedPrimaryHandles()
QVector< IterationStyle > lineIterations
static KisHandleStyle & partiallyHighlightedPrimaryHandles()
static KisHandleStyle & secondarySelection()
static KisHandleStyle & primarySelection()
QVector< IterationStyle > handleIterations
void initAntsPen(QPen *antsPen, QPen *outlinePen, int antLength, int antSpace)