|
Krita Source Code Documentation
|
#include <PerspectiveAssistant.h>
Inheritance diagram for PerspectiveAssistant:Protected Member Functions | |
| void | drawCache (QPainter &gc, const KisCoordinatesConverter *converter, bool assistantVisible=true) override |
| performance layer where the graphics can be drawn from a cache instead of generated every render update | |
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(). | |
| virtual KisPaintingAssistantHandleSP | firstLocalHandle () const |
| 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. | |
| 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 |
| virtual KisPaintingAssistantHandleSP | secondLocalHandle () const |
| 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) | |
Private Member Functions | |
| bool | getTransform (QPolygonF &polyOut, QTransform &transformOut) const |
| PerspectiveAssistant (const PerspectiveAssistant &rhs, QMap< KisPaintingAssistantHandleSP, KisPaintingAssistantHandleSP > &handleMap) | |
| QPointF | project (const QPointF &pt, const QPointF &strokeBegin, const bool snapToAnyDirection, qreal moveThresholdPt) |
Private Attributes | |
| PerspectiveBasedAssistantHelper::CacheData | m_cache |
| QPointF | m_cachedPoints [4] |
| QPolygonF | m_cachedPolygon |
| QTransform | m_cachedTransform |
| bool | m_cacheValid {false} |
| QLineF | m_snapLine |
| int | m_subdivisions {8} |
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 21 of file PerspectiveAssistant.h.
| PerspectiveAssistant::PerspectiveAssistant | ( | QObject * | parent = 0 | ) |
Definition at line 29 of file PerspectiveAssistant.cc.
|
explicitprivate |
Definition at line 35 of file PerspectiveAssistant.cc.
References m_cachedPoints.
|
overridevirtual |
Implements KisPaintingAssistant.
Definition at line 113 of file PerspectiveAssistant.cc.
References project().
|
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 108 of file PerspectiveAssistant.cc.
References project().
|
overridevirtual |
Implements KisPaintingAssistant.
Definition at line 50 of file PerspectiveAssistant.cc.
References PerspectiveAssistant().
|
overridevirtual |
Implements KisAbstractPerspectiveGrid.
Definition at line 124 of file PerspectiveAssistant.cc.
References PerspectiveBasedAssistantHelper::getTetragon(), KisPaintingAssistant::handles(), and isAssistantComplete().
|
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 131 of file PerspectiveAssistant.cc.
References PerspectiveBasedAssistantHelper::distanceInGrid(), KIS_SAFE_ASSERT_RECOVER_NOOP, m_cache, and m_cacheValid.
|
overridevirtual |
Reimplemented from KisPaintingAssistant.
Definition at line 142 of file PerspectiveAssistant.cc.
References bounds, KisAlgebra2D::cropLineToRect(), KisCoordinatesConverter::documentToWidgetTransform(), KisPaintingAssistant::drawAssistant(), KisPaintingAssistant::drawError(), KisPaintingAssistant::drawPath(), KisPaintingAssistant::drawPreview(), KisPaintingAssistant::drawX(), KisPaintingAssistant::effectiveBrushPosition(), PerspectiveBasedAssistantHelper::getAllConnectedTetragon(), getTransform(), KisPaintingAssistant::handles(), KisAlgebra2D::intersectLineRect(), isAssistantComplete(), KisPaintingAssistant::isSnappingActive(), m_cache, subdivisions(), KisPaintingAssistant::transform(), PerspectiveBasedAssistantHelper::CacheData::vanishingPoint1, and PerspectiveBasedAssistantHelper::CacheData::vanishingPoint2.
|
overrideprotectedvirtual |
performance layer where the graphics can be drawn from a cache instead of generated every render update
Implements KisPaintingAssistant.
Definition at line 264 of file PerspectiveAssistant.cc.
|
overridevirtual |
Reimplemented from KisPaintingAssistant.
Definition at line 118 of file PerspectiveAssistant.cc.
References KisPaintingAssistant::endStroke(), and m_snapLine.
|
overridevirtual |
Implements KisPaintingAssistant.
Definition at line 271 of file PerspectiveAssistant.cc.
References KisPaintingAssistant::handles().
|
private |
Definition at line 281 of file PerspectiveAssistant.cc.
References PerspectiveBasedAssistantHelper::getTetragon(), KisPaintingAssistant::handles(), isAssistantComplete(), m_cache, m_cachedPoints, m_cachedPolygon, m_cachedTransform, m_cacheValid, KisPaintingAssistant::transform(), and PerspectiveBasedAssistantHelper::updateCacheData().
|
overridevirtual |
Implements KisAbstractPerspectiveGrid.
Definition at line 137 of file PerspectiveAssistant.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 318 of file PerspectiveAssistant.cc.
References KisPaintingAssistant::handles().
|
overridevirtual |
Reimplemented from KisPaintingAssistant.
Definition at line 340 of file PerspectiveAssistant.cc.
References setSubdivisions(), and KisDomUtils::toInt().
|
inlineoverridevirtual |
Implements KisPaintingAssistant.
Definition at line 33 of file PerspectiveAssistant.h.
|
private |
Definition at line 55 of file PerspectiveAssistant.cc.
References getTransform(), isAssistantComplete(), m_snapLine, KisAlgebra2D::norm(), KisAlgebra2D::pointToLineDistSquared(), and KisPaintingAssistant::transform().
|
overridevirtual |
Reimplemented from KisPaintingAssistant.
Definition at line 332 of file PerspectiveAssistant.cc.
References subdivisions(), and KisDomUtils::toString().
| void PerspectiveAssistant::setSubdivisions | ( | int | subdivisions | ) |
Definition at line 327 of file PerspectiveAssistant.cc.
References m_subdivisions, and subdivisions().
| int PerspectiveAssistant::subdivisions | ( | ) | const |
Definition at line 323 of file PerspectiveAssistant.cc.
References m_subdivisions.
|
mutableprivate |
Definition at line 67 of file PerspectiveAssistant.h.
|
mutableprivate |
Definition at line 64 of file PerspectiveAssistant.h.
|
mutableprivate |
Definition at line 63 of file PerspectiveAssistant.h.
|
mutableprivate |
Definition at line 62 of file PerspectiveAssistant.h.
|
mutableprivate |
Definition at line 65 of file PerspectiveAssistant.h.
|
private |
Definition at line 60 of file PerspectiveAssistant.h.
|
private |
Definition at line 58 of file PerspectiveAssistant.h.