本文整理汇总了C++中synfig::Color类的典型用法代码示例。如果您正苦于以下问题:C++ Color类的具体用法?C++ Color怎么用?C++ Color使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Color类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setHVSColor
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;
}
示例2:
void
Widget_Color::set_value(const synfig::Color &data)
{
assert(data.is_valid());
color=data;
queue_draw();
}
示例3: c
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() );
}
示例4:
void
Widget_ColorEdit::set_value(const synfig::Color &data)
{
assert(data.is_valid());
hold_signals=true;
clamp_=false;
color=data;
if(use_colorspace_gamma())
{
R_adjustment->set_value(gamma_in(color.get_r())*100);
G_adjustment->set_value(gamma_in(color.get_g())*100);
B_adjustment->set_value(gamma_in(color.get_b())*100);
}
else
{
R_adjustment->set_value(color.get_r()*100);
G_adjustment->set_value(color.get_g()*100);
B_adjustment->set_value(color.get_b()*100);
}
A_adjustment->set_value(color.get_a()*100);
slider_R->set_color(color);
slider_G->set_color(color);
slider_B->set_color(color);
slider_Y->set_color(color);
slider_U->set_color(color);
slider_V->set_color(color);
slider_HUE->set_color(color);
slider_SAT->set_color(color);
slider_A->set_color(color);
hex_color->set_text(color.get_hex());
widget_color.set_value(color);
setHVSColor(color);
hold_signals=false;
}
示例5: height
void
studio::render_color_to_window(const Cairo::RefPtr<Cairo::Context> &cr, const Gdk::Rectangle &ca, const synfig::Color &color)
{
const int height(ca.get_height());
const int width(ca.get_width());
const int square_size(height/2);
if(color.get_alpha()!=1.0)
{
// In this case we need to render the alpha squares
const Color bg1(
colorconv_apply_gamma(
Color::blend(color,Color(0.75, 0.75, 0.75),1.0).clamped() ));
const Color bg2(
colorconv_apply_gamma(
Color::blend(color,Color(0.5, 0.5, 0.5),1.0).clamped() ));
bool toggle(false);
for(int i=0;i<width;i+=square_size)
{
const int square_width(min(square_size,width-i));
if(toggle)
{
cr->set_source_rgb(bg1.get_r(), bg1.get_g(), bg1.get_b());
cr->rectangle(ca.get_x()+i, ca.get_y(), square_width, square_size);
cr->fill();
cr->set_source_rgb(bg2.get_r(), bg2.get_g(), bg2.get_b());
cr->rectangle(ca.get_x()+i, ca.get_y()+square_size, square_width, square_size);
cr->fill();
toggle=false;
}
else
{
cr->set_source_rgb(bg2.get_r(), bg2.get_g(), bg2.get_b());
cr->rectangle(ca.get_x()+i, ca.get_y(), square_width, square_size);
cr->fill();
cr->set_source_rgb(bg1.get_r(), bg1.get_g(), bg1.get_b());
cr->rectangle(ca.get_x()+i, ca.get_y()+square_size, square_width, square_size);
cr->fill();
toggle=true;
}
}
}
else
{
synfig::Color c = colorconv_apply_gamma(color);
cr->set_source_rgb(c.get_r(), c.get_g(), c.get_b());
cr->rectangle(ca.get_x(), ca.get_y(), width-1, height-1);
cr->fill();
}
cr->set_source_rgb(1.0, 1.0, 1.0);
cr->rectangle(ca.get_x()+1, ca.get_y()+1, width-3, height-3);
cr->stroke();
cr->set_source_rgb(0.0, 0.0, 0.0);
cr->rectangle(ca.get_x(), ca.get_y(), width-1, height-1);
cr->stroke();
}
示例6:
void
ColorSlider::slider_color_TYPE_V(synfig::Color &color, float amount) { color.set_v(amount-0.5f); }