/* Program: roundbox.c Try out the graphics library. Draw a box with rounded corners */ #include #include "genlib.h" #include "simpio.h" #include "graphics.h" main() { double x, y, max_x, max_y ; double mid_x, mid_y, increment ; /* Initialize graphics routines and sizes */ InitGraphics() ; max_x = GetWindowWidth() ; max_y = GetWindowHeight() ; mid_x = max_x / 2.0 ; mid_y = max_y / 2.0 ; /* Draw Left side of box */ MovePen(mid_x - 3.0, mid_y - 1.75) ; DrawLine(0.0, 3.5) ; /* Draw Top Left corner */ DrawArc(0.25, 180.0, -90.0) ; /* Draw Top of box */ DrawLine(5.5,0.0) ; /* Draw Top Right corner */ DrawArc(0.25, 90.0, -90.0) ; /* Draw Right side of box */ DrawLine(0.0,-3.5) ; /* Draw Bottom Right corner */ DrawArc(0.25, 0, -90.0) ; /* Draw Bottom of box */ DrawLine(-5.5,0.0) ; /* Draw Bottom Left corner */ DrawArc(0.25, 270, -90.0) ; }