18 int channel1,
int channel2,
56 qreal y = (coordinate.y() * (height() - 1 - 2 * offset)) + offset;
58 qreal triWidth = width() - 1 - 2 * offset;
59 qreal horizontalLineLength = coordinate.y() * triWidth;
60 qreal horizontalLineStart = offset + 0.5 * (triWidth - horizontalLineLength);
62 qreal x = coordinate.x() * horizontalLineLength + horizontalLineStart;
73 qreal y = qBound(0.0, (coordinate.y() - offset)/(height() - 1 - 2 * offset), 1.0);
76 qreal triWidth = width() - 1 - 2 * offset;
77 qreal horizontalLineLength = y * triWidth;
78 qreal horizontalLineStart = offset + 0.5 * (triWidth - horizontalLineLength);
80 x = qBound(0.0, (coordinate.x() - horizontalLineStart) / horizontalLineLength, 1.0);
88 const int cursorWidth = qMax(2 *
m_margin, 2);
90 maskPoly << QPoint(qFloor(0.5 * (width() - cursorWidth)), 0)
91 << QPoint(qCeil(0.5 * (width() + cursorWidth)), 0)
92 << QPoint(width(), height() - cursorWidth)
93 << QPoint(width(), height())
94 << QPoint(0, height())
95 << QPoint(0, height() - cursorWidth);
97 return QRegion(maskPoly);
104 const int deviceWidth = qCeil(width() * devicePixelRatioF());
105 const int deviceHeight = qCeil(height() * devicePixelRatioF());
107 QImage alphaMask(deviceWidth, deviceHeight, QImage::Format_Alpha8);
109 alphaMask.setDevicePixelRatio(devicePixelRatioF());
110 QPainter painter(&alphaMask);
111 painter.setRenderHint(QPainter::Antialiasing);
112 painter.setBrush(Qt::white);
113 painter.setPen(Qt::NoPen);
114 QPointF triangle[3] = {
119 painter.drawConvexPolygon(triangle, 3);
129 QBrush fill(Qt::SolidPattern);
133 painter.setPen(Qt::white);
134 fill.setColor(Qt::white);
135 painter.setBrush(fill);
136 painter.drawEllipse(cursorPoint, cursorwidth, cursorwidth);
138 painter.setPen(Qt::black);
139 painter.setBrush(fill);
140 painter.drawEllipse(cursorPoint, cursorwidth-1.0, cursorwidth-1.0);
The KisVisualColorSelectorShape class A 2d widget can represent at maximum 2 coordinates....
QPointF getCursorPosition() const
getCursorPosition
QColor getColorFromConverter(KoColor c)
getColorFromConverter
KoColor getCurrentColor()
getCurrentColor
Dimensions
The Dimensions enum Whether or not the shape is single or two dimensional.
The KisVisualColorSelector class.
QImage renderAlphaMask() const override
render the alpha mask for the widget background the returned image is expected to be QImage::Format_A...
QRect getSpaceForTriangle(QRect geom) override
void drawCursor(QPainter &painter) override
KisVisualTriangleSelectorShape(KisVisualColorSelector *parent, Dimensions dimension, int channel1, int channel2, int margin=5)
QPointF convertWidgetCoordinateToShapeCoordinate(QPointF coordinate) const override
convertWidgetCoordinateToShapeCoordinate Convert a coordinate in the widget's height/width to a shape...
~KisVisualTriangleSelectorShape() override
void setBorderWidth(int) override
setBorderWidth set the border of the single dimensional selector.
QRect getSpaceForSquare(QRect geom) override
getSpaceForSquare
QRect getSpaceForCircle(QRect geom) override
QRegion getMaskMap() override
getPixmap
QPointF convertShapeCoordinateToWidgetCoordinate(QPointF coordinate) const override
convertShapeCoordinateToWidgetCoordinate