|
Krita Source Code Documentation
|
#include <kis_paint_information.h>
Classes | |
| class | DistanceInformationRegistrar |
| struct | Private |
Public Member Functions | |
| bool | canvasMirroredH () const |
| bool | canvasMirroredV () const |
| qreal | canvasRotation () const |
| int | currentDabSeqNo () const |
| Number of dabs painted since the beginning of the stroke. | |
| qreal | currentTime () const |
| Number of ms since the beginning of the stroke. | |
| qreal | drawingAngle (bool considerLockedAngle=false) const |
| qreal | drawingAngleSafe (const KisDistanceInformation &distance) const |
| XXX !!! :-| Please add dox! | |
| QPointF | drawingDirectionVector () const |
| qreal | drawingDistance () const |
| qreal | drawingSpeed () const |
| bool | isHoveringMode () const |
| KisPaintInformation (const KisPaintInformation &rhs) | |
| KisPaintInformation (const QPointF &pos, qreal pressure, qreal xTilt, qreal yTilt, qreal rotation) | |
| KisPaintInformation (const QPointF &pos, qreal pressure, qreal xTilt, qreal yTilt, qreal rotation, qreal tangentialPressure, qreal perspective, qreal time, qreal speed) | |
| KisPaintInformation (const QPointF &pos=QPointF(), qreal pressure=PRESSURE_DEFAULT) | |
| qreal | maxPressure () const |
| void | mixOtherOnlyPosition (qreal t, const KisPaintInformation &other) |
| void | mixOtherWithoutTime (qreal t, const KisPaintInformation &other) |
| void | operator= (const KisPaintInformation &rhs) |
| void | overrideDrawingAngle (qreal angle) |
| XXX !!! :-| Please add dox! | |
| template<class PaintOp > | |
| void | paintAt (PaintOp &op, KisDistanceInformation *distanceInfo) |
| qreal | perspective () const |
| reciprocal of distance on the perspective grid | |
| KisPerStrokeRandomSourceSP | perStrokeRandomSource () const |
| const QPointF & | pos () const |
| qreal | pressure () const |
| The pressure of the value (from 0.0 to 1.0) | |
| KisRandomSourceSP | randomSource () const |
| DistanceInformationRegistrar | registerDistanceInformation (KisDistanceInformation *distance) |
| qreal | rotation () const |
| rotation as given by the tablet event | |
| void | setCanvasMirroredH (bool value) |
| void | setCanvasMirroredV (bool value) |
| void | setCanvasRotation (qreal rotation) |
| void | setCurrentTime (qreal time) const |
| void | setLevelOfDetail (int levelOfDetail) |
| void | setPerStrokeRandomSource (KisPerStrokeRandomSourceSP value) |
| void | setPos (const QPointF &p) |
| void | setPressure (qreal p) |
| Set the pressure. | |
| void | setRandomSource (KisRandomSourceSP value) |
| void | setTiltDirectionOffset (qreal angle) |
| qreal | tangentialPressure () const |
| tangential pressure (i.e., rate for an airbrush device) | |
| qreal | tiltDirectionOffset () const |
| qreal | totalStrokeLength () const |
| The length of the stroke before painting the current dab. | |
| void | toXML (QDomDocument &, QDomElement &) const |
| qreal | xTilt () const |
| The tilt of the pen on the horizontal axis (from 0.0 to 1.0) | |
| qreal | yTilt () const |
| The tilt of the pen on the vertical axis (from 0.0 to 1.0) | |
| ~KisPaintInformation () | |
Static Public Member Functions | |
| static KisPaintInformation | createHoveringModeInfo (const QPointF &pos, qreal pressure=PRESSURE_DEFAULT, qreal xTilt=0.0, qreal yTilt=0.0, qreal rotation=0.0, qreal tangentialPressure=0.0, qreal perspective=1.0, qreal speed=0.0, qreal canvasrotation=0.0, bool canvasMirroredH=false, bool canvasMirroredV=false, qreal tiltDirectionOffset=0.0) |
| static KisPaintInformation | fromXML (const QDomElement &) |
| static KisPaintInformation | mix (const QPointF &p, qreal t, const KisPaintInformation &p1, const KisPaintInformation &p2) |
| static KisPaintInformation | mix (qreal t, const KisPaintInformation &pi1, const KisPaintInformation &pi2) |
| static KisPaintInformation | mixOnlyPosition (qreal t, const KisPaintInformation &mixedPi, const KisPaintInformation &basePi) |
| (1-t) * p1 + t * p2 | |
| static KisPaintInformation | mixWithoutTime (const QPointF &p, qreal t, const KisPaintInformation &p1, const KisPaintInformation &p2) |
| static KisPaintInformation | mixWithoutTime (qreal t, const KisPaintInformation &pi1, const KisPaintInformation &pi2) |
| static qreal | tiltDirection (const KisPaintInformation &info, bool normalize=true) |
| static qreal | tiltElevation (const KisPaintInformation &info, qreal maxTiltX=60.0, qreal maxTiltY=60.0, bool normalize=true) |
Private Member Functions | |
| void | mixOtherImpl (const QPointF &p, qreal t, const KisPaintInformation &other, bool posOnly, bool mixTime) |
Static Private Member Functions | |
| static KisPaintInformation | mixImpl (const QPointF &p, qreal t, const KisPaintInformation &p1, const KisPaintInformation &p2, bool posOnly, bool mixTime) |
Private Attributes | |
| Private *const | d |
KisPaintInformation contains information about the input event that causes the brush action to happen to the brush engine's paint methods.
XXX: we directly pass the KoPointerEvent x and y tilt to KisPaintInformation, and their range is -60 to +60!
| pos | the position of the paint event in subpixel accuracy |
| pressure | the pressure of the stylus |
| xTilt | the angle between the device (a pen, for example) and the perpendicular in the direction of the x axis. Positive values are towards the bottom of the tablet. The angle is within the range 0 to 1 |
| yTilt | the angle between the device (a pen, for example) and the perpendicular in the direction of the y axis. Positive values are towards the bottom of the tablet. The angle is within the range 0 to . |
| movement | current position minus the last position of the call to paintAt |
| rotation | |
| tangentialPressure | |
| perspective |
Definition at line 50 of file kis_paint_information.h.
| KisPaintInformation::KisPaintInformation | ( | const QPointF & | pos, |
| qreal | pressure, | ||
| qreal | xTilt, | ||
| qreal | yTilt, | ||
| qreal | rotation, | ||
| qreal | tangentialPressure, | ||
| qreal | perspective, | ||
| qreal | time, | ||
| qreal | speed ) |
Create a new KisPaintInformation object.
Definition at line 174 of file kis_paint_information.cc.
| KisPaintInformation::KisPaintInformation | ( | const QPointF & | pos, |
| qreal | pressure, | ||
| qreal | xTilt, | ||
| qreal | yTilt, | ||
| qreal | rotation ) |
| KisPaintInformation::KisPaintInformation | ( | const QPointF & | pos = QPointF(), |
| qreal | pressure = PRESSURE_DEFAULT ) |
| KisPaintInformation::KisPaintInformation | ( | const KisPaintInformation & | rhs | ) |
Definition at line 226 of file kis_paint_information.cc.
| KisPaintInformation::~KisPaintInformation | ( | ) |
| bool KisPaintInformation::canvasMirroredH | ( | ) | const |
Whether the canvas is horizontally mirrored for the paint-operation.
Definition at line 285 of file kis_paint_information.cc.
References KisPaintInformation::Private::canvasMirroredH, and d.
| bool KisPaintInformation::canvasMirroredV | ( | ) | const |
Whether the canvas is vertically mirrored for the paint-operation.
Definition at line 295 of file kis_paint_information.cc.
References KisPaintInformation::Private::canvasMirroredV, and d.
| qreal KisPaintInformation::canvasRotation | ( | ) | const |
Returns the canvas rotation if that has been given to the kispaintinformation.
Definition at line 275 of file kis_paint_information.cc.
References KisPaintInformation::Private::canvasRotation, and d.
|
static |
Create a fake info object with isHoveringMode() property set to true.
Definition at line 248 of file kis_paint_information.cc.
References KisPaintInformation::Private::canvasMirroredH, canvasMirroredH(), KisPaintInformation::Private::canvasMirroredV, canvasMirroredV(), KisPaintInformation::Private::canvasRotation, d, KisPaintInformation::Private::isHoveringMode, perspective(), pos(), pressure(), rotation(), tangentialPressure(), KisPaintInformation::Private::tiltDirectionOffset, tiltDirectionOffset(), xTilt(), and yTilt().
| int KisPaintInformation::currentDabSeqNo | ( | ) | const |
Number of dabs painted since the beginning of the stroke.
Definition at line 487 of file kis_paint_information.cc.
References d, KisPaintInformation::Private::directionHistoryInfo, and warnKrita.
| qreal KisPaintInformation::currentTime | ( | ) | const |
Number of ms since the beginning of the stroke.
Definition at line 482 of file kis_paint_information.cc.
References d, and KisPaintInformation::Private::time.
| qreal KisPaintInformation::drawingAngle | ( | bool | considerLockedAngle = false | ) | const |
Current brush direction computed from the cursor movement
WARNING: this method is available only inside paintAt() call, that is when the distance information is registered.
Definition at line 402 of file kis_paint_information.cc.
References d, KisAlgebra2D::directionBetweenPoints(), KisPaintInformation::Private::directionHistoryInfo, KisPaintInformation::Private::drawingAngleOverride, pos(), and warnKrita.
| qreal KisPaintInformation::drawingAngleSafe | ( | const KisDistanceInformation & | distance | ) | const |
XXX !!! :-| Please add dox!
Definition at line 384 of file kis_paint_information.cc.
References d, KisAlgebra2D::directionBetweenPoints(), KisPaintInformation::Private::directionHistoryInfo, distance(), KisPaintInformation::Private::drawingAngleOverride, KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE, and pos().
| QPointF KisPaintInformation::drawingDirectionVector | ( | ) | const |
Current brush direction vector computed from the cursor movement
WARNING: this method is available only inside paintAt() call, that is when the distance information is registered.
Definition at line 424 of file kis_paint_information.cc.
References drawingAngle().
| qreal KisPaintInformation::drawingDistance | ( | ) | const |
Current distance from the previous dab
WARNING: this method is available only inside paintAt() call, that is when the distance information is registered.
Definition at line 430 of file kis_paint_information.cc.
References d, KisPaintInformation::Private::directionHistoryInfo, length(), KisPaintInformation::Private::levelOfDetail, KisLodTransformBase::lodToInvScale(), pos(), and warnKrita.
| qreal KisPaintInformation::drawingSpeed | ( | ) | const |
Current brush speed computed from the cursor movement
WARNING: this method is available only inside paintAt() call, that is when the distance information is registered.
Definition at line 457 of file kis_paint_information.cc.
References d, and KisPaintInformation::Private::speed.
|
static |
Definition at line 332 of file kis_paint_information.cc.
References KisPaintInformation(), perspective(), pressure(), rotation(), tangentialPressure(), KisDomUtils::toDouble(), xTilt(), and yTilt().
| bool KisPaintInformation::isHoveringMode | ( | ) | const |
The paint information may be generated not only during real stroke when the actual painting is happening, but also when the cursor is hovering the canvas. In this mode some of the sensors work a bit differently. The most outstanding example is Fuzzy sensor, which returns unit value in this mode, otherwise it is too irritating for a user.
This value is true only for paint information objects created with createHoveringModeInfo() constructor.
Definition at line 241 of file kis_paint_information.cc.
References d, and KisPaintInformation::Private::isHoveringMode.
| qreal KisPaintInformation::maxPressure | ( | ) | const |
Maximum pressure that has been known during the stroke
WARNING: this method is available only inside paintAt() call, that is when the distance information is registered.
Definition at line 447 of file kis_paint_information.cc.
References d, KisPaintInformation::Private::directionHistoryInfo, KisPaintInformation::Private::pressure, and warnKrita.
|
static |
Definition at line 575 of file kis_paint_information.cc.
|
static |
Definition at line 569 of file kis_paint_information.cc.
|
staticprivate |
Definition at line 603 of file kis_paint_information.cc.
References mixOtherImpl(), and p.
|
static |
|
private |
Definition at line 610 of file kis_paint_information.cc.
References KisPaintInformation::Private::canvasMirroredH, KisPaintInformation::Private::canvasMirroredV, KisPaintInformation::Private::canvasRotation, currentTime(), d, distance(), drawingSpeed(), incrementInDirection(), KisPaintInformation::Private::isHoveringMode, isHoveringMode(), KIS_ASSERT_RECOVER_NOOP, kisDegreesToRadians(), kisRadiansToDegrees(), KisPaintInformation::Private::levelOfDetail, p, perspective(), KisPaintInformation::Private::perStrokeRandomSource, KisPaintInformation::Private::pos, pressure(), KisPaintInformation::Private::randomSource, rotation(), shortestAngularDistance(), tangentialPressure(), KisPaintInformation::Private::tiltDirectionOffset, xTilt(), and yTilt().
| void KisPaintInformation::mixOtherOnlyPosition | ( | qreal | t, |
| const KisPaintInformation & | other ) |
Definition at line 591 of file kis_paint_information.cc.
References mixOtherImpl(), and pos().
| void KisPaintInformation::mixOtherWithoutTime | ( | qreal | t, |
| const KisPaintInformation & | other ) |
Definition at line 597 of file kis_paint_information.cc.
References mixOtherImpl(), and pos().
|
static |
|
static |
Definition at line 580 of file kis_paint_information.cc.
References mixWithoutTime(), and pos().
| void KisPaintInformation::operator= | ( | const KisPaintInformation & | rhs | ) |
| void KisPaintInformation::overrideDrawingAngle | ( | qreal | angle | ) |
XXX !!! :-| Please add dox!
Definition at line 379 of file kis_paint_information.cc.
References d, and KisPaintInformation::Private::drawingAngleOverride.
|
inline |
Definition at line 100 of file kis_paint_information.h.
References KisDistanceInformation::lockCurrentDrawingAngle(), and KisDistanceInformation::registerPaintedDab().
| qreal KisPaintInformation::perspective | ( | ) | const |
reciprocal of distance on the perspective grid
Definition at line 477 of file kis_paint_information.cc.
References d, and KisPaintInformation::Private::perspective.
| KisPerStrokeRandomSourceSP KisPaintInformation::perStrokeRandomSource | ( | ) | const |
Definition at line 523 of file kis_paint_information.cc.
References d, and KisPaintInformation::Private::perStrokeRandomSource.
| const QPointF & KisPaintInformation::pos | ( | ) | const |
Definition at line 349 of file kis_paint_information.cc.
References d, and KisPaintInformation::Private::pos.
| qreal KisPaintInformation::pressure | ( | ) | const |
The pressure of the value (from 0.0 to 1.0)
Definition at line 359 of file kis_paint_information.cc.
References d, and KisPaintInformation::Private::pressure.
| KisRandomSourceSP KisPaintInformation::randomSource | ( | ) | const |
Definition at line 507 of file kis_paint_information.cc.
References d, kisBacktrace(), and KisPaintInformation::Private::randomSource.
| KisPaintInformation::DistanceInformationRegistrar KisPaintInformation::registerDistanceInformation | ( | KisDistanceInformation * | distance | ) |
Causes the specified distance information to be temporarily registered with this KisPaintInformation object, so that the KisPaintInformation can compute certain values that may be needed at painting time, such as the drawing direction. When the returned object is destroyed, the KisDistanceInformation will be unregistered. At most one KisDistanceInformation can be registered with a given KisPaintInformation at a time.
Definition at line 397 of file kis_paint_information.cc.
References distance().
| qreal KisPaintInformation::rotation | ( | ) | const |
rotation as given by the tablet event
Definition at line 467 of file kis_paint_information.cc.
References d, and KisPaintInformation::Private::rotation.
| void KisPaintInformation::setCanvasMirroredH | ( | bool | value | ) |
Set whether the canvas is horizontally mirrored for the paint-operation.
Definition at line 290 of file kis_paint_information.cc.
References KisPaintInformation::Private::canvasMirroredH, d, and value().
| void KisPaintInformation::setCanvasMirroredV | ( | bool | value | ) |
Set whether the canvas is vertically mirrored for the paint-operation.
Definition at line 300 of file kis_paint_information.cc.
References KisPaintInformation::Private::canvasMirroredV, d, and value().
| void KisPaintInformation::setCanvasRotation | ( | qreal | rotation | ) |
Set the canvas rotation.
Definition at line 280 of file kis_paint_information.cc.
References KisPaintInformation::Private::canvasRotation, d, normalizeAngleDegrees(), and rotation().
| void KisPaintInformation::setCurrentTime | ( | qreal | time | ) | const |
Definition at line 462 of file kis_paint_information.cc.
References d, and KisPaintInformation::Private::time.
| void KisPaintInformation::setLevelOfDetail | ( | int | levelOfDetail | ) |
Definition at line 538 of file kis_paint_information.cc.
References d, and KisPaintInformation::Private::levelOfDetail.
| void KisPaintInformation::setPerStrokeRandomSource | ( | KisPerStrokeRandomSourceSP | value | ) |
Definition at line 533 of file kis_paint_information.cc.
References d, KisPaintInformation::Private::perStrokeRandomSource, and value().
| void KisPaintInformation::setPos | ( | const QPointF & | p | ) |
Definition at line 354 of file kis_paint_information.cc.
References d, p, and KisPaintInformation::Private::pos.
| void KisPaintInformation::setPressure | ( | qreal | p | ) |
Set the pressure.
Definition at line 364 of file kis_paint_information.cc.
References d, p, and KisPaintInformation::Private::pressure.
| void KisPaintInformation::setRandomSource | ( | KisRandomSourceSP | value | ) |
Definition at line 518 of file kis_paint_information.cc.
References d, KisPaintInformation::Private::randomSource, and value().
| void KisPaintInformation::setTiltDirectionOffset | ( | qreal | angle | ) |
Set the tilt direction offset. Will be clamped to [0, 360) degrees.
Definition at line 310 of file kis_paint_information.cc.
References d, normalizeAngleDegrees(), KisPaintInformation::Private::tiltDirectionOffset, and value().
| qreal KisPaintInformation::tangentialPressure | ( | ) | const |
tangential pressure (i.e., rate for an airbrush device)
Definition at line 472 of file kis_paint_information.cc.
References d, and KisPaintInformation::Private::tangentialPressure.
|
static |
When the stylus is in fully vertical position, stick it to a "neutral position", which is a 3 o'clock tilt of the stylus as defined in the Krita documentation.
The normal 0 deg position as returned from Qt is at 6 o'clock tilt of the stylus
Definition at line 651 of file kis_paint_information.cc.
References d, kisDegreesToRadians(), M_PI, qFuzzyIsNull(), KisAlgebra2D::signPZ(), tiltDirection(), KisPaintInformation::Private::tiltDirectionOffset, xTilt(), and yTilt().
| qreal KisPaintInformation::tiltDirectionOffset | ( | ) | const |
Constant offset added to the reported pen tilt direction. [0, 360) degrees.
Definition at line 305 of file kis_paint_information.cc.
References d, and KisPaintInformation::Private::tiltDirectionOffset.
|
static |
Definition at line 687 of file kis_paint_information.cc.
References M_PI, tiltElevation(), xTilt(), and yTilt().
| qreal KisPaintInformation::totalStrokeLength | ( | ) | const |
The length of the stroke before painting the current dab.
Definition at line 497 of file kis_paint_information.cc.
References d, KisPaintInformation::Private::directionHistoryInfo, and warnKrita.
| void KisPaintInformation::toXML | ( | QDomDocument & | , |
| QDomElement & | e ) const |
Definition at line 315 of file kis_paint_information.cc.
References d, KisPaintInformation::Private::isHoveringMode, KIS_ASSERT_RECOVER_NOOP, perspective(), pos(), pressure(), rotation(), KisPaintInformation::Private::speed, tangentialPressure(), KisPaintInformation::Private::time, xTilt(), and yTilt().
| qreal KisPaintInformation::xTilt | ( | ) | const |
The tilt of the pen on the horizontal axis (from 0.0 to 1.0)
Definition at line 369 of file kis_paint_information.cc.
References d, and KisPaintInformation::Private::xTilt.
| qreal KisPaintInformation::yTilt | ( | ) | const |
The tilt of the pen on the vertical axis (from 0.0 to 1.0)
Definition at line 374 of file kis_paint_information.cc.
References d, and KisPaintInformation::Private::yTilt.
|
private |
Definition at line 326 of file kis_paint_information.h.