volume bar渐变颜色
This commit is contained in:
parent
7903a2ba95
commit
bff8f3818c
@ -15,8 +15,18 @@ void w_volume_bar::on_draw(const Cairo::RefPtr<Cairo::Context>& cr, int width, i
|
||||
cr->set_source_rgba(0.0, 0.0, 0.0, 1.0);
|
||||
cr->fill();
|
||||
|
||||
Cairo::RefPtr<Cairo::LinearGradient> line_color;
|
||||
if (is_vertical) {
|
||||
line_color = Cairo::LinearGradient::create(0, 0, 0, height);
|
||||
} else {
|
||||
line_color = Cairo::LinearGradient::create(0, 0, width, 0);
|
||||
}
|
||||
line_color->add_color_stop_rgb(0, 0.0, 1.0, 0.0);
|
||||
line_color->add_color_stop_rgb(0.7, 0.5, 0.5, 0.0); // (0.5, 0.5, 0.5)
|
||||
line_color->add_color_stop_rgb(1, 1.0, 0.0, 0.0);
|
||||
cr->set_source(line_color);
|
||||
|
||||
// draw value bar
|
||||
cr->set_source_rgba(0.0, 1.0, 1.0, 1.0);
|
||||
if (is_vertical) {
|
||||
cr->rectangle(0, height * (1 - value_), width, height * value_);
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user