Skip to content
Snippets Groups Projects
Commit 6660f409 authored by Bruce Cowan's avatar Bruce Cowan :airplane:
Browse files

Just use single colour for bars

parent 66a6c6b3
No related branches found
No related tags found
1 merge request!2Gtk4
......@@ -76,12 +76,12 @@ rugby_possibility_widget_set_property (GObject *object,
}
static void
render_bar (GtkSnapshot *snapshot,
double x,
double y,
double w,
double h,
const GskColorStop *stops)
render_bar (GtkSnapshot *snapshot,
double x,
double y,
double w,
double h,
const GdkRGBA color)
{
GskRoundedRect rounded;
gsk_rounded_rect_init_from_rect (&rounded,
......@@ -89,18 +89,15 @@ render_bar (GtkSnapshot *snapshot,
h / 2.0);
gtk_snapshot_push_rounded_clip (snapshot, &rounded);
gtk_snapshot_append_linear_gradient (snapshot,
&GRAPHENE_RECT_INIT (x, y, w, h),
&GRAPHENE_POINT_INIT (0, 0),
&GRAPHENE_POINT_INIT (0, h),
stops,
2);
gtk_snapshot_append_color (snapshot,
&color,
&GRAPHENE_RECT_INIT (x, y, w, h));
gtk_snapshot_pop (snapshot);
GdkRGBA black = { 0.0, 0.0, 0.0, 1.0 };
GdkRGBA black = { 0.0, 0.0, 0.0, 0.2 };
gtk_snapshot_append_border (snapshot,
&rounded,
(float[]) { 2., 2., 2., 2. },
(float[]) { 2.f, 2.f, 2.f, 2.f },
(GdkRGBA[]) { black, black, black, black });
}
......@@ -126,29 +123,12 @@ rugby_possibility_widget_snapshot (GtkWidget *widget,
NULL);
int score = tries * try_points + utries * utry_points + kicks * kick_points;
// Green
const GskColorStop green_stops[] = {
{ 0.0, { 0.15, 0.64, 0.41, 1.0 } },
{ 1.0, { 0.56, 0.94, 0.64, 1.0 } },
};
// Red
const GskColorStop red_stops[] = {
{ 0.0, { 0.65, 0.11, 0.18, 1.0 } },
{ 1.0, { 0.97, 0.38, 0.32, 1.0 } },
};
// Yellow
const GskColorStop yellow_stops[] = {
{ 0.0, { 0.90, 0.65, 0.04, 1.0 } },
{ 1.0, { 0.98, 0.94, 0.42, 1.0 } },
};
// Tries
double w = width / (score / (double) try_points);
for (int i = 0; i < tries; i++)
{
render_bar (snapshot, x, 0.0, w, height, green_stops);
// Green
render_bar (snapshot, x, 0.0, w, height, (GdkRGBA) { 0.20, 0.82, 0.48, 1.0 });
x += w;
}
......@@ -156,7 +136,8 @@ rugby_possibility_widget_snapshot (GtkWidget *widget,
w = width / (score / (double) utry_points);
for (int i = 0; i < utries; i++)
{
render_bar (snapshot, x, 0.0, w, height, red_stops);
// Red
render_bar (snapshot, x, 0.0, w, height, (GdkRGBA) { 0.88, 0.11, 0.14, 1.0 });
x += w;
}
......@@ -164,7 +145,8 @@ rugby_possibility_widget_snapshot (GtkWidget *widget,
w = width / (score / (double) kick_points);
for (int i = 0; i < kicks; i++)
{
render_bar (snapshot, x, 0.0, w, height, yellow_stops);
// Yellow
render_bar (snapshot, x, 0.0, w, height, (GdkRGBA) { 0.97, 0.83, 0.18, 1.0 });
x += w;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment