Krita Source Code Documentation
Loading...
Searching...
No Matches
KisBezierPatchParamToSourceSampler Struct Reference

#include <KisBezierPatchParamToSourceSampler.h>

Public Types

using Range = KisBezierUtils::Range
 

Public Member Functions

 KisBezierPatchParamToSourceSampler (const KisBezierPatch &_patch)
 
QPointF point (const QPointF &pt) const
 
QPointF point (qreal xParam, qreal yParam) const
 
Range xRange (qreal xParam) const
 
Range yRange (qreal yParam) const
 

Public Attributes

qreal bottomLength
 
qreal leftLength
 
KisBezierPatch patch
 
qreal rightLength
 
qreal topLength
 

Detailed Description

A simple class that maps param-space point of a bezier patch into the source-range

Definition at line 16 of file KisBezierPatchParamToSourceSampler.h.

Member Typedef Documentation

◆ Range

Constructor & Destructor Documentation

◆ KisBezierPatchParamToSourceSampler()

KisBezierPatchParamToSourceSampler::KisBezierPatchParamToSourceSampler ( const KisBezierPatch & _patch)
inline

Definition at line 20 of file KisBezierPatchParamToSourceSampler.h.

21 : patch(_patch)
26 {}
std::array< QPointF, 12 > points
qreal curveLength(const QPointF p0, const QPointF p1, const QPointF p2, const QPointF p3, const qreal error)

Member Function Documentation

◆ point() [1/2]

QPointF KisBezierPatchParamToSourceSampler::point ( const QPointF & pt) const
inline

Definition at line 77 of file KisBezierPatchParamToSourceSampler.h.

77 {
78 return point(pt.x(), pt.y());
79 }
QPointF point(qreal xParam, qreal yParam) const

References point().

◆ point() [2/2]

QPointF KisBezierPatchParamToSourceSampler::point ( qreal xParam,
qreal yParam ) const
inline

Definition at line 66 of file KisBezierPatchParamToSourceSampler.h.

67 {
69
70 const Range xRange = this->xRange(xParam);
71 const Range yRange = this->yRange(yParam);
72
73 return QPointF(lerp(xRange.start, xRange.end, yParam),
74 lerp(yRange.start, yRange.end, xParam));
75 }
QPointF lerp(const QPointF &p1, const QPointF &p2, qreal t)
Point lerp(const Point &pt1, const Point &pt2, qreal t)

References KisBezierUtils::Range::end, KisAlgebra2D::lerp(), lerp(), KisBezierUtils::Range::start, xRange(), and yRange().

◆ xRange()

Range KisBezierPatchParamToSourceSampler::xRange ( qreal xParam) const
inline

Definition at line 36 of file KisBezierPatchParamToSourceSampler.h.

37 {
40
41 xCoord1 = patch.originalRect.left() + xCoord1 * patch.originalRect.width();
42 xCoord2 = patch.originalRect.left() + xCoord2 * patch.originalRect.width();
43
44 if (xCoord1 > xCoord2) {
45 std::swap(xCoord1, xCoord2);
46 }
47
48 return {xCoord1, xCoord2};
49 };
qreal curveLengthAtPoint(const QPointF p0, const QPointF p1, const QPointF p2, const QPointF p3, qreal t, const qreal error)

References KisBezierPatch::BL, KisBezierPatch::BL_HC, bottomLength, KisBezierPatch::BR, KisBezierPatch::BR_HC, KisBezierUtils::curveLengthAtPoint(), KisBezierPatch::originalRect, patch, KisBezierPatch::points, KisBezierPatch::TL, KisBezierPatch::TL_HC, topLength, KisBezierPatch::TR, and KisBezierPatch::TR_HC.

◆ yRange()

Member Data Documentation

◆ bottomLength

qreal KisBezierPatchParamToSourceSampler::bottomLength

Definition at line 31 of file KisBezierPatchParamToSourceSampler.h.

◆ leftLength

qreal KisBezierPatchParamToSourceSampler::leftLength

Definition at line 33 of file KisBezierPatchParamToSourceSampler.h.

◆ patch

KisBezierPatch KisBezierPatchParamToSourceSampler::patch

Definition at line 28 of file KisBezierPatchParamToSourceSampler.h.

◆ rightLength

qreal KisBezierPatchParamToSourceSampler::rightLength

Definition at line 34 of file KisBezierPatchParamToSourceSampler.h.

◆ topLength

qreal KisBezierPatchParamToSourceSampler::topLength

Definition at line 30 of file KisBezierPatchParamToSourceSampler.h.


The documentation for this struct was generated from the following file: