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, const QColor &white = QColor(Qt::white)) {
12 QPen ants;
13 QPen outline;
14 KisPaintingTweaks::initAntsPen(&ants, &outline, 4, 4, baseColor, white);
15
16 style->lineIterations << KisHandleStyle::IterationStyle(outline, Qt::NoBrush);
17 style->lineIterations << KisHandleStyle::IterationStyle(ants, Qt::NoBrush);
18
19 QPen handlePen(baseColor);
20 handlePen.setWidth(2);
21 handlePen.setCosmetic(true);
22 handlePen.setJoinStyle(Qt::RoundJoin);
23
24 style->handleIterations << KisHandleStyle::IterationStyle(handlePen, handleFill);
25}
26
27}
28
29
31{
32 static QScopedPointer<KisHandleStyle> style;
33
34 if (!style) {
35 style.reset(new KisHandleStyle());
37 style->handleIterations << KisHandleStyle::IterationStyle();
38 }
39
40 return *style;
41}
42
44{
45 static QScopedPointer<KisHandleStyle> style;
46
47 if (!style) {
48 style.reset(new KisHandleStyle());
49 initDashedStyle(palette.primaryColor, palette.white, style.data(), palette.white);
50 }
51
52 return *style;
53}
54
56{
57 static QScopedPointer<KisHandleStyle> style;
58
59 if (!style) {
60 style.reset(new KisHandleStyle());
61 initDashedStyle(palette.secondaryColor, palette.white, style.data(), palette.white);
62 }
63
64 return *style;
65}
66
68{
69 static QScopedPointer<KisHandleStyle> style;
70
71 if (!style) {
72 style.reset(new KisHandleStyle());
73 initDashedStyle(palette.primaryColor, palette.gradientFillColor, style.data(), palette.white);
74 }
75
76 return *style;
77}
78
83
84
86{
87 static QScopedPointer<KisHandleStyle> style;
88
89 if (!style) {
90 style.reset(new KisHandleStyle());
91 initDashedStyle(palette.highlightOutlineColor, palette.highlightColor, style.data(), palette.white);
92 }
93
94 return *style;
95}
96
98{
99 static QScopedPointer<KisHandleStyle> style;
100
101 if (!style) {
102 style.reset(new KisHandleStyle());
103 QPen h = QPen(palette.highlightOutlineColor, 2);
104 h.setCosmetic(true);
105 style->handleIterations << KisHandleStyle::IterationStyle(h, palette.highlightColor);
106 QPen l = QPen(palette.highlightOutlineColor, 1);
107 l.setCosmetic(true);
108 l.setJoinStyle(Qt::RoundJoin);
109 style->lineIterations << KisHandleStyle::IterationStyle(l, Qt::NoBrush);
110 }
111
112 return *style;
113}
114
116{
117 static QScopedPointer<KisHandleStyle> style;
118
119 if (!style) {
120 style.reset(new KisHandleStyle());
121 initDashedStyle(palette.highlightOutlineColor, palette.selectionColor, style.data(), palette.white);
122 }
123
124 return *style;
125}
126
128{
129 static QScopedPointer<KisHandleStyle> style;
130
131 if (!style) {
132 style.reset(new KisHandleStyle());
133 initDashedStyle(palette.primaryColor, palette.selectionColor, style.data(), palette.white);
134 }
135
136 return *style;
137}
138
static KisHandleStyle & inheritStyle()
static KisHandleStyle & gradientArrows(KisHandlePalette palette=KisHandlePalette())
static KisHandleStyle & partiallyHighlightedPrimaryHandles(KisHandlePalette palette=KisHandlePalette())
static KisHandleStyle & highlightedPrimaryHandlesWithSolidOutline(KisHandlePalette palette=KisHandlePalette())
static KisHandleStyle & gradientHandles(KisHandlePalette palette=KisHandlePalette())
static KisHandleStyle & secondarySelection(KisHandlePalette palette=KisHandlePalette())
static KisHandleStyle & selectedPrimaryHandles(KisHandlePalette palette=KisHandlePalette())
static KisHandleStyle & primarySelection(KisHandlePalette palette=KisHandlePalette())
QVector< IterationStyle > lineIterations
static KisHandleStyle & highlightedPrimaryHandles(KisHandlePalette palette=KisHandlePalette())
QVector< IterationStyle > handleIterations
void initAntsPen(QPen *antsPen, QPen *outlinePen, int antLength, int antSpace, QColor black, QColor white)
rgba palette[MAX_PALETTE]
Definition palette.c:35