{============================================================== recursiveArtist.p Started by Jeff Ondich on 5/6/96 Last modified 5/13/96 Draws a suffering artist with an interesting work of art. ==============================================================} #include program patch(input,output); const nPictures = 3; windowWidth = 600; windowHeight = 600; windowBottom = 100; windowLeft = 100; var pict, rectLeft, rectBottom, width, height : integer; procedure StartGraphics; var boundary : polyarray; begin { open a window } initializegraphics; createwindow(windowLeft,windowBottom,windowLeft+windowWidth,windowBottom+windowHeight); { flood the window with a white background } setrgbcolor(1.0,1.0,1.0); flood; flushgraphics end; {============================================================== jondichPicture Suffering artist. This routine uses scaleaxes() and translateaxes() so the drawing code can assume the rectangle is between (0,0) and (100,100). The axes are scaled and translated back home at the end of the procedure. ==============================================================} procedure jondichPicture( depth, left, bottom, width, height : integer ); begin translateaxes( left, bottom ); scaleaxes( width/100, height/100 ); setrgbcolor( 0, 0, 0 ); rectangle( 0, 0, 100, 100 ); flushgraphics; { The artist } circle( 80, 80, 8 ); {head} line( 76, 76, 75, 75 ); {mouth} line( 76, 76, 80, 76 ); line( 80, 76, 82, 75 ); line( 74, 83, 76, 85 ); {eyes} line( 82, 83, 80, 85 ); line( 78, 83, 76, 78 ); {nose} line( 76, 78, 77, 77 ); line( 80, 72, 80, 35 ); {body} line( 80, 35, 70, 10 ); {left leg} line( 70, 10, 65, 10 ); line( 80, 35, 90, 10 ); {right leg} line( 90, 10, 85, 10 ); line( 80, 60, 70, 65 ); {right arm} line( 70, 65, 62, 62 ); line( 80, 60, 70, 45 ); {left arm} line( 70, 45, 66, 46 ); { line( 88, 80, 88, 68 ); hair line( 86, 85, 86, 68 ); line( 84, 74, 84, 68 ); line( 82, 72, 82, 68 ); line( 78, 72, 78, 68 ); line( 76, 74, 76, 68 );} flushgraphics; line( 80, 92, 92, 80 ); {beret} line( 86, 86, 87, 87 ); flushgraphics; line( 68, 68, 60, 60 ); {paint brush} flushgraphics; setrgbcolor( 1, 0, 0 ); line( 60, 60, 58, 58 ); flushgraphics; setrgbcolor( 0.8, 0.6, 0.1 ); {palette} circlefilled( 61, 49, 6 ); flushgraphics; setrgbcolor( 1, 0, 0 ); circlefilled( 58, 50, 1 ); flushgraphics; setrgbcolor( 0, 1, 0 ); circlefilled( 59, 47, 1 ); flushgraphics; setrgbcolor( 1, 0, 1 ); circlefilled( 62, 46, 1 ); flushgraphics; setrgbcolor( 0, 0, 1 ); circlefilled( 64, 48, 1 ); flushgraphics; { The easel } setrgbcolor( 0.6, 0.25, 0.15 ); line( 10, 10, 17, 39 ); line( 30, 20, 30, 39 ); line( 50, 10, 43, 39 ); line( 5, 39, 55, 39 ); line( 5, 81, 55, 81 ); line( 30, 90, 27, 81 ); line( 30, 90, 33, 81 ); line( 30, 90, 30, 81 ); flushgraphics; rectangle( 9, 39, 51, 81 ); flushgraphics; { Draw the art } if depth > 1 then jondichPicture( depth - 1, 10, 40, 40, 40 ); scaleaxes( 100/width, 100/height ); translateaxes( -left, -bottom ); flushgraphics; end; {============================================================== The main program ==============================================================} begin rectLeft := 100; rectBottom := 100; width := 400; height := 400; StartGraphics; jondichPicture( 5, rectLeft, rectBottom, width, height ); readln end.