home *** CD-ROM | disk | FTP | other *** search
- /****************************************************
- * *
- * Example program using the draw library *
- * *
- * GCW 29/12/94 *
- * *
- ****************************************************/
-
- main()
- {
- ox = oy = 180; // Centre for B's display
- A = new drawfile(); // Creates a new drawfile object called A
- B = new drawfile(); // and another called B
- A->begin(); // Creates A's header
- banner = A->text("Draw Library Example",50,200); // create text
- mygroup = A->group(); // Create a group called mygroup
- mypath = A->path(); // containing a path called mypath
- A->ellipse(100,100,50,40); // given by an ellipse
- A->endpath(mypath); // end of mypath
- mytxt = A->text("Ellipse",70,40); // mygroup also contains mytxt
- A->endgroup(mygroup); // end of mygroup
- /* ellipse and mytxt now grouped together */
-
- B->begin(); // now define B
- figure = B->path(); // containing a path called figure
- for (i = -5; i < 6; i++)
- if (i != 0)
- {
- B->circle(ox + (a = 100/i),oy, (a<0)?(-a):a );
- B->circle(ox, oy + (a = 100/i),(a<0)?(-a):a );
- }
- B->endpath(figure); // end of figure
-
- /* modify attributes of objects in A */
- colour(banner,red);
- font(banner,Trinity_Medium);
- A->font_x(banner,20);
- A->font_y(banner,20);
- fill(mypath,azure);
- outline(mypath,none);
- colour(mytxt,green);
- font(mytxt,Homerton_Bold_Oblique);
- A->font_x(mytxt,16);
- A->font_y(mytxt,16);
-
- /* modify attributes of objects in B */
- fill(figure,blue);
- outline(figure, orange);
- winding_rule(figure,Even_Odd);
-
- /* save and display */
- B->end("RAM:B"); // save B to RAM:B and display it
- A->end("RAM:A"); // save A to RAM:A and display it
- }
-