#include "canvas.h" // for Canvas #include "strutils.h" // for tostring(int) // illustrates line and text drawing in Canvas class int main() { const int GRID_SIZE = 200; const int SIZE= 20; // fudge dimensions to make room for text Canvas c(GRID_SIZE+SIZE, GRID_SIZE+SIZE,100,100); int j; for(j=0; j <= GRID_SIZE; j+= SIZE) { c.SetColor(BLACK); c.DrawString(tostring(j), Point(0,j)); // draw text labels c.DrawString(tostring(j), Point(j,0)); } c.SetColor(BLUE); for(j=0; j <= GRID_SIZE; j+= SIZE) { c.DrawLine(Point(j,0), Point(j,GRID_SIZE)); // horizontal line c.DrawLine(Point(0,j), Point(GRID_SIZE,j)); // vertical line } c.runUntilEscape(); return 0; }