Пример #1
0
color interpolate(const color& a, sample weight, const color& b)
noexcept
{
    auto pre_red =
                 interpolate(a.alpha() * a.red(), weight, b.alpha() * b.red());
    auto pre_green =
                 interpolate(a.alpha() * a.green(), weight, b.alpha() * b.green());
    auto pre_blue =
                 interpolate(a.alpha() * a.blue(), weight, b.alpha() * b.blue());
    auto new_alpha = interpolate(a.alpha(), weight, b.alpha());

    return {pre_red / new_alpha, pre_green / new_alpha, pre_blue / new_alpha,
            new_alpha};
}
Пример #2
0
 inline bool operator==(color const& rhs) const
 {
     return (red_== rhs.red()) &&
            (green_ == rhs.green()) &&
            (blue_  == rhs.blue()) &&
            (alpha_ == rhs.alpha());
 }
Пример #3
0
color overlay(const color& fg, const color& bg) noexcept
{
    if (opaque(fg) || transparent(bg)) return fg;
    if (transparent(fg)) return bg;

    return interpolate(bg, fg.alpha(), color{fg.red(), fg.green(), fg.blue()});
}
Пример #4
0
Файл: color.hpp Проект: 8l/x11
      void set ( color& c )
	{
	  free_color();
	  set_color ( c.red(), c.green(), c.blue() );
	}
Пример #5
0
void cairo_context::set_color(color const& color, double opacity)
{
    set_color(color.red()/255.0, color.green()/255.0, color.blue()/255.0, color.alpha() * opacity / 255.0);
}
Пример #6
0
 static boost::python::tuple
 getinitargs(const color& c)
 {
     using namespace boost::python;
     return boost::python::make_tuple(c.red(),c.green(),c.blue(),c.alpha());
 }
Пример #7
0
void api::clear_color( const color &c )
{
	glClearColor( c.red(), c.green(), c.blue(), c.alpha() );
}
Пример #8
0
void texture::binding::set_border_color( const color &c )
{

	float color[] = { c.red(), c.green(), c.blue(), c.alpha() };
	glTexParameterfv( _target, GL_TEXTURE_BORDER_COLOR, color );
}