From b56283dade66a6f650b28173b6a506d33604c2bd Mon Sep 17 00:00:00 2001 From: ache Date: Fri, 1 Oct 2021 21:52:12 +0200 Subject: New logo panel --- src/render.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/render.c b/src/render.c index 71b6ed5..68d72a8 100644 --- a/src/render.c +++ b/src/render.c @@ -235,12 +235,31 @@ void draw_logo(saver_state_t *state) cairo_t *cr = state->ctx; + + // The initial coordinates + double fill_height = state->canvas_height; + double w_I = kLogoBackgroundWidth, + h_I = fill_height, + tetha = M_PI/7; + // Draw bar background cairo_save(cr); cairo_set_source_rgb(cr, (208.0 / 255.0), (69.0 / 255.0), (255.0 / 255.0)); - double fill_height = (state->canvas_height * state->logo_fill_progress); - cairo_rectangle(cr, 0, 0, kLogoBackgroundWidth, fill_height); + + + // The final coordinates + int y = - sin(tetha) * w_I, + x = tan(tetha) * abs(y), + w = w_I * state->logo_fill_progress, + h = (h_I + abs(y)) / cos(tetha); + + // Draw the rectangle + cairo_translate(cr, x, y); + cairo_rotate(cr, tetha); + cairo_rectangle(cr, 0, 0, w, h); cairo_fill(cr); + // Rotate back to draw the logo + cairo_rotate(cr, -tetha); // Common color -- transparent for logo cairo_set_source_rgb(cr, 0.0, 0.0, 0.0); -- cgit v1.2.3