Exemple #1
0
synfig::Color
studio::colorconv_apply_gamma(const synfig::Color &c_)
{
	const synfig::Color c(c_.clamped());
	return synfig::Color(
		App::gamma.r_F32_to_F32(c.get_r()),
		App::gamma.g_F32_to_F32(c.get_g()),
		App::gamma.b_F32_to_F32(c.get_b()),
		c.get_a() );
}
void Widget_ColorEdit::setHVSColor(synfig::Color color)
{
	Gdk::Color gtkColor;
	float r = hvs_gamma.r_F32_to_F32(CLIP_VALUE(color.get_r(),0.0,1.0));
	float g = hvs_gamma.g_F32_to_F32(CLIP_VALUE(color.get_g(),0.0,1.0));
	float b = hvs_gamma.b_F32_to_F32(CLIP_VALUE(color.get_b(),0.0,1.0));
	gtkColor.set_red((unsigned short)(r * USHRT_MAX));
	gtkColor.set_green((unsigned short)(g * USHRT_MAX));
	gtkColor.set_blue((unsigned short)(b * USHRT_MAX));
	colorHVSChanged = true;
	hvsColorWidget->set_previous_color (gtkColor); //We can't use it there, cause color changes in realtime.
	hvsColorWidget->set_current_color (gtkColor);
	colorHVSChanged = false;
}