home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 2 / RISC_DISC_2.iso / pd_share / program / language / bob / !ArmBob / progs / main / drawex < prev    next >
Encoding:
Text File  |  1994-12-31  |  2.1 KB  |  55 lines

  1. /****************************************************
  2.  *                                                  *
  3.  *     Example program using the draw library       *
  4.  *                                                  *
  5.  *     GCW   29/12/94                               *
  6.  *                                                  *
  7.  ****************************************************/
  8.  
  9. main()
  10. {
  11.  ox = oy = 180;            // Centre for B's display
  12.  A = new drawfile();       // Creates a new drawfile object called A
  13.  B = new drawfile();       // and another called B
  14.  A->begin();                                         // Creates A's header
  15.   banner = A->text("Draw Library Example",50,200);   // create text 
  16.   mygroup = A->group();                // Create a group called mygroup
  17.     mypath = A->path();                // containing a path called mypath
  18.       A->ellipse(100,100,50,40);       // given by an ellipse
  19.     A->endpath(mypath);                // end of mypath
  20.     mytxt = A->text("Ellipse",70,40);  // mygroup also contains mytxt
  21.    A->endgroup(mygroup);               // end of mygroup
  22.    /* ellipse and mytxt now grouped together */
  23.  
  24.  B->begin();                           // now define B
  25.   figure = B->path();                  // containing a path called figure
  26.    for (i = -5; i < 6; i++)
  27.     if (i != 0)
  28.      {
  29.       B->circle(ox + (a = 100/i),oy, (a<0)?(-a):a );
  30.       B->circle(ox, oy + (a = 100/i),(a<0)?(-a):a );
  31.      }
  32.   B->endpath(figure);                   // end of figure
  33.  
  34.   /* modify attributes of objects in A */
  35.   colour(banner,red);                  
  36.   font(banner,Trinity_Medium);                   
  37.   A->font_x(banner,20);                         
  38.   A->font_y(banner,20);        
  39.   fill(mypath,azure);            
  40.   outline(mypath,none);          
  41.   colour(mytxt,green);               
  42.   font(mytxt,Homerton_Bold_Oblique);  
  43.   A->font_x(mytxt,16);    
  44.   A->font_y(mytxt,16);     
  45.  
  46.  /* modify attributes of objects in B */
  47.   fill(figure,blue);
  48.   outline(figure, orange);
  49.   winding_rule(figure,Even_Odd);
  50.  
  51.  /* save and display */
  52.  B->end("RAM:B");            // save B to RAM:B and display it
  53.  A->end("RAM:A");          // save A to RAM:A and display it
  54. }
  55.