Krita Source Code Documentation
Loading...
Searching...
No Matches
GutterWidthsConfig.cpp File Reference
#include "GutterWidthsConfig.h"
#include <kis_algebra_2d.h>
#include <kis_debug.h>

Go to the source code of this file.

Functions

qreal convertToPixels (KoUnit baseUnit, qreal resolution, qreal length)
 
bool inRangeWrapped (qreal value, qreal min, qreal max, qreal rangeMax)
 

Function Documentation

◆ convertToPixels()

qreal convertToPixels ( KoUnit baseUnit,
qreal resolution,
qreal length )

Definition at line 47 of file GutterWidthsConfig.cpp.

48{
49 KoUnit toUnit = KoUnit::fromSymbol("px");
50 return KoUnit::convertFromUnitToUnit(length, baseUnit, toUnit, resolution);
51}
qreal length(const QPointF &vec)
Definition Ellipse.cc:82
static qreal convertFromUnitToUnit(const qreal value, const KoUnit &fromUnit, const KoUnit &toUnit, qreal factor=1.0)
Definition KoUnit.cpp:295
static KoUnit fromSymbol(const QString &symbol, bool *ok=0)
Definition KoUnit.cpp:271

References KoUnit::convertFromUnitToUnit(), KoUnit::fromSymbol(), and length().

◆ inRangeWrapped()

bool inRangeWrapped ( qreal value,
qreal min,
qreal max,
qreal rangeMax )

Definition at line 33 of file GutterWidthsConfig.cpp.

33 {
34 min = KisAlgebra2D::wrapValue(min, 0.0, rangeMax);
35 max = KisAlgebra2D::wrapValue(max, 0.0, rangeMax);
36
37 if (min > max) {
38 return value > min || value < max; // range is on the edges instead of in the middle
39 } else {
40 return value > min && value < max;
41 }
42
43
44
45}
float value(const T *src, size_t ch)
T min(T a, T b, T c)
T wrapValue(T value, T wrapBounds)
constexpr std::enable_if< sizeof...(values)==0, size_t >::type max()

References value(), and KisAlgebra2D::wrapValue().