|
Krita Source Code Documentation
|
#include <kis_painting_assistant.h>
Inheritance diagram for KisPaintingAssistant:Classes | |
| struct | Private |
Static Public Member Functions | |
| static QList< KisPaintingAssistantSP > | cloneAssistantList (const QList< KisPaintingAssistantSP > &list) |
| static double | norm2 (const QPointF &p) |
Protected Member Functions | |
| virtual QRect | boundingRect () const |
| virtual void | drawCache (QPainter &gc, const KisCoordinatesConverter *converter, bool assistantVisible=true)=0 |
| performance layer where the graphics can be drawn from a cache instead of generated every render update | |
| 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) | |
Protected Attributes | |
| QList< KisPaintingAssistantHandleSP > | m_handles |
| bool | m_hasBeenInsideLocalRect {false} |
Private Attributes | |
| Private *const | d |
A KisPaintingAssistant is an object that assist the drawing on the canvas. With this class you can implement virtual equivalent to ruler or compass.
Definition at line 90 of file kis_painting_assistant.h.
| KisPaintingAssistant::KisPaintingAssistant | ( | const QString & | id, |
| const QString & | name ) |
Definition at line 249 of file kis_painting_assistant.cc.
References d, id(), name(), and KisPaintingAssistant::Private::s.
|
virtual |
Definition at line 417 of file kis_painting_assistant.cc.
References d, KisPaintingAssistant::Private::handles, KisPaintingAssistant::Private::sideHandles, and KisPaintingAssistantHandle::unregisterAssistant().
|
explicitprotected |
Definition at line 257 of file kis_painting_assistant.cc.
References _REUSE_H, bottomLeft(), bottomMiddle(), bottomRight(), d, dbgUI, KisPaintingAssistant::Private::handles, leftMiddle(), KisPaintingAssistant::Private::reuseOrCreateHandle(), rightMiddle(), KisPaintingAssistant::Private::sideHandles, topLeft(), topMiddle(), and topRight().
| void KisPaintingAssistant::addHandle | ( | KisPaintingAssistantHandleSP | handle, |
| HandleType | type ) |
Definition at line 449 of file kis_painting_assistant.cc.
References d, KisSharedPtr< T >::data(), KisPaintingAssistant::Private::handles, KisPaintingAssistantHandle::registerAssistant(), KisPaintingAssistantHandle::setType(), SIDE, and KisPaintingAssistant::Private::sideHandles.
|
pure virtual |
|
pure virtual |
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) |
Implemented in VanishingPointAssistant, ConcentricEllipseAssistant, CurvilinearPerspectiveAssistant, EllipseAssistant, FisheyePointAssistant, InfiniteRulerAssistant, ParallelRulerAssistant, PerspectiveAssistant, PerspectiveEllipseAssistant, RulerAssistant, SplineAssistant, and TwoPointAssistant.
| bool KisPaintingAssistant::areTwoPointsClose | ( | const QPointF & | pointOne, |
| const QPointF & | pointTwo ) |
Definition at line 1039 of file kis_painting_assistant.cc.
| QColor KisPaintingAssistant::assistantCustomColor | ( | ) |
Definition at line 234 of file kis_painting_assistant.cc.
References d, and KisPaintingAssistant::Private::s.
| KisPaintingAssistantHandleSP KisPaintingAssistant::bottomLeft | ( | ) |
Definition at line 947 of file kis_painting_assistant.cc.
References KisPaintingAssistant::Private::bottomLeft, and d.
| const KisPaintingAssistantHandleSP KisPaintingAssistant::bottomLeft | ( | ) | const |
Definition at line 952 of file kis_painting_assistant.cc.
References KisPaintingAssistant::Private::bottomLeft, and d.
| KisPaintingAssistantHandleSP KisPaintingAssistant::bottomMiddle | ( | ) |
Definition at line 987 of file kis_painting_assistant.cc.
References KisPaintingAssistant::Private::bottomMiddle, and d.
| const KisPaintingAssistantHandleSP KisPaintingAssistant::bottomMiddle | ( | ) | const |
Definition at line 992 of file kis_painting_assistant.cc.
References KisPaintingAssistant::Private::bottomMiddle, and d.
| KisPaintingAssistantHandleSP KisPaintingAssistant::bottomRight | ( | ) |
Definition at line 967 of file kis_painting_assistant.cc.
References KisPaintingAssistant::Private::bottomRight, and d.
| const KisPaintingAssistantHandleSP KisPaintingAssistant::bottomRight | ( | ) | const |
Definition at line 972 of file kis_painting_assistant.cc.
References KisPaintingAssistant::Private::bottomRight, and d.
|
protectedvirtual |
Reimplemented in ConcentricEllipseAssistant, EllipseAssistant, FisheyePointAssistant, and PerspectiveEllipseAssistant.
Definition at line 543 of file kis_painting_assistant.cc.
References handles().
|
virtual |
canBeLocal
Reimplemented in ParallelRulerAssistant, TwoPointAssistant, and VanishingPointAssistant.
Definition at line 316 of file kis_painting_assistant.cc.
|
pure virtual |
|
static |
clones the list of assistants the originally shared handles will still be shared the cloned assistants do not share any handle with the original assistants
Definition at line 1126 of file kis_painting_assistant.cc.
| KisPaintingAssistantHandleSP KisPaintingAssistant::closestCornerHandleFromPoint | ( | QPointF | point | ) |
Definition at line 1047 of file kis_painting_assistant.cc.
References areTwoPointsClose(), bottomLeft(), bottomRight(), d, pixelToView(), KisPaintingAssistant::Private::s, topLeft(), and topRight().
| void KisPaintingAssistant::copySharedData | ( | KisPaintingAssistantSP | assistant | ) |
Definition at line 188 of file kis_painting_assistant.cc.
References d, and KisPaintingAssistant::Private::s.
|
virtual |
Reimplemented in ConcentricEllipseAssistant, EllipseAssistant, PerspectiveEllipseAssistant, RulerAssistant, SplineAssistant, CurvilinearPerspectiveAssistant, FisheyePointAssistant, InfiniteRulerAssistant, ParallelRulerAssistant, PerspectiveAssistant, TwoPointAssistant, and VanishingPointAssistant.
Definition at line 479 of file kis_painting_assistant.cc.
References boundingRect(), d, KisCoordinatesConverter::documentToWidgetTransform(), drawCache(), findPerspectiveAssistantHandleLocation(), KisPaintingAssistant::Private::s, and transform().
|
protectedpure virtual |
performance layer where the graphics can be drawn from a cache instead of generated every render update
Implemented in ConcentricEllipseAssistant, CurvilinearPerspectiveAssistant, EllipseAssistant, FisheyePointAssistant, ParallelRulerAssistant, PerspectiveAssistant, PerspectiveEllipseAssistant, RulerAssistant, SplineAssistant, TwoPointAssistant, and VanishingPointAssistant.
| void KisPaintingAssistant::drawError | ( | QPainter & | painter, |
| const QPainterPath & | path ) |
Definition at line 390 of file kis_painting_assistant.cc.
References d, KisPaintingAssistant::Private::decorationThickness, and KisPaintingAssistant::Private::errorLineWidth.
| void KisPaintingAssistant::drawPath | ( | QPainter & | painter, |
| const QPainterPath & | path, | ||
| bool | drawActive = true ) |
This will render the final output. The drawCache does rendering most of the time so be sure to check that
Definition at line 362 of file kis_painting_assistant.cc.
References d, KisPaintingAssistant::Private::decorationThickness, effectiveAssistantColor(), and KisPaintingAssistant::Private::mainLineWidth.
| void KisPaintingAssistant::drawPreview | ( | QPainter & | painter, |
| const QPainterPath & | path ) |
Definition at line 379 of file kis_painting_assistant.cc.
References d, effectiveAssistantColor(), and KisPaintingAssistant::Private::previewLineWidth.
| void KisPaintingAssistant::drawX | ( | QPainter & | painter, |
| const QPointF & | pt ) |
Definition at line 400 of file kis_painting_assistant.cc.
References drawPath().
| QPointF KisPaintingAssistant::editorWidgetOffset | ( | ) |
Definition at line 351 of file kis_painting_assistant.cc.
References d, and KisPaintingAssistant::Private::s.
| QColor KisPaintingAssistant::effectiveAssistantColor | ( | ) | const |
Definition at line 244 of file kis_painting_assistant.cc.
References d, and KisPaintingAssistant::Private::s.
|
protected |
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().
Definition at line 1073 of file kis_painting_assistant.cc.
References KisCanvas2::canvasWidget, d, dbgUI, KisCoordinatesConverter::documentToWidget(), and KisPaintingAssistant::Private::s.
|
virtual |
Reimplemented in PerspectiveAssistant, and TwoPointAssistant.
Definition at line 293 of file kis_painting_assistant.cc.
References d, m_hasBeenInsideLocalRect, and KisPaintingAssistant::Private::s.
| void KisPaintingAssistant::findPerspectiveAssistantHandleLocation | ( | ) |
Definition at line 797 of file kis_painting_assistant.cc.
References addHandle(), KisPaintingAssistant::Private::bottomLeft, KisPaintingAssistant::Private::bottomMiddle, KisPaintingAssistant::Private::bottomRight, d, KisSharedPtr< T >::data(), KisPaintingAssistant::Private::handles, KisPaintingAssistant::Private::leftMiddle, oppHandleOne(), KisPaintingAssistant::Private::rightMiddle, KisPaintingAssistant::Private::s, SIDE, KisPaintingAssistant::Private::sideHandles, KisPaintingAssistant::Private::topLeft, KisPaintingAssistant::Private::topMiddle, KisPaintingAssistant::Private::topRight, and KisPaintingAssistantHandle::unregisterAssistant().
|
protectedvirtual |
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 in ParallelRulerAssistant, TwoPointAssistant, and VanishingPointAssistant.
Definition at line 1090 of file kis_painting_assistant.cc.
|
pure virtual |
|
virtual |
Definition at line 311 of file kis_painting_assistant.cc.
References d, getDefaultEditorPosition(), and KisPaintingAssistant::Private::s.
|
protected |
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.
Definition at line 1100 of file kis_painting_assistant.cc.
References bottomRight(), firstLocalHandle(), isLocal(), secondLocalHandle(), and topLeft().
| QList< KisPaintingAssistantHandleSP > KisPaintingAssistant::handles | ( | ) |
Definition at line 1022 of file kis_painting_assistant.cc.
References d, and KisPaintingAssistant::Private::handles.
| const QList< KisPaintingAssistantHandleSP > & KisPaintingAssistant::handles | ( | ) | const |
Definition at line 1017 of file kis_painting_assistant.cc.
References d, and KisPaintingAssistant::Private::handles.
| const QString & KisPaintingAssistant::id | ( | ) | const |
Definition at line 430 of file kis_painting_assistant.cc.
References d, and KisPaintingAssistant::Private::s.
|
protected |
Definition at line 408 of file kis_painting_assistant.cc.
References d, KisPaintingAssistant::Private::handles, and KisPaintingAssistantHandle::registerAssistant().
|
virtual |
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 in ConcentricEllipseAssistant, CurvilinearPerspectiveAssistant, EllipseAssistant, FisheyePointAssistant, InfiniteRulerAssistant, ParallelRulerAssistant, PerspectiveAssistant, PerspectiveEllipseAssistant, RulerAssistant, SplineAssistant, TwoPointAssistant, and VanishingPointAssistant.
Definition at line 552 of file kis_painting_assistant.cc.
| bool KisPaintingAssistant::isDuplicating | ( | ) |
isDuplicating
Definition at line 346 of file kis_painting_assistant.cc.
References d, and KisPaintingAssistant::Private::s.
| bool KisPaintingAssistant::isLocal | ( | ) | const |
isLocal
Definition at line 321 of file kis_painting_assistant.cc.
References d, and KisPaintingAssistant::Private::s.
| bool KisPaintingAssistant::isLocked | ( | ) |
isLocked
Definition at line 331 of file kis_painting_assistant.cc.
References d, and KisPaintingAssistant::Private::s.
| bool KisPaintingAssistant::isSnappingActive | ( | ) | const |
Definition at line 283 of file kis_painting_assistant.cc.
References d, and KisPaintingAssistant::Private::s.
| KisPaintingAssistantHandleSP KisPaintingAssistant::leftMiddle | ( | ) |
Definition at line 1007 of file kis_painting_assistant.cc.
References d, and KisPaintingAssistant::Private::leftMiddle.
| const KisPaintingAssistantHandleSP KisPaintingAssistant::leftMiddle | ( | ) | const |
Definition at line 1012 of file kis_painting_assistant.cc.
References d, and KisPaintingAssistant::Private::leftMiddle.
|
virtual |
Reimplemented in ParallelRulerAssistant, PerspectiveAssistant, RulerAssistant, TwoPointAssistant, and VanishingPointAssistant.
Definition at line 715 of file kis_painting_assistant.cc.
| void KisPaintingAssistant::loadXml | ( | KoStore * | store, |
| QMap< int, KisPaintingAssistantHandleSP > & | handleMap, | ||
| QString | path ) |
Definition at line 631 of file kis_painting_assistant.cc.
References addHandle(), KoStore::close(), loadCustomXml(), NORMAL, KoStore::open(), KisDomUtils::qStringToQColor(), KoStore::read(), setAssistantCustomColor(), setEditorWidgetOffset(), setLocked(), setSnappingActive(), setUseCustomColor(), SIDE, KoStore::size(), and useCustomColor().
| const QString & KisPaintingAssistant::name | ( | ) | const |
Definition at line 435 of file kis_painting_assistant.cc.
References d, and KisPaintingAssistant::Private::s.
|
static |
|
pure virtual |
| KisPaintingAssistantHandleSP KisPaintingAssistant::oppHandleOne | ( | ) |
Definition at line 918 of file kis_painting_assistant.cc.
References d, and KisPaintingAssistant::Private::handles.
|
protected |
Definition at line 1067 of file kis_painting_assistant.cc.
References d, and KisPaintingAssistant::Private::s.
| void KisPaintingAssistant::replaceHandle | ( | KisPaintingAssistantHandleSP | _handle, |
| KisPaintingAssistantHandleSP | _with ) |
Definition at line 440 of file kis_painting_assistant.cc.
References d, KisPaintingAssistant::Private::handles, KisPaintingAssistantHandle::registerAssistant(), and KisPaintingAssistantHandle::unregisterAssistant().
| KisPaintingAssistantHandleSP KisPaintingAssistant::rightMiddle | ( | ) |
Definition at line 997 of file kis_painting_assistant.cc.
References d, and KisPaintingAssistant::Private::rightMiddle.
| const KisPaintingAssistantHandleSP KisPaintingAssistant::rightMiddle | ( | ) | const |
Definition at line 1002 of file kis_painting_assistant.cc.
References d, and KisPaintingAssistant::Private::rightMiddle.
|
virtual |
Reimplemented in ParallelRulerAssistant, PerspectiveAssistant, RulerAssistant, TwoPointAssistant, and VanishingPointAssistant.
Definition at line 626 of file kis_painting_assistant.cc.
| QByteArray KisPaintingAssistant::saveXml | ( | QMap< KisPaintingAssistantHandleSP, int > & | handleMap | ) |
Definition at line 574 of file kis_painting_assistant.cc.
References d, KisPaintingAssistant::Private::handles, KisDomUtils::qColorToQString(), KisPaintingAssistant::Private::s, saveCustomXml(), and KisPaintingAssistant::Private::sideHandles.
| void KisPaintingAssistant::saveXmlList | ( | QDomDocument & | doc, |
| QDomElement & | assistantsElement, | ||
| int | count ) |
Definition at line 721 of file kis_painting_assistant.cc.
References d, and KisPaintingAssistant::Private::s.
|
protectedvirtual |
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 in ParallelRulerAssistant, TwoPointAssistant, and VanishingPointAssistant.
Definition at line 1095 of file kis_painting_assistant.cc.
|
virtual |
Definition at line 300 of file kis_painting_assistant.cc.
References d, and KisPaintingAssistant::Private::s.
| void KisPaintingAssistant::setAssistantCustomColor | ( | QColor | color | ) |
Definition at line 229 of file kis_painting_assistant.cc.
References d, and KisPaintingAssistant::Private::s.
| void KisPaintingAssistant::setAssistantGlobalColorCache | ( | const QColor & | color | ) |
Definition at line 239 of file kis_painting_assistant.cc.
References d, and KisPaintingAssistant::Private::s.
| void KisPaintingAssistant::setDecorationThickness | ( | int | thickness | ) |
Definition at line 1121 of file kis_painting_assistant.cc.
References d, and KisPaintingAssistant::Private::decorationThickness.
| void KisPaintingAssistant::setDuplicating | ( | bool | value | ) |
setDuplicating
| value | setter function sets the indication that the duplication button is pressed |
Definition at line 341 of file kis_painting_assistant.cc.
References d, KisPaintingAssistant::Private::s, and value().
| void KisPaintingAssistant::setEditorWidgetOffset | ( | QPointF | offset | ) |
Definition at line 356 of file kis_painting_assistant.cc.
References d, and KisPaintingAssistant::Private::s.
|
virtual |
Definition at line 306 of file kis_painting_assistant.cc.
References d, and KisPaintingAssistant::Private::s.
| void KisPaintingAssistant::setLocal | ( | bool | value | ) |
setLocal
| value | set the indication if the assistant is limited to a rectangular area or not |
Definition at line 326 of file kis_painting_assistant.cc.
References d, KisPaintingAssistant::Private::s, and value().
| void KisPaintingAssistant::setLocked | ( | bool | value | ) |
setLocked
| value | set the indication if the assistant is locked (= cannot be moved, or edited in any way) or not |
Definition at line 336 of file kis_painting_assistant.cc.
References d, KisPaintingAssistant::Private::s, and value().
| void KisPaintingAssistant::setSnappingActive | ( | bool | set | ) |
Definition at line 288 of file kis_painting_assistant.cc.
References d, and KisPaintingAssistant::Private::s.
| void KisPaintingAssistant::setUseCustomColor | ( | bool | useCustomColor | ) |
Definition at line 224 of file kis_painting_assistant.cc.
References d, KisPaintingAssistant::Private::s, and useCustomColor().
| QList< KisPaintingAssistantHandleSP > KisPaintingAssistant::sideHandles | ( | ) |
Definition at line 1032 of file kis_painting_assistant.cc.
References d, and KisPaintingAssistant::Private::sideHandles.
| const QList< KisPaintingAssistantHandleSP > & KisPaintingAssistant::sideHandles | ( | ) | const |
Definition at line 1027 of file kis_painting_assistant.cc.
References d, and KisPaintingAssistant::Private::sideHandles.
| KisPaintingAssistantHandleSP KisPaintingAssistant::topLeft | ( | ) |
Definition at line 937 of file kis_painting_assistant.cc.
References d, and KisPaintingAssistant::Private::topLeft.
| const KisPaintingAssistantHandleSP KisPaintingAssistant::topLeft | ( | ) | const |
Get the topLeft, bottomLeft, topRight and BottomRight corners of the assistant Some assistants like the perspective grid have custom logic built around certain handles
Definition at line 942 of file kis_painting_assistant.cc.
References d, and KisPaintingAssistant::Private::topLeft.
| KisPaintingAssistantHandleSP KisPaintingAssistant::topMiddle | ( | ) |
Definition at line 977 of file kis_painting_assistant.cc.
References d, and KisPaintingAssistant::Private::topMiddle.
| const KisPaintingAssistantHandleSP KisPaintingAssistant::topMiddle | ( | ) | const |
Definition at line 982 of file kis_painting_assistant.cc.
References d, and KisPaintingAssistant::Private::topMiddle.
| KisPaintingAssistantHandleSP KisPaintingAssistant::topRight | ( | ) |
Definition at line 957 of file kis_painting_assistant.cc.
References d, and KisPaintingAssistant::Private::topRight.
| const KisPaintingAssistantHandleSP KisPaintingAssistant::topRight | ( | ) | const |
Definition at line 962 of file kis_painting_assistant.cc.
References d, and KisPaintingAssistant::Private::topRight.
|
virtual |
Transform the assistant using the given transform. Please note that transform should be in 'document' coordinate system. Used with image-wide transformations.
Reimplemented in ConcentricEllipseAssistant, and EllipseAssistant.
Definition at line 557 of file kis_painting_assistant.cc.
References KisPaintingAssistantHandle::chiefAssistant(), handles(), sideHandles(), transform(), and uncache().
| void KisPaintingAssistant::uncache | ( | ) |
Definition at line 538 of file kis_painting_assistant.cc.
References d, and KisPaintingAssistant::Private::s.
| bool KisPaintingAssistant::useCustomColor | ( | ) |
Definition at line 219 of file kis_painting_assistant.cc.
References d, and KisPaintingAssistant::Private::s.
| QPointF KisPaintingAssistant::viewportConstrainedEditorPosition | ( | const KisCoordinatesConverter * | converter, |
| const QSize | editorSize ) |
Definition at line 462 of file kis_painting_assistant.cc.
References KisCoordinatesConverter::documentToWidgetTransform(), KisCoordinatesConverter::getCanvasWidgetSize(), getEditorPosition(), and KisCoordinatesConverter::widgetToDocument().
|
private |
Definition at line 311 of file kis_painting_assistant.h.
|
protected |
Definition at line 259 of file kis_painting_assistant.h.
|
protected |
Definition at line 307 of file kis_painting_assistant.h.