3 * This file is a part of LEMON, a generic C++ optimization library
5 * Copyright (C) 2003-2008
6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
7 * (Egervary Research Group on Combinatorial Optimization, EGRES).
9 * Permission to use, modify and distribute this software is granted
10 * provided that this copyright notice appears in all copies. For
11 * precise terms see the accompanying LICENSE file.
13 * This software is provided "AS IS" with no warranty of any kind,
14 * express or implied, and with no claim as to its suitability for any
21 /// \brief Demo of the EPS grawing class \ref lemon::EpsDrawer "EpsDrawer".
23 /// This demo program shows examples how to use the class \ref
24 /// lemon::EpsDrawer "EpsDrawer". It takes no input but simply creates
25 /// a file <tt>eps_demo.eps</tt> demonstrating the capability of \ref
26 /// lemon::EpsDrawer "EpsDrawer".
28 /// \include eps_demo.cc
30 #include <lemon/math.h>
31 #include <lemon/eps.h>
33 using namespace lemon;
35 void kosar(EpsDrawer &ed)
43 ed.translate(256,256).scale(256,256);
50 for(d=0;d<PI*2*5;d+=.1)
52 ed.lineTo(sin(d*3),cos(d*5));
60 void fonts(EpsDrawer &ed)
62 ed.save().centerMode(true);
64 ed.font("Helvetica").fontSize(90);
65 ed.moveTo(256,512/3*2+50) << "Helvetica";
67 ed.moveTo(256,512/3+50) << "Courier" ;
68 ed.font("Times-Roman");
69 ed.moveTo(256,50) << "Times-Roman";
71 ed.centerMode(false).restore();
77 EpsDrawer ed("eps_demo.eps",512,512);
80 ed.color(0,0,0).collect();
81 ed.moveTo(0,0).lineTo(0,512).lineTo(512,512).lineTo(512,0).closePath().fill();
85 for(double r=0;r<=256;r+=2)
87 ed.color(r/256.0,0,1-r/256.0).circle(256,256,r);
93 ed.translate(256,256);
99 for(double r=0;r<=256;r+=20)
100 ed.fontSize(r/10+1).rotate(2).moveTo(0,r) << r;
107 fonts(ed.color(.7,.7,.7));
110 ed.node(ed.CIRCLE,128,333,25);
111 ed.node(ed.SQUARE,256,333,25);
112 ed.node(ed.DIAMOND,128+256,333,25);