void drawto(drawing d); drawing currentdrawing(void); void moveto(point p); void lineto(point p); void drawpoint(point p); void drawline(point p1, point p2); void drawrect(rect r); void fillrect(rect r); void drawarc(rect r, int start_angle, int end_angle); void fillarc(rect r, int start_angle, int end_angle); void drawellipse(rect r); void fillellipse(rect r); void drawroundrect(rect r); void fillroundrect(rect r); void drawpolygon(point p[], int n); void fillpolygon(point p[], int n); void drawall(void);
The drawto function is used to set which bitmap, window or control is to be the target of all drawing operations. The currentdrawing returns this value. Usually it is not necessary to use drawto, since the event mechanism guarantees that when a redraw call-back function is called, the associated window or control becomes the current drawing.
The moveto function sets the starting location of lines subsequently drawn using lineto. A series of lineto calls will draw lines which will be joined end-on-end, since lineto sets the starting point of the next line to be equal to the end point of the just completed line.
Like all of the functions described in this section, the lineto function draws using the current colour and current line width, to the current drawing, which may be a window. See elsewhere for a description of how to set the colour and line width.
The drawpoint function will set the colour of the given point to be the current colour. It will change only one pixel. The drawline function draws a line starting at point p1 and extending up to but not including point p2. The line will have a width equal to the current line width.
The drawrect function draws a rectangle within the given rectangle. The lines will have a thickness defined by the current line width and will be wholly within the rectangle. The fillrect function fills the specified rectangle with the current colour.
The drawarc function draws an ellipsoid arc centred in the middle of the rectangle r, extending anti-clockwise from the start_angle to the end_angle. Angles are measured in degrees, with 0 degress being in the 3 o'clock position on the arc. The arc will fit within the rectangle. The fillarc function creates a pie-shape with the end-points of the arc joined to the centre point.
The drawellipse function draws a complete ellipse within the supplied rectangle. Remember that the right and bottom edges of a rectangle are not included within the rectangle. To draw a circle, make the rectangle a square. The fillellipse function fills the corresponding ellipse with the current colour.
The drawroundrect function draws a box with rounded edges. The fillroundrect function fills the rounded box with the current colour.
The drawpolygon function is given an array of n points p. It will draw lines from the first point in the array to the next, and so on until it joins the last point back to the first. The fillpolygon function will create a polygon filled with colour.
Graphics operations on some platforms (such as X-Windows) may be buffered, and for those platforms calling drawall ensures all pending graphics requests are processed. On other platforms the function exists and does nothing. This function is called during event handling anyway, and so is not generally called explicitly.