digiKam
Digikam::DColor Class Reference

Public Member Functions

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 ()
 
int blue () const
 
void convertToEightBit ()
 
void convertToSixteenBit ()
 
 DColor ()
 
 DColor (const QColor &color, bool sixteenBit=false)
 
 DColor (int red, int green, int blue, int alpha, bool sixteenBit)
 
 DColor (uchar *data, bool sixteenBit=false)
 
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 ()
 
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)
 
void setGreen (int green)
 
void setHSL (int h, int s, int l, bool sixteenBit)
 
void setPixel (uchar *const data) const
 
void setRed (int red)
 
void setSixteenBit (bool sixteenBit)
 
void setYCbCr (double y, double cb, double cr, bool sixteenBit)
 
bool sixteenBit () const
 

Constructor & Destructor Documentation

◆ DColor() [1/4]

Digikam::DColor::DColor ( )
inline

Initialize with default value, fully transparent eight bit black

◆ DColor() [2/4]

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

Read value from data. Equivalent to setColor()

◆ DColor() [3/4]

Digikam::DColor::DColor ( int  red,
int  green,
int  blue,
int  alpha,
bool  sixteenBit 
)
inline

Initialize with given RGBA values

◆ DColor() [4/4]

Digikam::DColor::DColor ( const QColor &  color,
bool  sixteenBit = false 
)
explicit

Read values from QColor, convert to sixteenBit of sixteenBit is true

References convertToSixteenBit(), and sixteenBit().

Member Function Documentation

◆ alpha()

◆ blendAdd()

void Digikam::DColor::blendAdd ( const DColor src)
inline

◆ blendAlpha16()

void Digikam::DColor::blendAlpha16 ( int  alpha)
inline

◆ blendAlpha8()

void Digikam::DColor::blendAlpha8 ( int  alpha)
inline

◆ blendClamp16()

void Digikam::DColor::blendClamp16 ( )
inline

◆ blendClamp8()

void Digikam::DColor::blendClamp8 ( )
inline

◆ blendInvAlpha16()

void Digikam::DColor::blendInvAlpha16 ( int  alpha)
inline

◆ blendInvAlpha8()

void Digikam::DColor::blendInvAlpha8 ( int  alpha)
inline

◆ blendZero()

void Digikam::DColor::blendZero ( )
inline

Inline alpha blending helper functions. 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.

References setAlpha(), setBlue(), setGreen(), and setRed().

◆ blue()

◆ convertToEightBit()

void Digikam::DColor::convertToEightBit ( )

◆ convertToSixteenBit()

void Digikam::DColor::convertToSixteenBit ( )

Convert the color values of this color to and from sixteen bit and set the sixteenBit value accordingly

Referenced by Digikam::DImg::bitBlendImageOnColor(), DigikamEditorInsertTextToolPlugin::InsertTextWidget::composeImage(), and DColor().

◆ demultiply()

void Digikam::DColor::demultiply ( )
inline

◆ demultiply16()

void Digikam::DColor::demultiply16 ( int  alpha)
inline

References blue(), green(), red(), setBlue(), setGreen(), and setRed().

Referenced by demultiply().

◆ demultiply8()

void Digikam::DColor::demultiply8 ( int  alpha)
inline

References blue(), green(), red(), setBlue(), setGreen(), and setRed().

Referenced by demultiply().

◆ getHSL()

void Digikam::DColor::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. Alpha is ignored for the conversion.

References blue(), green(), and red().

◆ getQColor()

QColor Digikam::DColor::getQColor ( ) const

References convertToEightBit(), and getQColor().

Referenced by getQColor().

◆ getYCbCr()

void Digikam::DColor::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. Alpha is ignored for the conversion.

◆ green()

◆ isPureGray()

bool Digikam::DColor::isPureGray ( )
inline

◆ isPureGrayValue()

bool Digikam::DColor::isPureGrayValue ( int  v)
inline

◆ multiply()

void Digikam::DColor::multiply ( float  factor)
inline

◆ premultiply()

void Digikam::DColor::premultiply ( )
inline

Premultiply and demultiply this color. DImg stores the color non-premultiplied. Inline methods.

References alpha(), premultiply16(), premultiply8(), and sixteenBit().

Referenced by Digikam::DColorComposer::compose().

◆ premultiply16()

void Digikam::DColor::premultiply16 ( int  alpha)
inline

References blue(), green(), red(), setBlue(), setGreen(), and setRed().

Referenced by premultiply().

◆ premultiply8()

void Digikam::DColor::premultiply8 ( int  alpha)
inline

References blue(), green(), red(), setBlue(), setGreen(), and setRed().

Referenced by premultiply().

◆ red()

◆ setAlpha()

◆ setBlue()

◆ setColor()

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

Read color values as RGBA from the given memory location. If sixteenBit is false, 4 bytes are read. If sixteenBit is true, 8 bytes are read. Inline method.

These methods are used in quite a few image effects, typically in loops iterating the data. Providing them as inline methods allows the compiler to optimize better.

References setAlpha(), setBlue(), setGreen(), setRed(), and sixteenBit().

Referenced by Digikam::DImg::getSubPixelColor(), and Digikam::DImg::getSubPixelColorFast().

◆ setGreen()

◆ setHSL()

void Digikam::DColor::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. 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.

References sixteenBit().

◆ setPixel()

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

Write the values of this color to the given memory location. If sixteenBit is false, 4 bytes are written. If sixteenBit is true, 8 bytes are written. Inline method.

References alpha(), blue(), green(), red(), and sixteenBit().

Referenced by Digikam::DImg::setPixelColor().

◆ setRed()

◆ setSixteenBit()

void Digikam::DColor::setSixteenBit ( bool  sixteenBit)
inline

◆ setYCbCr()

void Digikam::DColor::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. 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.

References CLAMP, and sixteenBit().

◆ sixteenBit()


The documentation for this class was generated from the following files: