|
Krita Source Code Documentation
|
The KisHandlePainterHelper class is a special helper for painting handles around objects. It ensures the handles are painted with the same size and line width whatever transformation is setup in the painter. The handles will also be rotated/skewed if the object itself has these transformations. More...
#include <KisHandlePainterHelper.h>
Public Member Functions | |
| void | drawConnectionLine (const QLineF &line) |
| void | drawConnectionLine (const QPointF &p1, const QPointF &p2) |
| void | drawGradientArrow (const QPointF &start, const QPointF &end, qreal radius) |
| void | drawGradientCrossHandle (const QPointF ¢er, qreal radius) |
| void | drawGradientHandle (const QPointF ¢er) |
| void | drawGradientHandle (const QPointF ¢er, qreal radius) |
| void | drawHandleCircle (const QPointF ¢er) |
| void | drawHandleCircle (const QPointF ¢er, qreal radius) |
| void | drawHandleLine (const QLineF &line, qreal width=1.0, QVector< qreal > dashPattern={}, qreal dashOffset=0.0) |
| void | drawHandleRect (const QPointF ¢er) |
| void | drawHandleRect (const QPointF ¢er, qreal radius) |
| void | drawHandleRect (const QPointF ¢er, qreal radius, QPoint offset) |
| void | drawHandleSmallCircle (const QPointF ¢er) |
| void | drawPath (const QPainterPath &path) |
| void | drawPixmap (const QPixmap &pixmap, QPointF position, int size, QRectF sourceRect) |
| void | drawRubberLine (const QPolygonF &poly) |
| void | fillHandleRect (const QPointF ¢er, qreal radius, QColor fillColor, QPoint offset) |
| KisHandlePainterHelper (KisHandlePainterHelper &&rhs) | |
| KisHandlePainterHelper (KisHandlePainterHelper &rhs)=delete | |
| KisHandlePainterHelper (QPainter *_painter, const QTransform &originalPainterTransform, qreal handleRadius, int decorationThickness=1) | |
| KisHandlePainterHelper (QPainter *_painter, qreal handleRadius=0.0, int decorationThickness=1) | |
| void | setHandleStyle (const KisHandleStyle &style) |
| ~KisHandlePainterHelper () | |
Private Member Functions | |
| void | drawArrow (const QPointF &pos, const QPointF &from, qreal radius) |
| void | init () |
Private Attributes | |
| KisAlgebra2D::DecomposedMatrix | m_decomposedMatrix |
| int | m_decorationThickness |
| QPolygonF | m_handlePolygon |
| qreal | m_handleRadius |
| KisHandleStyle | m_handleStyle |
| QTransform | m_handleTransform |
| QTransform | m_originalPainterTransform |
| QPainter * | m_painter |
| QTransform | m_painterTransform |
The KisHandlePainterHelper class is a special helper for painting handles around objects. It ensures the handles are painted with the same size and line width whatever transformation is setup in the painter. The handles will also be rotated/skewed if the object itself has these transformations.
On construction it resets QPainter transformation and on destruction recovers it back.
Please consider using KoShape::createHandlePainterHelper instead of direct construction of the helper. This factory method will also apply the transformations needed for a shape.
Definition at line 34 of file KisHandlePainterHelper.h.
| KisHandlePainterHelper::KisHandlePainterHelper | ( | QPainter * | _painter, |
| qreal | handleRadius = 0.0, | ||
| int | decorationThickness = 1 ) |
Creates the helper, initializes all the internal transformations and resets the transformation of the painter.
Definition at line 16 of file KisHandlePainterHelper.cpp.
References init().
| KisHandlePainterHelper::KisHandlePainterHelper | ( | QPainter * | _painter, |
| const QTransform & | originalPainterTransform, | ||
| qreal | handleRadius, | ||
| int | decorationThickness = 1 ) |
Creates the helper, initializes all the internal transformations and resets the transformation of the painter. This override also adjusts the transformation of the painter into the coordinate system of the shape
Definition at line 27 of file KisHandlePainterHelper.cpp.
References init().
| KisHandlePainterHelper::KisHandlePainterHelper | ( | KisHandlePainterHelper && | rhs | ) |
Move c-tor. Used to create and return the helper from functions by-value.
Definition at line 38 of file KisHandlePainterHelper.cpp.
|
delete |
| KisHandlePainterHelper::~KisHandlePainterHelper | ( | ) |
Restores the transformation of the painter
Definition at line 66 of file KisHandlePainterHelper.cpp.
References m_originalPainterTransform, and m_painter.
|
private |
Draw a single arrow with the tip at position pos, directed from from, of size radius.
Definition at line 230 of file KisHandlePainterHelper.cpp.
References KisHandleStyle::handleIterations, KisHandleStyle::IterationStyle::isValid, KIS_SAFE_ASSERT_RECOVER_RETURN, KisAlgebra2D::leftUnitNormal(), m_decorationThickness, m_handleStyle, m_handleTransform, m_painter, m_painterTransform, p, and KisHandleStyle::IterationStyle::stylePair.
| void KisHandlePainterHelper::drawConnectionLine | ( | const QLineF & | line | ) |
Draw a line connecting two points
Definition at line 295 of file KisHandlePainterHelper.cpp.
References drawConnectionLine().
| void KisHandlePainterHelper::drawConnectionLine | ( | const QPointF & | p1, |
| const QPointF & | p2 ) |
Draw a line connecting two points
Definition at line 300 of file KisHandlePainterHelper.cpp.
References KisHandleStyle::IterationStyle::isValid, KIS_SAFE_ASSERT_RECOVER_RETURN, KisHandleStyle::lineIterations, m_decorationThickness, m_handleStyle, m_painter, m_painterTransform, p1, p2, and KisHandleStyle::IterationStyle::stylePair.
| void KisHandlePainterHelper::drawGradientArrow | ( | const QPointF & | start, |
| const QPointF & | end, | ||
| qreal | radius ) |
Draw an arrow representing gradient position
Definition at line 257 of file KisHandlePainterHelper.cpp.
References drawArrow(), KisHandleStyle::IterationStyle::isValid, KIS_SAFE_ASSERT_RECOVER_RETURN, kisDistance(), length(), KisHandleStyle::lineIterations, m_decorationThickness, m_handleStyle, m_painter, m_painterTransform, p, and KisHandleStyle::IterationStyle::stylePair.
| void KisHandlePainterHelper::drawGradientCrossHandle | ( | const QPointF & | center, |
| qreal | radius ) |
Draw a special handle representing the center of the gradient
Definition at line 190 of file KisHandlePainterHelper.cpp.
References KisHandleStyle::handleIterations, KisHandleStyle::IterationStyle::isValid, KIS_SAFE_ASSERT_RECOVER_RETURN, m_decorationThickness, m_handleStyle, m_handleTransform, m_painter, m_painterTransform, p, and KisHandleStyle::IterationStyle::stylePair.
| void KisHandlePainterHelper::drawGradientHandle | ( | const QPointF & | center | ) |
Draw a rotated handle representing the gradient handle
Definition at line 185 of file KisHandlePainterHelper.cpp.
References drawGradientHandle(), and m_handleRadius.
| void KisHandlePainterHelper::drawGradientHandle | ( | const QPointF & | center, |
| qreal | radius ) |
Draw a rotated handle representing the gradient handle
Definition at line 165 of file KisHandlePainterHelper.cpp.
References KisHandleStyle::handleIterations, KisHandleStyle::IterationStyle::isValid, KIS_SAFE_ASSERT_RECOVER_RETURN, m_decorationThickness, m_handleStyle, m_handleTransform, m_painter, m_painterTransform, and KisHandleStyle::IterationStyle::stylePair.
| void KisHandlePainterHelper::drawHandleCircle | ( | const QPointF & | center | ) |
Optimized version of the drawing method for drawing handles of predefined size
Definition at line 119 of file KisHandlePainterHelper.cpp.
References drawHandleCircle(), and m_handleRadius.
| void KisHandlePainterHelper::drawHandleCircle | ( | const QPointF & | center, |
| qreal | radius ) |
Draws a handle circle with a custom radius at position center
Definition at line 106 of file KisHandlePainterHelper.cpp.
References KisHandleStyle::handleIterations, KisHandleStyle::IterationStyle::isValid, KIS_SAFE_ASSERT_RECOVER_RETURN, m_decorationThickness, m_handleStyle, m_painter, m_painterTransform, and KisHandleStyle::IterationStyle::stylePair.
| void KisHandlePainterHelper::drawHandleLine | ( | const QLineF & | line, |
| qreal | width = 1.0, | ||
| QVector< qreal > | dashPattern = {}, | ||
| qreal | dashOffset = 0.0 ) |
Draws a line in the style of a handle with width indicating the thickness.
Definition at line 129 of file KisHandlePainterHelper.cpp.
References KisHandleStyle::handleIterations, KisHandleStyle::IterationStyle::isValid, KIS_SAFE_ASSERT_RECOVER_RETURN, m_decorationThickness, m_handleStyle, m_painter, m_painterTransform, p, and KisHandleStyle::IterationStyle::stylePair.
| void KisHandlePainterHelper::drawHandleRect | ( | const QPointF & | center | ) |
Optimized version of the drawing method for drawing handles of predefined size
Definition at line 154 of file KisHandlePainterHelper.cpp.
References KisHandleStyle::handleIterations, KisHandleStyle::IterationStyle::isValid, KIS_SAFE_ASSERT_RECOVER_RETURN, m_decorationThickness, m_handlePolygon, m_handleStyle, m_painter, m_painterTransform, and KisHandleStyle::IterationStyle::stylePair.
| void KisHandlePainterHelper::drawHandleRect | ( | const QPointF & | center, |
| qreal | radius ) |
Draws a handle rect with a custom radius at position center
| void KisHandlePainterHelper::drawHandleRect | ( | const QPointF & | center, |
| qreal | radius, | ||
| QPoint | offset = QPoint(0,0) ) |
Definition at line 77 of file KisHandlePainterHelper.cpp.
References KisHandleStyle::handleIterations, KisHandleStyle::IterationStyle::isValid, KIS_SAFE_ASSERT_RECOVER_RETURN, m_decorationThickness, m_handleStyle, m_handleTransform, m_painter, m_painterTransform, and KisHandleStyle::IterationStyle::stylePair.
| void KisHandlePainterHelper::drawHandleSmallCircle | ( | const QPointF & | center | ) |
Optimized version of the drawing method for drawing handles of predefined size
Definition at line 124 of file KisHandlePainterHelper.cpp.
References drawHandleCircle(), and m_handleRadius.
| void KisHandlePainterHelper::drawPath | ( | const QPainterPath & | path | ) |
Draw an arbitrary path
Definition at line 314 of file KisHandlePainterHelper.cpp.
References KisHandleStyle::IterationStyle::isValid, KisHandleStyle::lineIterations, m_decorationThickness, m_handleStyle, m_painter, m_painterTransform, and KisHandleStyle::IterationStyle::stylePair.
| void KisHandlePainterHelper::drawPixmap | ( | const QPixmap & | pixmap, |
| QPointF | position, | ||
| int | size, | ||
| QRectF | sourceRect ) |
Draw an a given pixmap on the UI
Definition at line 325 of file KisHandlePainterHelper.cpp.
References m_painter, and m_painterTransform.
| void KisHandlePainterHelper::drawRubberLine | ( | const QPolygonF & | poly | ) |
Draw a line showing the bounding box of the selection
Definition at line 283 of file KisHandlePainterHelper.cpp.
References KisHandleStyle::IterationStyle::isValid, KIS_SAFE_ASSERT_RECOVER_RETURN, KisHandleStyle::lineIterations, m_decorationThickness, m_handleStyle, m_painter, m_painterTransform, and KisHandleStyle::IterationStyle::stylePair.
| void KisHandlePainterHelper::fillHandleRect | ( | const QPointF & | center, |
| qreal | radius, | ||
| QColor | fillColor, | ||
| QPoint | offset = QPoint(0,0) ) |
Definition at line 340 of file KisHandlePainterHelper.cpp.
References KIS_SAFE_ASSERT_RECOVER_RETURN, m_handleTransform, m_painter, and m_painterTransform.
|
private |
Definition at line 53 of file KisHandlePainterHelper.cpp.
References KisHandleStyle::inheritStyle(), m_decomposedMatrix, m_handlePolygon, m_handleRadius, m_handleStyle, m_handleTransform, m_painter, KisAlgebra2D::DecomposedMatrix::rotateTransform(), and KisAlgebra2D::DecomposedMatrix::shearTransform().
| void KisHandlePainterHelper::setHandleStyle | ( | const KisHandleStyle & | style | ) |
Sets style used for painting the handles. Please use static methods of KisHandleStyle to select predefined styles.
Definition at line 72 of file KisHandlePainterHelper.cpp.
References m_handleStyle.
|
private |
Definition at line 164 of file KisHandlePainterHelper.h.
|
private |
Definition at line 163 of file KisHandlePainterHelper.h.
|
private |
Definition at line 166 of file KisHandlePainterHelper.h.
|
private |
Definition at line 162 of file KisHandlePainterHelper.h.
|
private |
Definition at line 167 of file KisHandlePainterHelper.h.
|
private |
Definition at line 165 of file KisHandlePainterHelper.h.
|
private |
Definition at line 160 of file KisHandlePainterHelper.h.
|
private |
Definition at line 159 of file KisHandlePainterHelper.h.
|
private |
Definition at line 161 of file KisHandlePainterHelper.h.