16 :
KisLevelsCurve(defaultInputBlackPoint(), defaultInputWhitePoint(), defaultInputGamma(),
17 defaultOutputBlackPoint(), defaultOutputWhitePoint())
21 qreal outputBlackPoint, qreal outputWhitePoint)
22 : m_inputBlackPoint(inputBlackPoint)
23 , m_inputWhitePoint(inputWhitePoint)
24 , m_inputGamma(inputGamma)
25 , m_outputBlackPoint(outputBlackPoint)
26 , m_outputWhitePoint(outputWhitePoint)
27 , m_inputLevelsDelta(inputWhitePoint - inputBlackPoint)
28 , m_inverseInputGamma(1.0 / m_inputGamma)
29 , m_outputLevelsDelta(outputWhitePoint - outputBlackPoint)
30 , m_mustRecomputeU16Transfer(true)
31 , m_mustRecomputeFTransfer(true)
184 for (
int i = 0; i < size; ++i) {
185 const qreal x =
static_cast<qreal
>(i) /
static_cast<qreal
>(size - 1);
186 m_u16Transfer[i] =
static_cast<quint16
>(qRound(
value(x) *
static_cast<qreal
>(0xFFFF)));
201 for (
int i = 0; i < size; ++i) {
202 m_fTransfer[i] =
value(
static_cast<qreal
>(i) /
static_cast<qreal
>(size - 1));
240 for (
int i = 0; i < 5; ++i) {
This class holds the parameters for a levels adjustment. It is modeled after KisCubicCurve and has si...
qreal outputBlackPoint() const
Get the output black point.
bool operator==(const KisLevelsCurve &rhs) const
void setOutputBlackPoint(qreal newOutputBlackPoint)
Set the output black point.
bool isIdentity() const
Check whether the level info maps all values to themselves.
const QVector< qreal > & floatTransfer(int size=256) const
Returns a vector of size.
qreal inputBlackPoint() const
Get the input black point.
void setOutputWhitePoint(qreal newOutputWhitePoint)
Set the output white point.
static constexpr qreal defaultInputGamma()
Default value for the input gamma.
qreal value(qreal x) const
Evaluates the function formed by the levels parameters for a given x. The input and output values are...
static constexpr qreal defaultOutputBlackPoint()
Default value for the output black point.
QVector< qreal > m_fTransfer
qreal inputGamma() const
Get the gamma value.
void setName(const QString &newName)
Set the name associated with this levels info object. This allows us to carry around a display name f...
void resetOutputLevels()
Resets the output levels only.
qreal m_inverseInputGamma
const QVector< quint16 > & uint16Transfer(int size=256) const
Returns a vector of size.
qreal inputWhitePoint() const
Get the input white point.
static constexpr qreal defaultOutputWhitePoint()
Default value for the output white point.
bool m_mustRecomputeFTransfer
void setInputGamma(qreal newInputGamma)
Set the gamma value.
const QString & name() const
Get the name associated with this levels info object.
void setInputWhitePoint(qreal newInputWhitePoint)
Set the input white point.
QVector< quint16 > m_u16Transfer
QString toString() const
Get a text representation of the parameters. The format is: "input_black_point;input_white_point;inpu...
void resetInputLevels()
Resets the input levels only (and gamma)
qreal m_outputLevelsDelta
void fromString(const QString &text, bool *ok=nullptr)
Parses the parameters from a given text.
qreal outputWhitePoint() const
Get the output white point.
void setInputBlackPoint(qreal newInputBlackPoint)
Set the input black point.
void resetAll()
Resets the input and output levels (and gamma)
bool m_mustRecomputeU16Transfer
static constexpr qreal defaultInputWhitePoint()
Default value for the input white point.
static constexpr qreal defaultInputBlackPoint()
Default value for the input black point.
#define KIS_SAFE_ASSERT_RECOVER(cond)
double toDouble(const QString &str, bool *ok=nullptr)
QString toString(const QString &value)