|
Krita Source Code Documentation
|
#include <TwoPointAssistant.h>
Inheritance diagram for TwoPointAssistant:Public Types | |
| enum | TwoPointHandle { FirstHandle , SecondHandle , VerticalHandle , LocalFirstHandle , LocalSecondHandle } |
Protected Member Functions | |
| void | drawAssistant (QPainter &gc, const QRectF &updateRect, const KisCoordinatesConverter *converter, const KoColorDisplayRendererInterface *displayRenderInterface, bool cached=true, KisCanvas2 *canvas=nullptr, bool assistantVisible=true, bool previewVisible=true) override |
| void | drawCache (QPainter &gc, const KisCoordinatesConverter *converter, const KoColorDisplayRendererInterface *displayRenderInterface, bool assistantVisible=true) override |
| performance layer where the graphics can be drawn from a cache instead of generated every render update | |
| KisPaintingAssistantHandleSP | firstLocalHandle () const override |
| firstLocalHandle Note: this doesn't guarantee it will be the topleft corner! For that, use getLocalRect().topLeft() The only purpose of those functions to exist is to be able to put getLocalRect() function in the KisPaintingAssistant instead of reimplementing it in every specific assistant. | |
| KisPaintingAssistantHandleSP | secondLocalHandle () const override |
| secondLocalHandle Note: this doesn't guarantee it will be the bottomRight corner! For that, use getLocalRect().bottomRight() (and remember that for QRect bottomRight() works differently than for QRectF, so don't convert to QRect before accessing the corner) | |
Protected Member Functions inherited from KisPaintingAssistant | |
| virtual QRect | boundingRect () const |
| QPointF | effectiveBrushPosition (const KisCoordinatesConverter *converter, KisCanvas2 *canvas) const |
| Query the effective brush position to be used for preview lines. This is intended to be used for painting the dynamic preview lines for assistants that feature them. Affected by setAdjustedBrushPosition() and setFollowBrushPosition(). | |
| QRectF | getLocalRect () const |
| getLocalRect The function deals with local handles not being topLeft and bottomRight gracefully and returns a correct rectangle. Thanks to that the user can place handles in a "wrong" order or move them around but the local rectangle will still be correct. | |
| void | initHandles (QList< KisPaintingAssistantHandleSP > _handles) |
| KisPaintingAssistant (const KisPaintingAssistant &rhs, QMap< KisPaintingAssistantHandleSP, KisPaintingAssistantHandleSP > &handleMap) | |
| QPointF | pixelToView (const QPoint pixelCoords) const |
Private Member Functions | |
| bool | localPerspectiveData (const QPointF &point, QPointF *localPoint, qreal *size) const |
| QPointF | project (const QPointF &pt, const QPointF &strokeBegin, const bool snapToAny, qreal moveThreshold) |
| TwoPointAssistant (const TwoPointAssistant &rhs, QMap< KisPaintingAssistantHandleSP, KisPaintingAssistantHandleSP > &handleMap) | |
Private Attributes | |
| KisCanvas2 * | m_canvas {nullptr} |
| double | m_gridDensity {1.0} |
| int | m_lastUsedPoint {-1} |
| QLineF | m_snapLine |
| bool | m_useVertical {true} |
Additional Inherited Members | |
Static Public Member Functions inherited from KisPaintingAssistant | |
| static QList< KisPaintingAssistantSP > | cloneAssistantList (const QList< KisPaintingAssistantSP > &list) |
| static double | norm2 (const QPointF &p) |
Protected Attributes inherited from KisPaintingAssistant | |
| QList< KisPaintingAssistantHandleSP > | m_handles |
| bool | m_hasBeenInsideLocalRect {false} |
Definition at line 18 of file TwoPointAssistant.h.
| Enumerator | |
|---|---|
| FirstHandle | |
| SecondHandle | |
| VerticalHandle | |
| LocalFirstHandle | |
| LocalSecondHandle | |
Definition at line 23 of file TwoPointAssistant.h.
| TwoPointAssistant::TwoPointAssistant | ( | ) |
Definition at line 28 of file TwoPointAssistant.cc.
|
explicitprivate |
Definition at line 34 of file TwoPointAssistant.cc.
|
overridevirtual |
Implements KisPaintingAssistant.
Definition at line 149 of file TwoPointAssistant.cc.
|
overridevirtual |
Adjust the position given in parameter.
| point | the coordinates in point in the document reference |
| strokeBegin | the coordinates of the beginning of the stroke |
| snapToAny | because now assistants can be composited out of multiple inside assistants. snapToAny true means that you can use any of the inside assistant, while it being false means you should use the last used one. The logic determining when it happens (first stroke etc.) is in the decoration, so those two options are enough. |
| moveThresholdPt | the threshold for the "move" of the cursor measured in pt (usually equals to 2px in screen coordinates converted to pt) |
Implements KisPaintingAssistant.
Definition at line 144 of file TwoPointAssistant.cc.
References project().
|
overridevirtual |
canBeLocal
Reimplemented from KisPaintingAssistant.
Definition at line 490 of file TwoPointAssistant.cc.
|
overridevirtual |
Implements KisPaintingAssistant.
Definition at line 45 of file TwoPointAssistant.cc.
References TwoPointAssistant().
|
overridevirtual |
Implements KisAbstractPerspectiveGrid.
Definition at line 528 of file TwoPointAssistant.cc.
References contains(), KisPaintingAssistant::getLocalRect(), KisPaintingAssistant::handles(), KisPaintingAssistant::isLocal(), localPerspectiveData(), numHandles(), and qFuzzyCompare().
|
overridevirtual |
Returns the reciprocal of the distance from the given point to the 'observer', in the range [0, 1] where 0 = infinite distance and 1 = closest.
Implements KisAbstractPerspectiveGrid.
Definition at line 546 of file TwoPointAssistant.cc.
References localPerspectiveData().
|
overrideprotectedvirtual |
Reimplemented from KisPaintingAssistant.
Definition at line 155 of file TwoPointAssistant.cc.
References KoColorDisplayRendererInterface::convertColorToDisplayColorSpace(), KisAlgebra2D::cropLineToConvexPolygon(), KisCoordinatesConverter::documentToWidgetTransform(), KisPaintingAssistant::drawPath(), KisPaintingAssistant::drawPreview(), KisPaintingAssistant::effectiveAssistantColor(), KisPaintingAssistant::effectiveBrushPosition(), KisPaintingAssistant::getLocalRect(), KisPaintingAssistant::handles(), KoColorSpaceRegistry::instance(), KisAlgebra2D::intersectLineRect(), KisPaintingAssistantsDecoration::isEditingAssistants(), KisPaintingAssistant::isLocal(), KisPaintingAssistant::isSnappingActive(), length(), LocalFirstHandle, LocalSecondHandle, localTransform(), m_gridDensity, M_PI, m_useVertical, p, p1, p2, p3, KisCanvas2::paintingAssistantsDecoration(), and KisPaintingAssistant::sideHandles().
|
overrideprotectedvirtual |
performance layer where the graphics can be drawn from a cache instead of generated every render update
Implements KisPaintingAssistant.
Definition at line 404 of file TwoPointAssistant.cc.
References isAssistantComplete(), KisPaintingAssistantsDecoration::isEditingAssistants(), m_canvas, and KisCanvas2::paintingAssistantsDecoration().
|
overridevirtual |
Reimplemented from KisPaintingAssistant.
Definition at line 137 of file TwoPointAssistant.cc.
References KisPaintingAssistant::endStroke(), m_lastUsedPoint, and m_snapLine.
|
overrideprotectedvirtual |
firstLocalHandle Note: this doesn't guarantee it will be the topleft corner! For that, use getLocalRect().topLeft() The only purpose of those functions to exist is to be able to put getLocalRect() function in the KisPaintingAssistant instead of reimplementing it in every specific assistant.
Reimplemented from KisPaintingAssistant.
Definition at line 419 of file TwoPointAssistant.cc.
References KisPaintingAssistant::handles(), and LocalFirstHandle.
|
overridevirtual |
Implements KisPaintingAssistant.
Definition at line 437 of file TwoPointAssistant.cc.
References KisPaintingAssistant::handles(), and KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE.
| double TwoPointAssistant::gridDensity | ( | ) |
Definition at line 466 of file TwoPointAssistant.cc.
References m_gridDensity.
|
overridevirtual |
Implements KisAbstractPerspectiveGrid.
Definition at line 558 of file TwoPointAssistant.cc.
References KisPaintingAssistant::isSnappingActive().
|
overridevirtual |
determines if the assistant has enough handles to be considered created new assistants get in a "creation" phase where they are currently being made on the canvas it will return false if we are in the middle of creating the assistant.
Reimplemented from KisPaintingAssistant.
Definition at line 485 of file TwoPointAssistant.cc.
References KisPaintingAssistant::handles(), and numHandles().
|
overridevirtual |
Reimplemented from KisPaintingAssistant.
Definition at line 577 of file TwoPointAssistant.cc.
References setGridDensity(), KisPaintingAssistant::setLocal(), setUseVertical(), KisDomUtils::toDouble(), and KisDomUtils::toInt().
|
private |
Definition at line 495 of file TwoPointAssistant.cc.
References FirstHandle, KisPaintingAssistant::handles(), isAssistantComplete(), localTransform(), SecondHandle, KisPaintingAssistant::transform(), and VerticalHandle.
| QTransform TwoPointAssistant::localTransform | ( | QPointF | vp_a, |
| QPointF | vp_b, | ||
| QPointF | pt_c, | ||
| qreal * | size ) const |
Definition at line 471 of file TwoPointAssistant.cc.
|
inlineoverridevirtual |
Implements KisPaintingAssistant.
Definition at line 39 of file TwoPointAssistant.h.
References KisPaintingAssistant::isLocal().
|
private |
Definition at line 50 of file TwoPointAssistant.cc.
References KisPaintingAssistant::getLocalRect(), KisPaintingAssistant::handles(), isAssistantComplete(), KisPaintingAssistant::isLocal(), KisPaintingAssistant::m_hasBeenInsideLocalRect, m_lastUsedPoint, m_useVertical, and KisAlgebra2D::norm().
|
overridevirtual |
Reimplemented from KisPaintingAssistant.
Definition at line 563 of file TwoPointAssistant.cc.
References gridDensity(), KisPaintingAssistant::isLocal(), KisDomUtils::toString(), and useVertical().
|
overrideprotectedvirtual |
secondLocalHandle Note: this doesn't guarantee it will be the bottomRight corner! For that, use getLocalRect().bottomRight() (and remember that for QRect bottomRight() works differently than for QRectF, so don't convert to QRect before accessing the corner)
Reimplemented from KisPaintingAssistant.
Definition at line 428 of file TwoPointAssistant.cc.
References KisPaintingAssistant::handles(), and LocalSecondHandle.
| void TwoPointAssistant::setGridDensity | ( | double | density | ) |
Definition at line 451 of file TwoPointAssistant.cc.
References m_gridDensity.
| void TwoPointAssistant::setUseVertical | ( | bool | value | ) |
Definition at line 461 of file TwoPointAssistant.cc.
References m_useVertical, and value().
| bool TwoPointAssistant::useVertical | ( | ) |
Definition at line 456 of file TwoPointAssistant.cc.
References m_useVertical.
|
private |
Definition at line 86 of file TwoPointAssistant.h.
|
private |
Definition at line 89 of file TwoPointAssistant.h.
|
private |
Definition at line 92 of file TwoPointAssistant.h.
|
private |
Definition at line 88 of file TwoPointAssistant.h.
|
private |
Definition at line 90 of file TwoPointAssistant.h.