示例#1
0
static inline void RGB_adjust_HSL(uint8_t& r, uint8_t& g, uint8_t& b,
								  int hue, int sat, int lmul, int loff) {
	int h, s, l;
	RGB_to_HSL(r, g, b, h, s, l);
	HSL_adjust(h, s, l, hue, sat, lmul, loff);
	HSL_to_RGB(h, s, l, r, g, b);
}
示例#2
0
//---------------------------------------------------------------------------
void __fastcall TMainForm::CalculateColors()
{
    unsigned char red,green,blue;
    try
    {
        red   = StrToInt(this->LabeledEdit1->Text);
        green = StrToInt(this->LabeledEdit2->Text);
        blue  = StrToInt(this->LabeledEdit3->Text);
    }
    catch(...)
    {
        return;
    }
    double r,g,b;
    double x,y,z;
    double l,a,bb;
    double h,s,v;
    double ll;

    r = (double)red / 255.;
    g = (double)green / 255.;
    b = (double)blue / 255.;

    RGB_to_XYZ(r,g,b,x,y,z);

    LabeledEdit4->Text = FormatFloat("0.000", x);
    LabeledEdit5->Text = FormatFloat("0.000", y);
    LabeledEdit6->Text = FormatFloat("0.000", z);

    XYZ_to_LAB(x,y,z,l,a,bb);

    LabeledEdit7->Text = FormatFloat("000.000", l);
    LabeledEdit8->Text = FormatFloat("000.000", a);
    LabeledEdit9->Text = FormatFloat("000.000", bb);


    RGB_to_HSV(r,g,b,h,s,v);

    LabeledEdit10->Text = FormatFloat(".000", h);
    LabeledEdit11->Text = FormatFloat(".000", s);
    LabeledEdit12->Text = FormatFloat(".000", v);


    RGB_to_HSL(r,g,b,h,s,ll);

    LabeledEdit13->Text = FormatFloat(".000", h);
    LabeledEdit14->Text = FormatFloat(".000", s);
    LabeledEdit15->Text = FormatFloat(".000", ll);
}
示例#3
0
void CMultiColor::hsl(double& h, double& s, double& l)
{
	RGB_to_HSL(m_r, m_g, m_b, h,s,l);
}