#include <kis_color_selector_triangle.h>
|
| | KisColorSelectorTriangle (KisColorSelector *parent) |
| |
| void | setColor (const KoColor &color) override |
| | set the color, blibs etc
|
| |
| KoColor | currentColor () |
| | return the color, that was selected by calling mouseEvent
|
| |
| int | height () const |
| |
| | KisColorSelectorComponent (KisColorSelector *parent) |
| |
| virtual void | mouseEvent (int x, int y) |
| | saves the mouse position, so that a blip can be created.
|
| |
| void | paintEvent (QPainter *) |
| |
| void | setConfiguration (Parameter param, Type type) |
| | setConfiguration can be ignored (for instance ring and triangle, as they can have only one config)
|
| |
| void | setDirty () |
| | force subsequent redraw of the component
|
| |
| void | setGamutMask (KoGamutMaskSP gamutMask) |
| |
| void | setGeometry (int x, int y, int width, int height) |
| |
| void | toggleGamutMask (bool state) |
| |
| void | unsetGamutMask () |
| |
| void | updateGamutMaskPreview () |
| |
| bool | wantsGrab (int x, int y) |
| | returns true, if this component wants to grab the mouse (normally true, if containsPoint returns true)
|
| |
| int | width () const |
| |
|
| typedef KisColorSelectorConfiguration::Parameters | Parameter |
| |
| typedef KisColorSelectorConfiguration::Type | Type |
| |
| void | setParam (qreal hue, qreal hsvSaturation, qreal value, qreal hslSaturation, qreal lightness, qreal hsiSaturation, qreal intensity, qreal hsySaturation, qreal luma) |
| |
| void | paramChanged (qreal hue, qreal hsvSaturation, qreal value, qreal hslSaturation, qreal lightness, qreal hsiSaturation, qreal intensity, qreal hsySaturation, qreal luma) |
| | -1, if unaffected
|
| |
| void | update () |
| | request for repaint, for instance, if the hue changes.
|
| |
| KoGamutMaskSP | m_currentGamutMask |
| |
| bool | m_gamutMaskOn {false} |
| |
| qreal | m_hsiSaturation {0.0} |
| |
| qreal | m_hslSaturation {0.0} |
| |
| qreal | m_hsvSaturation {0.0} |
| |
| qreal | m_hsySaturation {0.0} |
| |
| qreal | m_hue {0.0} |
| |
| qreal | m_intensity {0.0} |
| |
| qreal | m_lastX {0.0} |
| |
| qreal | m_lastY {0.0} |
| |
| qreal | m_lightness {0.0} |
| |
| qreal | m_luma {0.0} |
| |
| bool | m_maskPreviewActive {false} |
| |
| Parameter | m_parameter |
| |
| KisColorSelector * | m_parent {0} |
| |
| Type | m_type |
| |
| qreal | m_value {0.0} |
| |
| int | m_x {0} |
| |
| int | m_y {0} |
| |
◆ KisColorSelectorTriangle()
◆ colorAt()
| KoColor KisColorSelectorTriangle::colorAt |
( |
float | x, |
|
|
float | y ) const |
|
private |
Definition at line 144 of file kis_color_selector_triangle.cpp.
145{
148
150 int horizontalLineLength =
y*(2./sqrt(3.));
151 int horizontalLineStart =
triangleWidth()/2.-horizontalLineLength/2.;
152 int horizontalLineEnd = horizontalLineStart+horizontalLineLength;
153
154 if(x<horizontalLineStart || x>horizontalLineEnd || y>
triangleHeight)
156
157 qreal relativeX =
x-horizontalLineStart;
158
160 qreal saturation = relativeX/qreal(horizontalLineLength);
161
163}
float value(const T *src, size_t ch)
KisDisplayColorConverter * converter() const
const KoColorSpace * colorSpace() const
KisColorSelector * m_parent
int triangleWidth() const
int triangleHeight() const
KoColor fromHsvF(qreal h, qreal s, qreal v, qreal a=1.0)
static KoColor createTransparent(const KoColorSpace *cs)
References KisColorSelectorComponent::colorSpace(), KisColorSelectorBase::converter(), KoColor::createTransparent(), KisDisplayColorConverter::fromHsvF(), KisColorSelectorComponent::m_hue, KisColorSelectorComponent::m_parent, triangleHeight(), triangleWidth(), and value().
◆ containsPointInComponentCoords()
| bool KisColorSelectorTriangle::containsPointInComponentCoords |
( |
int | x, |
|
|
int | y ) const |
|
overrideprotectedvirtual |
◆ paint()
| void KisColorSelectorTriangle::paint |
( |
QPainter * | | ) |
|
|
overrideprotectedvirtual |
paint component using given painter the component should respect width() and height() (eg. scale to width and height), but doesn't have to care about x/y coordinates (top left corner)
Implements KisColorSelectorComponent.
Definition at line 35 of file kis_color_selector_triangle.cpp.
36{
39 }
40
41
45
46
48 painter->setPen(QColor(0,0,0));
50 painter->setPen(QColor(255,255,255));
52 }
53}
bool isDirty() const
returns true, if ether the color space, the size or the parameters have changed since the last paint ...
void updatePixelCache(qreal devicePixelRatioF)
QImage m_renderedPixelCache
References KisColorSelector::displayBlip(), KisColorSelectorComponent::height(), KisColorSelectorComponent::isDirty(), m_lastClickPos, KisColorSelectorComponent::m_parent, m_renderedPixelCache, triangleHeight(), triangleWidth(), updatePixelCache(), and KisColorSelectorComponent::width().
◆ selectColor()
| KoColor KisColorSelectorTriangle::selectColor |
( |
int | x, |
|
|
int | y ) |
|
overrideprotectedvirtual |
this method must be overloaded to return the color at position x/y and draw a marker on that position
Implements KisColorSelectorComponent.
Definition at line 89 of file kis_color_selector_triangle.cpp.
90{
92
94
95 triangleCoords.setY(qBound(0, triangleCoords.y(),
int(
triangleHeight())));
96
97 int horizontalLineLength = triangleCoords.y()*(2./sqrt(3.));
98 int horizontalLineStart =
triangleWidth()/2.-horizontalLineLength/2.;
99 int horizontalLineEnd = horizontalLineStart+horizontalLineLength;
100
101 triangleCoords.setX(qBound(horizontalLineStart, triangleCoords.x(), horizontalLineEnd));
102
104
107
108 return colorAt(triangleCoords.x(), triangleCoords.y());
109}
void update()
request for repaint, for instance, if the hue changes.
QPoint triangleToWidgetCoordinates(const QPoint &point) const
KoColor colorAt(float x, float y) const
References colorAt(), KisColorSelectorComponent::height(), m_lastClickPos, triangleHeight(), triangleToWidgetCoordinates(), triangleWidth(), KisColorSelectorComponent::update(), widgetToTriangleCoordinates(), and KisColorSelectorComponent::width().
◆ setColor()
| void KisColorSelectorTriangle::setColor |
( |
const KoColor & | color | ) |
|
|
overridevirtual |
set the color, blibs etc
Reimplemented from KisColorSelectorComponent.
Definition at line 111 of file kis_color_selector_triangle.cpp.
112{
115
117 qreal horizontalLineLength =
y * (2. / sqrt(3.));
118 qreal horizontalLineStart = 0.5 * (
triangleWidth() - horizontalLineLength);
119 qreal
x=s * horizontalLineLength + horizontalLineStart;
120
122
125
126
128
132}
void setLastMousePosition(int x, int y)
virtual void setColor(const KoColor &color)
set the color, blibs etc
void paramChanged(qreal hue, qreal hsvSaturation, qreal value, qreal hslSaturation, qreal lightness, qreal hsiSaturation, qreal intensity, qreal hsySaturation, qreal luma)
-1, if unaffected
void getHsvF(const KoColor &srcColor, qreal *h, qreal *s, qreal *v, qreal *a=0)
References KisColorSelectorBase::converter(), KisDisplayColorConverter::getHsvF(), KisColorSelectorComponent::height(), m_lastClickPos, KisColorSelectorComponent::m_parent, KisColorSelectorComponent::paramChanged(), KisColorSelectorComponent::setColor(), KisColorSelectorComponent::setLastMousePosition(), triangleHeight(), triangleToWidgetCoordinates(), triangleWidth(), KisColorSelectorComponent::update(), v, and KisColorSelectorComponent::width().
◆ triangleHeight()
| int KisColorSelectorTriangle::triangleHeight |
( |
| ) |
const |
|
private |
◆ triangleToWidgetCoordinates()
| QPoint KisColorSelectorTriangle::triangleToWidgetCoordinates |
( |
const QPoint & | point | ) |
const |
|
private |
◆ triangleWidth()
| int KisColorSelectorTriangle::triangleWidth |
( |
| ) |
const |
|
private |
◆ updatePixelCache()
| void KisColorSelectorTriangle::updatePixelCache |
( |
qreal | devicePixelRatioF | ) |
|
|
private |
Definition at line 55 of file kis_color_selector_triangle.cpp.
56{
59
60 QPoint pixelCacheOffset;
61
64 }
65
71 pixelCacheOffset,
72 devicePixelRatioF);
73
75
76
77
78
79
80
82 gc.setRenderHint(QPainter::Antialiasing);
83 gc.setPen(QPen(QColor(0,0,0,128), 2.5));
84 gc.setCompositionMode(QPainter::CompositionMode_Clear);
87}
static void render(Sampler *sampler, const KisDisplayColorConverter *converter, const QRect &sampleRect, KisPaintDeviceSP &realPixelCache, QImage &pixelCache, QPoint &pixelCacheOffset, qreal devicePixelRatioF)
References KisColorSelectorBase::converter(), KisColorSelectorComponent::height(), m_cacheDevicePixelRatioF, m_cachedSize, KisColorSelectorComponent::m_parent, m_realPixelCache, m_renderedPixelCache, Acs::PixelCacheRenderer::render(), triangleHeight(), triangleWidth(), and KisColorSelectorComponent::width().
◆ widgetToTriangleCoordinates()
| QPoint KisColorSelectorTriangle::widgetToTriangleCoordinates |
( |
const QPoint & | point | ) |
const |
|
private |
◆ Acs::PixelCacheRenderer
◆ m_cacheDevicePixelRatioF
| qreal KisColorSelectorTriangle::m_cacheDevicePixelRatioF {1.0} |
|
private |
◆ m_cachedSize
| QSize KisColorSelectorTriangle::m_cachedSize |
|
private |
◆ m_lastClickPos
| QPointF KisColorSelectorTriangle::m_lastClickPos |
|
private |
◆ m_realPixelCache
◆ m_renderedPixelCache
| QImage KisColorSelectorTriangle::m_renderedPixelCache |
|
private |
The documentation for this class was generated from the following files: