digiKam Developer Documentation: Digikam::DColor Class Reference

| digiKam Developer Documentation Professional Photo Management with the Power of Open Source

Loading...
Searching...
No Matches
Public Member Functions | List of all members
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 sixteenBit value accordingly.
void | demultiply ()
void | demultiply16 (int alpha)
void | demultiply8 (int alpha)
void | getHSL (int *const h, int *const s, int *const l) const
| Return the current RGB color values of this color in the HSL color space.
QColor | getQColor () const
void | getYCbCr (double *const y, double *const cb, double *const cr) const
| Return the current RGB color values of this color in the YCrCb color space.
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

Alpha is ignored for the conversion.

## ◆ getYCbCr()

void Digikam::DColor::getYCbCr | ( | double *const | y,
|  | double *const | cb,
|  | double *const | cr
| ) |  | const

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.

If sixteenBit is false, 4 bytes are read. If sixteenBit is 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. sixteenBit determines both how the HSL values are interpreted and the sixteenBit value of this color after this operation.

## ◆ setPixel()

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

If sixteenBit is false, 4 bytes are written. If sixteenBit is 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. sixteenBit determines both how the YCrCb values are interpreted and the sixteenBit value of this color after this operation.