00001
00009
00010
00011
00012
00013
00014
00015
00016
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.clear( Color(0,120,0) );
00031 board.setPenColorRGBi( 255, 0, 0 );
00032
00033 std::vector<Point> points;
00034 for ( float x = -1.0; x < 1.0; x+=0.02 ) {
00035 points.push_back( Point( x, sin(x*6.28) ) );
00036 }
00037 board.setLineWidth( 0.5 );
00038 board.setPenColorRGBi( 0, 0, 255 );
00039 board.drawPolyline( points );
00040
00041 board.setPenColorRGBi( 255, 0, 0 );
00042 for ( float x = -1.0; x < 1.1; x+=0.1 ) {
00043 board.setFillColorRGBi( 255, 0, 0 );
00044 board.setPenColorRGBi( 0, 0, 255 );
00045 board.drawCircle( x, 0.0, 0.1 );
00046 }
00047 board.fillCircle( 0.0, 0.0, 0.01 );
00048
00049 board.setPenColorRGBi( 0, 0, 0 );
00050 board.setFillColor( Color::none );
00051
00052 board.setFillColorRGBf( 1.0f, 0, 0, 0.25 ).drawEllipse( 0, -0.5, 1, 0.5 );
00053
00054 board.setFont("Helvetica-Bold",28.0).drawText( 0, 0.5, "Hello world!" );
00055
00056 board.setLineJoin( Shape::RoundJoin );
00057 board.setLineWidth( 8 ).setPenColor( Color::black ).setFillColorRGBi( 0, 0, 255, 50 ).drawRectangle( -1, 0, 1, 0.5 );
00058
00059 board.setLineJoin( Shape::MiterJoin );
00060 board.setLineWidth( 10 ).setPenColor( Color::black ).drawTriangle( -0.5, -0.25, 0, 0.25, 0.5, -0.25 );
00061 board.setLineWidth( 0.1 ).setPenColorRGBi( 255, 0, 0 ).drawLine( -0.5, -0.25, 0.5, -0.25 );
00062
00063 board.saveEPS( "draw2.eps" );
00064 board.saveFIG( "draw2.fig" );
00065 board.saveSVG( "draw2.svg" );
00066
00067 exit(0);
00068 }