48 painter->setPen(QColor(0,0,0));
50 painter->setPen(QColor(255,255,255));
60 QPoint pixelCacheOffset;
82 gc.setRenderHint(QPainter::Antialiasing);
83 gc.setPen(QPen(QColor(0,0,0,128), 2.5));
84 gc.setCompositionMode(QPainter::CompositionMode_Clear);
95 triangleCoords.setY(qBound(0, triangleCoords.y(),
int(
triangleHeight())));
97 int horizontalLineLength = triangleCoords.y()*(2./sqrt(3.));
98 int horizontalLineStart =
triangleWidth()/2.-horizontalLineLength/2.;
99 int horizontalLineEnd = horizontalLineStart+horizontalLineLength;
101 triangleCoords.setX(qBound(horizontalLineStart, triangleCoords.x(), horizontalLineEnd));
108 return colorAt(triangleCoords.x(), triangleCoords.y());
117 qreal horizontalLineLength = y * (2. / sqrt(3.));
118 qreal horizontalLineStart = 0.5 * (
triangleWidth() - horizontalLineLength);
119 qreal x=s * horizontalLineLength + horizontalLineStart;
150 int horizontalLineLength = y*(2./sqrt(3.));
151 int horizontalLineStart =
triangleWidth()/2.-horizontalLineLength/2.;
152 int horizontalLineEnd = horizontalLineStart+horizontalLineLength;
154 if(x<horizontalLineStart || x>horizontalLineEnd || y>
triangleHeight)
157 qreal relativeX = x-horizontalLineStart;
160 qreal saturation = relativeX/qreal(horizontalLineLength);
169 QPoint ret=point-triangleTopLeft;
177 QPoint ret=triangleTopLeft+point;
float value(const T *src, size_t ch)
const quint8 OPACITY_OPAQUE_U8
static void render(Sampler *sampler, const KisDisplayColorConverter *converter, const QRect &sampleRect, KisPaintDeviceSP &realPixelCache, QImage &pixelCache, QPoint &pixelCacheOffset, qreal devicePixelRatioF)
KisDisplayColorConverter * converter() const
const KoColorSpace * colorSpace() const
void update()
request for repaint, for instance, if the hue changes.
void setLastMousePosition(int x, int y)
KisColorSelector * m_parent
bool isDirty() const
returns true, if ether the color space, the size or the parameters have changed since the last paint ...
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 paint(QPainter *) override
bool containsPointInComponentCoords(int x, int y) const override
KisColorSelectorTriangle(KisColorSelector *parent)
KoColor selectColor(int x, int y) override
this method must be overloaded to return the color at position x/y and draw a marker on that position
QPoint widgetToTriangleCoordinates(const QPoint &point) const
QPoint triangleToWidgetCoordinates(const QPoint &point) const
KoColor colorAt(float x, float y) const
int triangleWidth() const
void updatePixelCache(qreal devicePixelRatioF)
qreal m_cacheDevicePixelRatioF
KisPaintDeviceSP m_realPixelCache
QImage m_renderedPixelCache
void setColor(const KoColor &color) override
set the color, blibs etc
int triangleHeight() const
void getHsvF(const KoColor &srcColor, qreal *h, qreal *s, qreal *v, qreal *a=0)
KoColor fromHsvF(qreal h, qreal s, qreal v, qreal a=1.0)
static KoColor createTransparent(const KoColorSpace *cs)
KoColor sampleColor(PaintDeviceSP device, const QPoint &pt)