examples/example1.cc

00001 
00009 /*
00010  * @file   example1.cc
00011  * @author Sebastien Fourey <http://www.greyc.ensicaen.fr/~seb>
00012  * @date   Tue Aug 21
00013  * 
00014  * @brief  Sample drawing using the board library.
00015  * 
00016  * @copyright 
00017  */
00018 #include <cstdlib>
00019 #include <iostream>
00020 #include <fstream>
00021 #include <cmath>
00022 #include "Board.h"
00023 
00024 using namespace BoardLib;
00025 
00026 int main( int argc, char *argv[] )
00027 {
00028   Board board;
00029 
00030   board.drawRectangle( -1, 1, 2.0, 2.0 );
00031   board.setPenColorRGBi( 0, 0, 255 );
00032   board.fillCircle( 0.0, 0.0, 0.05 );
00033 
00034   std::vector<Point> points;
00035   for ( float x = -1.0; x < 1.0; x+=0.02 ) {
00036     points.push_back( Point( x, sin(x*6.28) ) );
00037   }
00038   board.setLineWidth( 1.0 );
00039   board.setPenColorRGBi( 0, 0, 255 );
00040   board.drawPolyline( points );
00041   board.drawArrow( 0, 0, 0.5, 0.5, true );
00042 
00043   board.fillGouraudTriangle( -0.5, 0, Color( 255, 0, 0 ), 
00044                              0, 0, Color( 0, 255, 0 ),
00045                              -0.3, 0.3, Color( 0, 0, 255 ) );
00046 
00047   
00048   board.setPenColorRGBi( 255, 1, 1 ).fillGouraudTriangle( -0.5, 0, 1.0f,
00049                                                           0, 0, 2.0f,
00050                                                           -0.3, -0.3, 0.1f );
00051 
00052   board.saveEPS( "draw1.eps" );
00053   board.saveFIG( "draw1.fig" );
00054   board.saveSVG( "draw1.svg" );
00055   exit(0);
00056 }

Generated on Fri Aug 24 19:07:40 2007 for Board by  doxygen 1.5.1