hsla: Add _gtk_hsla_shade()

We use it in multiple places, so better split it out.
This commit is contained in:
Benjamin Otte
2012-11-25 03:24:47 +01:00
parent 4f9a8e6b3d
commit 9aac4dffc5
3 changed files with 23 additions and 6 deletions

View File

@ -183,3 +183,21 @@ _gdk_rgba_init_from_hsla (GdkRGBA *rgba,
}
}
void
_gtk_hsla_shade (GtkHSLA *dest,
const GtkHSLA *src,
double factor)
{
g_return_if_fail (dest != NULL);
g_return_if_fail (src != NULL);
dest->hue = src->hue;
dest->lightness = src->lightness * factor;
dest->lightness = CLAMP (dest->lightness, 0.0, 1.0);
dest->saturation = src->saturation * factor;
dest->saturation = CLAMP (dest->saturation, 0.0, 1.0);
dest->alpha = src->alpha;
}