17#include "canvascursorpainter.h"
22CanvasCursorPainter::CanvasCursorPainter()
27void CanvasCursorPainter::setupPen()
34void CanvasCursorPainter::paint(
QPainter& painter,
const QRect& blitRect)
36 if (mOptions.isAdjusting || mOptions.showCursor) {
37 if (mOptions.useFeather) {
38 paintFeatherCursor(painter, blitRect, mOptions.widthRect, mOptions.featherRect);
47 mOptions = painterOptions;
48 if (mOptions.isAdjusting || mOptions.showCursor) {
52 qreal scale = qSqrt(qPow(viewTransform.
m11(), 2) + qPow(viewTransform.
m21(), 2));
53 mOptions.widthRect.
setSize(mOptions.widthRect.
size() * scale);
55 mOptions.featherRect.
setSize(mOptions.featherRect.
size() * scale);
60void CanvasCursorPainter::paintFeatherCursor(
QPainter& painter,
const QRect& blitRect,
const QRectF& widthCircleBounds,
const QRectF& featherCircleBounds)
64 if (widthCircleBounds.
width() - featherCircleBounds.
width() <= 1) {
71 painter.
setPen(mCursorPen);
83 painter.
setPen(mCursorPen);
88 if (widthCircleBounds.
width() > 8) {
100void CanvasCursorPainter::clearDirty()
102 mDirtyRect =
QRect();
void paintWidthCursor(QPainter &painter, const QRect &blitRect, const QRectF &widthCircleBounds)
precision circular cursor: used for drawing a cursor on the canvas.
RasterOp_SourceXorDestination
void drawEllipse(const QRectF &rectangle)
void drawLine(const QLineF &line)
void setClipRect(const QRectF &rectangle, Qt::ClipOperation operation)
void setCompositionMode(QPainter::CompositionMode mode)
void setPen(const QColor &color)
void setCosmetic(bool cosmetic)
void setWidthF(qreal width)
QPointF center() const const
void moveCenter(const QPointF &position)
void setSize(const QSizeF &size)
QSizeF size() const const
QRect toAlignedRect() const const
qreal width() const const