wxColor DrawingUtils::DarkColour(const wxColour& color, float percent) { if(percent == 0) { return color; } float h, s, l, r, g, b; RGB_2_HSL(color.Red(), color.Green(), color.Blue(), &h, &s, &l); // reduce the Lum value l -= (float)((percent * 5.0)/100.0); if (l < 0) l = 0.0; HSL_2_RGB(h, s, l, &r, &g, &b); return wxColour((unsigned char)r, (unsigned char)g, (unsigned char)b); }
static inline void false_color(float val, dt_dev_pixelpipe_display_mask_t channel, float *out) { float in[3]; switch((channel & DT_DEV_PIXELPIPE_DISPLAY_ANY) & ~DT_DEV_PIXELPIPE_DISPLAY_OUTPUT) { case DT_DEV_PIXELPIPE_DISPLAY_L: in[0] = val * 100.0f; in[1] = 0.0f; in[2] = 0.0f; Lab_2_RGB(in, out); break; case DT_DEV_PIXELPIPE_DISPLAY_a: in[0] = 80.0f; in[1] = val * 256.0f - 128.0f; in[2] = 0.0f; Lab_2_RGB(in, out); break; case DT_DEV_PIXELPIPE_DISPLAY_b: in[0] = 80.0f; in[1] = 0.0f; in[2] = val * 256.0f - 128.0f; Lab_2_RGB(in, out); break; case DT_DEV_PIXELPIPE_DISPLAY_R: out[0] = val; out[1] = out[2] = 0.0f; break; case DT_DEV_PIXELPIPE_DISPLAY_G: out[1] = val; out[0] = out[2] = 0.0f; break; case DT_DEV_PIXELPIPE_DISPLAY_B: out[2] = val; out[0] = out[1] = 0.0f; break; case DT_DEV_PIXELPIPE_DISPLAY_LCH_C: in[0] = 80.0f; in[1] = val * 128.0f * sqrtf(2.0f); in[2] = 0.9111f; LCH_2_RGB(in, out); break; case DT_DEV_PIXELPIPE_DISPLAY_LCH_h: in[0] = 50.0f; in[1] = 0.25f * 128.0f * sqrtf(2.0f); in[2] = val; LCH_2_RGB(in, out); break; case DT_DEV_PIXELPIPE_DISPLAY_HSL_H: in[0] = val; in[1] = 1.0f; in[2] = 0.5f; HSL_2_RGB(in, out); break; case DT_DEV_PIXELPIPE_DISPLAY_HSL_S: in[0] = 0.8333f; in[1] = val; in[2] = 0.5f; HSL_2_RGB(in, out); break; case DT_DEV_PIXELPIPE_DISPLAY_HSL_l: in[0] = 0.0f; in[1] = 0.0f; in[2] = val; HSL_2_RGB(in, out); break; case DT_DEV_PIXELPIPE_DISPLAY_GRAY: default: out[0] = out[1] = out[2] = val; break; } }