lemon/eps.cc
changeset 2012 224cd6aacfc1
parent 1971 9a59a6cacfd9
child 2013 02e70e25aac5
equal deleted inserted replaced
0:c22f003a901c 1:b7e36d14b5f5
   296     out << "flush\n";
   296     out << "flush\n";
   297     //  fflush(fp);
   297     //  fflush(fp);
   298     return *this;
   298     return *this;
   299   }
   299   }
   300 
   300 
       
   301   EpsDrawer &EpsDrawer::node(NodeShapes t, double x, double y, double r,
       
   302 			     Color col, Color brd)
       
   303   {
       
   304     out << "gsave\n"
       
   305 	<< brd.red() << ' ' << brd.green() << ' ' << brd.blue() 
       
   306 	<< " setrgbcolor\n";
       
   307     switch(t) {
       
   308     case CIRCLE:
       
   309       out << "newpath " << x << ' ' << y << ' ' << r 
       
   310 	  << " dup 3 index add 2 index moveto 0 360 arc fill\n";
       
   311       break;
       
   312     case SQUARE:
       
   313       out << "newpath\n"
       
   314 	  << x-r << ' ' << y-r << " moveto\n"
       
   315 	  << x-r << ' ' << y+r << " lineto\n"
       
   316 	  << x+r << ' ' << y+r << " lineto\n"
       
   317 	  << x+r << ' ' << y-r << " lineto closepath fill\n";
       
   318       break;
       
   319     case DIAMOND:
       
   320       out << "newpath\n"
       
   321 	  << x-r << ' ' << y   << " moveto\n"
       
   322 	  << x   << ' ' << y+r << " lineto\n"
       
   323 	  << x+r << ' ' << y   << " lineto\n"
       
   324 	  << x   << ' ' << y-r << " lineto closepath fill\n";
       
   325       break;
       
   326     case MALE:
       
   327       break;
       
   328     case FEMALE:
       
   329       break;
       
   330     }
       
   331     r/=1.1;
       
   332     out << col.red() << ' ' << col.green() << ' ' << col.blue() 
       
   333 	<< " setrgbcolor\n";
       
   334     switch(t) {
       
   335     case CIRCLE:
       
   336       out << "newpath " << x << ' ' << y << ' ' << r 
       
   337 	  << " dup 3 index add 2 index moveto 0 360 arc fill\n";
       
   338       break;
       
   339     case SQUARE:
       
   340       out << "newpath\n"
       
   341 	  << x-r << ' ' << y-r << " moveto\n"
       
   342 	  << x-r << ' ' << y+r << " lineto\n"
       
   343 	  << x+r << ' ' << y+r << " lineto\n"
       
   344 	  << x+r << ' ' << y-r << " lineto closepath fill\n";
       
   345       break;
       
   346     case DIAMOND:
       
   347       out << "newpath\n"
       
   348 	  << x-r << ' ' << y   << " moveto\n"
       
   349 	  << x   << ' ' << y+r << " lineto\n"
       
   350 	  << x+r << ' ' << y   << " lineto\n"
       
   351 	  << x   << ' ' << y-r << " lineto closepath fill\n";
       
   352       break;
       
   353     case MALE:
       
   354       break;
       
   355     case FEMALE:
       
   356       break;
       
   357     }
       
   358 
       
   359     out << "grestore\n";
       
   360     return *this;
       
   361   }
       
   362   
   301 }
   363 }