1 /**
2  * @file   linestyle.cpp
3  * @author Sebastien Fourey (GREYC)
4  *
5  * @brief  Sample program to check line styles.
6  *
7  * This source code is part of the Board project, a C++ library whose
8  * purpose is to allow simple drawings in EPS, FIG or SVG files.
9  * Copyright (C) 2007 Sebastien Fourey <http://foureys.users.greyc.fr>
10  *
11  */
12 #include <cstdlib>
13 #include <iostream>
14 #include "Board.h"
15 using namespace LibBoard;
16 
main(int,char * [])17 int main( int , char *[] )
18 {
19   Board board;
20   board.clear( Color::White );
21   board.setLineWidth(0.5);
22 
23   int y = 10;
24 
25   board.setFillColor( Color::Gray );
26 
27   board.setLineStyle( Shape::DashStyle );
28   board.drawRectangle( 10, y, 200, 10 );
29   y+=20;
30   board.setLineStyle( Shape::DotStyle );
31   board.drawRectangle( 10, y, 200, 10 );
32   y+=20;
33   board.setLineStyle( Shape::DashDotStyle );
34   board.drawRectangle( 10, y, 200, 10 );
35   y+=20;
36   // board.setLineStyle( Shape::DashDotDotStyle );
37   board << Rectangle( 10, y, 200, 10, Color::Black, Color::Gray, 0.1, Shape::DashDotDotStyle );
38   y+=20;
39   board.setLineStyle( Shape::DashDotDotDotStyle );
40   //  board.drawArrow( 10, y, 200, y );
41   board << Rectangle( 10, y, 200, 10, Color::Black, Color::Gray, 0.1, Shape::DashDotDotStyle );
42   y+=20;
43   board.setLineStyle( Shape::SolidStyle );
44   // board.drawArrow( 10, y, 200, y );
45   board << Rectangle( 10, y, 200, 10, Color::Black, Color::Red, 0.1, Shape::SolidStyle );
46   y+=20;
47 
48   board.saveEPS( "line_style.eps" );
49   board.saveFIG( "line_style.fig" );
50 
51   board.scaleToWidth(25,Board::UseLineWidth);
52   board.saveSVG( "line_style.svg", Board::BoundingBox, 0.0, Board::UCentimeter );
53 }
54