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

Public Member Functions

 DColor ()=default
 Initialize with default value, fully transparent eight bit black.
 DColor (const QColor &color, bool sixteenBit=false)
 Read values from QColor, convert to sixteenBit of sixteenBit is true.
 DColor (int red, int green, int blue, int alpha, bool sixteenBit)
 Initialize with given RGBA values.
 DColor (uchar *data, bool sixteenBit=false)
 Read value from data.
int alpha () const
void blendAdd (const DColor &src)
void blendAlpha16 (int alpha)
void blendAlpha8 (int alpha)
void blendClamp16 ()
void blendClamp8 ()
void blendInvAlpha16 (int alpha)
void blendInvAlpha8 (int alpha)
void blendZero ()
 Inline alpha blending helper functions.
int blue () const
void convertToEightBit ()
void convertToSixteenBit ()
 Convert the color values of this color to and from sixteen bit and set the sixteen bit value accordingly.
void demultiply ()
void demultiply16 (int alpha)
void demultiply8 (int alpha)
void getHSL (int *const h, int *const s, int *const l) const
QColor getQColor () const
void getYCbCr (double *const y, double *const cb, double *const cr) const
int green () const
bool isPureGray ()
bool isPureGrayValue (int v)
void multiply (float factor)
void premultiply ()
 Premultiply and demultiply this color.
void premultiply16 (int alpha)
void premultiply8 (int alpha)
int red () const
void setAlpha (int _alpha)
void setBlue (int _blue)
void setColor (uchar *const data, bool sixteenBit=false)
 Read color values as RGBA from the given memory location.
void setGreen (int _green)
void setHSL (int h, int s, int l, bool sixteenBit)
 Set the RGB color values of this color to the given HSL values converted to RGB.
void setPixel (uchar *const data) const
 Write the values of this color to the given memory location.
void setRed (int _red)
void setSixteenBit (bool _sixteenBit)
void setYCbCr (double y, double cb, double cr, bool sixteenBit)
 Set the RGB color values of this color to the given YCrCb values converted to RGB.
bool sixteenBit () const

Constructor & Destructor Documentation

◆ DColor()

Digikam::DColor::DColor ( uchar * data,
bool sixteenBit = false )
inlineexplicit

Equivalent to setColor()

Member Function Documentation

◆ blendZero()

void Digikam::DColor::blendZero ( )
inline

These functions are used by DColorComposer. Look at that code to learn how to use them for composition if you want to use them in optimized code.

◆ getHSL()

void Digikam::DColor::getHSL ( int *const h,
int *const s,
int *const l ) const
Returns
the current RGB color values of this color in the HSL color space. Alpha is ignored for the conversion.

◆ getYCbCr()

void Digikam::DColor::getYCbCr ( double *const y,
double *const cb,
double *const cr ) const
Returns
the current RGB color values of this color in the YCrCb color space. Alpha is ignored for the conversion.

◆ premultiply()

void Digikam::DColor::premultiply ( )
inline

DImg stores the color non-premultiplied. Inline methods.

◆ setColor()

void Digikam::DColor::setColor ( uchar *const data,
bool _sixteenBit = false )
inline

These methods are used in quite a few image effects, typically in loops iterating the data.

Note
Use default copy constructor, assignment operator and destructor If
Parameters
sixteenBitis false, 4 bytes are read. If
sixteenBitis true, 8 bytes are read. Inline method.

Providing them as inline methods allows the compiler to optimize better.

◆ setHSL()

void Digikam::DColor::setHSL ( int h,
int s,
int l,
bool sixteenBit )

Alpha is set to be fully opaque.

Parameters
sixteenBitdetermines both how the HSL values are interpreted and the sixteen bit value of this color after this operation.

◆ setPixel()

void Digikam::DColor::setPixel ( uchar *const data) const
inline

If

Parameters
sixteenBitis false, 4 bytes are written. If
sixteenBitis true, 8 bytes are written. Inline method.

◆ setYCbCr()

void Digikam::DColor::setYCbCr ( double y,
double cb,
double cr,
bool sixteenBit )

Alpha is set to be fully opaque.

Parameters
sixteenBitdetermines both how the YCrCb values are interpreted and the sixteen bit value of this color after this operation.