digiKam Developer Documentation
Professional Photo Management with the Power of Open Source
Loading...
Searching...
No Matches
Digikam::ImageCurves Class Reference

Public Types

typedef double CRMatrix[4][4]
 
enum  CurveType { CURVE_SMOOTH = 0 , CURVE_FREE }
 

Public Member Functions

 ImageCurves (bool sixteenBit)
 
 ImageCurves (const CurvesContainer &container)
 
 ImageCurves (const ImageCurves &other)
 
QByteArray channelToBinary (int channel) const
 Writes the given channel to a raw binary representation.
 
void curvesCalculateAllCurves ()
 
void curvesCalculateCurve (int channel)
 
void curvesChannelReset (int channel)
 
float curvesLutFunc (int n_channels, int channel, float value)
 
void curvesLutProcess (uchar *const srcPR, uchar *const destPR, int w, int h)
 
void curvesLutSetup (int nchannels)
 
void curvesReset ()
 Methods to manipulate the curves data.
 
void fillFromOtherCurves (const ImageCurves *const otherCurves)
 Fills this curves with the data supplied by another curves object.
 
CurvesContainer getContainer () const
 Returns a container with the settings for all channels of this Curves object.
 
CurvesContainer getContainer (int channel) const
 Returns a container containing the values of this Curves object for the given channel, and linear values for all other channels.
 
QPoint getCurvePoint (int channel, int point) const
 
QPolygon getCurvePoints (int channel) const
 
int getCurvePointX (int channel, int point) const
 
int getCurvePointY (int channel, int point) const
 
CurveType getCurveType (int channel) const
 
int getCurveValue (int channel, int bin) const
 
QPolygon getCurveValues (int channel) const
 
bool isCurvePointEnabled (int channel, int point) const
 
bool isDirty () const
 Curves properties.
 
bool isLinear () const
 
bool isLinear (int channel) const
 Returns true if the curve is linear for the given channel, or all channels.
 
bool isSixteenBits () const
 
bool loadCurvesFromGimpCurvesFile (const QUrl &fileUrl)
 
ImageCurvesoperator= (const ImageCurves &other)
 
bool saveCurvesToGimpCurvesFile (const QUrl &fileUrl) const
 Methods to save/load the curves values to/from a Gimp curves text file.
 
bool setChannelFromBinary (int channel, const QByteArray &array)
 Set the channel from the given raw binary representation.
 
void setContainer (const CurvesContainer &container)
 
void setCurvePoint (int channel, int point, const QPoint &val)
 
void setCurvePoints (int channel, const QPolygon &vals)
 
void setCurvePointX (int channel, int point, int x)
 
void setCurvePointY (int channel, int point, int y)
 
void setCurveType (CurveType type)
 
void setCurveType (int channel, CurveType type)
 
void setCurveValue (int channel, int bin, int val)
 Methods to set manually the curves values.
 
void setCurveValues (int channel, const QPolygon &vals)
 
void unsetCurvePoint (int channel, int point)
 

Static Public Member Functions

static QPoint getDisabledValue ()
 

Static Public Attributes

static const int MULTIPLIER_16BIT = 255
 Curve points have to multiplied with this value for 16 bit images.
 
static const int NUM_CHANNELS = 5
 Number of channels in a curve.
 
static const int NUMBER_OF_POINTS = 17
 The max number of points contained in a curve.
 

Member Enumeration Documentation

◆ CurveType

Enumerator
CURVE_SMOOTH 

Smooth curve type.

CURVE_FREE 

Freehand curve type.

Member Function Documentation

◆ channelToBinary()

QByteArray Digikam::ImageCurves::channelToBinary ( int  channel) const

Binary format:

Note that 16bit free curves take a lot of memory (~85kB) while all other forms take less than 400 bytes.

Version 1 :16 Type 0,1,2 : 8 Bytes depth 1,2 : 8 reserved :32 count :32

Type 0 (linear curve): Type 1 (smooth curve): for (0...count) point.x :32 point.y :32 Type 2 (free curve): for (0...count) if (Bytes depth == 1) value : 8 else if (Bytes depth == 2) value :16

In Big Endian byte order. Data then converted to base64.

◆ fillFromOtherCurves()

void Digikam::ImageCurves::fillFromOtherCurves ( const ImageCurves *const  otherCurves)

This ensures that 8 and 16 bit curves are properly converted.

Parameters
otherCurvesother curves object to adapt config from

◆ setChannelFromBinary()

bool Digikam::ImageCurves::setChannelFromBinary ( int  channel,
const QByteArray &  array 
)

The data is checked for validity, only on valid data true is returned. Note that the bytes depth (isSixteenBits()) of the encoded representation must match the depth of this curves object.

◆ setContainer()

void Digikam::ImageCurves::setContainer ( const CurvesContainer container)
Note
bits depth must match