From bff8f3818cd81d513930ee44a42ed1e05a98003e Mon Sep 17 00:00:00 2001 From: Nana <469449812@qq.com> Date: Mon, 27 May 2024 12:47:18 +0800 Subject: [PATCH] =?UTF-8?q?volume=20bar=E6=B8=90=E5=8F=98=E9=A2=9C?= =?UTF-8?q?=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Arona/src/widget/misc/w_volume_bar.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Arona/src/widget/misc/w_volume_bar.cpp b/Arona/src/widget/misc/w_volume_bar.cpp index c583d8c..bef3ddd 100644 --- a/Arona/src/widget/misc/w_volume_bar.cpp +++ b/Arona/src/widget/misc/w_volume_bar.cpp @@ -15,8 +15,18 @@ void w_volume_bar::on_draw(const Cairo::RefPtr& cr, int width, i cr->set_source_rgba(0.0, 0.0, 0.0, 1.0); cr->fill(); + Cairo::RefPtr 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 {