From: Aaron Taylor Date: Thu, 8 Jul 2021 23:30:23 +0000 (-0700) Subject: Added rounded panel corners to NEDsim. X-Git-Url: http://git.subgeniuskitty.com/screensavers/.git/commitdiff_plain/a98a69c16192dcdc1ebf73cea2fea3610d3c4f36 Added rounded panel corners to NEDsim. --- diff --git a/hacks/NEDsim/NEDsim.c b/hacks/NEDsim/NEDsim.c index bee5e3b..df95105 100644 --- a/hacks/NEDsim/NEDsim.c +++ b/hacks/NEDsim/NEDsim.c @@ -284,6 +284,59 @@ draw_panel(struct NEDsim * nedsim) nedsim->cell_size * OVERALL_WIDTH_IN_CELLS, nedsim->cell_size * (HEADER_HEIGHT_IN_CELLS + nedsim->num_data_rows + FOOTER_HEIGHT_IN_CELLS) ); + + // Give the panel rounded corners by first deleting the four right-angle corners... + set_color(nedsim, &color_list[nedsim->color_index].panel_bg); + XFillRectangle(nedsim->dpy, nedsim->win, nedsim->gc, + nedsim->origin_x_offset, + nedsim->origin_y_offset, + nedsim->cell_size, + nedsim->cell_size + ); + XFillRectangle(nedsim->dpy, nedsim->win, nedsim->gc, + nedsim->origin_x_offset + (nedsim->cell_size * (OVERALL_WIDTH_IN_CELLS-1)), + nedsim->origin_y_offset, + nedsim->cell_size, + nedsim->cell_size + ); + XFillRectangle(nedsim->dpy, nedsim->win, nedsim->gc, + nedsim->origin_x_offset, + nedsim->origin_y_offset + (nedsim->cell_size * (HEADER_HEIGHT_IN_CELLS + nedsim->num_data_rows + FOOTER_HEIGHT_IN_CELLS - 1)), + nedsim->cell_size, + nedsim->cell_size + ); + XFillRectangle(nedsim->dpy, nedsim->win, nedsim->gc, + nedsim->origin_x_offset + (nedsim->cell_size * (OVERALL_WIDTH_IN_CELLS-1)), + nedsim->origin_y_offset + (nedsim->cell_size * (HEADER_HEIGHT_IN_CELLS + nedsim->num_data_rows + FOOTER_HEIGHT_IN_CELLS - 1)), + nedsim->cell_size, + nedsim->cell_size + ); + // ...and then replacing them with filled arcs, forming rounded corners. + set_color(nedsim, &color_list[nedsim->color_index].panel_fg); + XFillArc(nedsim->dpy, nedsim->win, nedsim->gc, + nedsim->origin_x_offset, + nedsim->origin_y_offset, + nedsim->cell_size * 2, nedsim->cell_size * 2, + 180*64, -90*64 + ); + XFillArc(nedsim->dpy, nedsim->win, nedsim->gc, + nedsim->origin_x_offset + (nedsim->cell_size * (OVERALL_WIDTH_IN_CELLS-2)), + nedsim->origin_y_offset, + nedsim->cell_size * 2, nedsim->cell_size * 2, + 0, 90*64 + ); + XFillArc(nedsim->dpy, nedsim->win, nedsim->gc, + nedsim->origin_x_offset, + nedsim->origin_y_offset + (nedsim->cell_size * (HEADER_HEIGHT_IN_CELLS + nedsim->num_data_rows + FOOTER_HEIGHT_IN_CELLS - 2)), + nedsim->cell_size * 2, nedsim->cell_size * 2, + 180*64, 90*64 + ); + XFillArc(nedsim->dpy, nedsim->win, nedsim->gc, + nedsim->origin_x_offset + (nedsim->cell_size * (OVERALL_WIDTH_IN_CELLS-2)), + nedsim->origin_y_offset + (nedsim->cell_size * (HEADER_HEIGHT_IN_CELLS + nedsim->num_data_rows + FOOTER_HEIGHT_IN_CELLS - 2)), + nedsim->cell_size * 2, nedsim->cell_size * 2, + 0, -90*64 + ); } // TODO: Explain