|
Krita Source Code Documentation
|
#include <VanishingPointAssistant.h>
Inheritance diagram for VanishingPointAssistant:Public Types | |
| enum | VanishingPointAssistantHandle { VanishingPointHandle , LocalFirstHandle , LocalSecondHandle } |
Protected Member Functions | |
| void | drawAssistant (QPainter &gc, const QRectF &updateRect, const KisCoordinatesConverter *converter, bool cached=true, KisCanvas2 *canvas=nullptr, bool assistantVisible=true, bool previewVisible=true) override |
| 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 | |
| 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 | |
| QPointF | project (const QPointF &pt, const QPointF &strokeBegin, qreal moveThresholdPt) |
| VanishingPointAssistant (const VanishingPointAssistant &rhs, QMap< KisPaintingAssistantHandleSP, KisPaintingAssistantHandleSP > &handleMap) | |
Private Attributes | |
| KisCanvas2 * | m_canvas {nullptr} |
| float | m_referenceLineDensity {15.0} |
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 31 of file VanishingPointAssistant.h.
| Enumerator | |
|---|---|
| VanishingPointHandle | |
| LocalFirstHandle | |
| LocalSecondHandle | |
Definition at line 36 of file VanishingPointAssistant.h.
| VanishingPointAssistant::VanishingPointAssistant | ( | ) |
Definition at line 26 of file VanishingPointAssistant.cc.
|
explicitprivate |
Definition at line 31 of file VanishingPointAssistant.cc.
|
overridevirtual |
Implements KisPaintingAssistant.
Definition at line 78 of file VanishingPointAssistant.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 73 of file VanishingPointAssistant.cc.
References project().
|
overridevirtual |
canBeLocal
Reimplemented from KisPaintingAssistant.
Definition at line 298 of file VanishingPointAssistant.cc.
|
overridevirtual |
Implements KisPaintingAssistant.
Definition at line 38 of file VanishingPointAssistant.cc.
References VanishingPointAssistant().
|
overrideprotectedvirtual |
Reimplemented from KisPaintingAssistant.
Definition at line 83 of file VanishingPointAssistant.cc.
References KisPaintingAssistant::addHandle(), KisAlgebra2D::cropLineToConvexPolygon(), KisCoordinatesConverter::documentToWidgetTransform(), KisPaintingAssistant::drawAssistant(), KisPaintingAssistant::drawPath(), KisPaintingAssistant::drawPreview(), KisPaintingAssistant::effectiveAssistantColor(), KisPaintingAssistant::effectiveBrushPosition(), KisPaintingAssistant::getLocalRect(), KisPaintingAssistant::handles(), KisAlgebra2D::intersectLineConvexPolygon(), isAssistantComplete(), KisPaintingAssistantsDecoration::isEditingAssistants(), KisPaintingAssistant::isLocal(), KisPaintingAssistant::isSnappingActive(), LocalFirstHandle, LocalSecondHandle, M_PI, m_referenceLineDensity, p0, p1, p2, p3, KisCanvas2::paintingAssistantsDecoration(), SIDE, 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 224 of file VanishingPointAssistant.cc.
References KisCoordinatesConverter::documentToWidgetTransform(), KisPaintingAssistant::drawPath(), KisPaintingAssistant::handles(), isAssistantComplete(), KisPaintingAssistantsDecoration::isEditingAssistants(), KisPaintingAssistant::isSnappingActive(), m_canvas, p0, and KisCanvas2::paintingAssistantsDecoration().
|
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 249 of file VanishingPointAssistant.cc.
References KisPaintingAssistant::handles(), and LocalFirstHandle.
|
overridevirtual |
Implements KisPaintingAssistant.
Definition at line 267 of file VanishingPointAssistant.cc.
References KisPaintingAssistant::handles(), and KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE.
|
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 293 of file VanishingPointAssistant.cc.
References KisPaintingAssistant::handles(), and numHandles().
|
overridevirtual |
Reimplemented from KisPaintingAssistant.
Definition at line 313 of file VanishingPointAssistant.cc.
References KisPaintingAssistant::setLocal(), setReferenceLineDensity(), KisDomUtils::toDouble(), and KisDomUtils::toInt().
|
inlineoverridevirtual |
Implements KisPaintingAssistant.
Definition at line 46 of file VanishingPointAssistant.h.
References KisPaintingAssistant::isLocal().
|
private |
Definition at line 43 of file VanishingPointAssistant.cc.
References KisPaintingAssistant::getLocalRect(), KisPaintingAssistant::handles(), isAssistantComplete(), KisPaintingAssistant::isLocal(), and KisPaintingAssistant::m_hasBeenInsideLocalRect.
| float VanishingPointAssistant::referenceLineDensity | ( | ) |
Definition at line 288 of file VanishingPointAssistant.cc.
References m_referenceLineDensity.
|
overridevirtual |
Reimplemented from KisPaintingAssistant.
Definition at line 303 of file VanishingPointAssistant.cc.
References KisPaintingAssistant::isLocal(), referenceLineDensity(), and KisDomUtils::toString().
|
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 258 of file VanishingPointAssistant.cc.
References KisPaintingAssistant::handles(), and LocalSecondHandle.
| void VanishingPointAssistant::setReferenceLineDensity | ( | float | value | ) |
Definition at line 278 of file VanishingPointAssistant.cc.
References m_referenceLineDensity, and value().
|
private |
Definition at line 70 of file VanishingPointAssistant.h.
|
private |
Definition at line 72 of file VanishingPointAssistant.h.