/** * clutter_color_shade: * @color: a #ClutterColor * @factor: the shade factor to apply * @result: (out): return location for the shaded color * * Shades @color by @factor and saves the modified color into @result. */ void clutter_color_shade (const ClutterColor *color, gdouble factor, ClutterColor *result) { float h, l, s; g_return_if_fail (color != NULL); g_return_if_fail (result != NULL); clutter_color_to_hls (color, &h, &l, &s); l *= factor; if (l > 1.0) l = 1.0; else if (l < 0) l = 0; s *= factor; if (s > 1.0) s = 1.0; else if (s < 0) s = 0; clutter_color_from_hls (result, h, l, s); result->alpha = color->alpha; }
//doc ClutterColor toHLS(h, l, s) IO_METHOD(IoClutterColor, toHLS) { float h = CNUMBER(IoMessage_locals_numberArgAt_(m, locals, 0)), l = CNUMBER(IoMessage_locals_numberArgAt_(m, locals, 1)), s = CNUMBER(IoMessage_locals_numberArgAt_(m, locals, 2)); clutter_color_to_hls(&IOCCOLOR(self), &h, &l, &s); return self; }
/** * clutter_color_shade: * @color: a #ClutterColor * @factor: the shade factor to apply * @result: (out caller-allocates): return location for the shaded color * * Shades @color by @factor and saves the modified color into @result. */ void clutter_color_shade (const ClutterColor *color, gdouble factor, ClutterColor *result) { float h, l, s; g_return_if_fail (color != NULL); g_return_if_fail (result != NULL); clutter_color_to_hls (color, &h, &l, &s); l = CLAMP (l * factor, 0.0, 1.0); s = CLAMP (s * factor, 0.0, 1.0); clutter_color_from_hls (result, h, l, s); result->alpha = color->alpha; }