DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
dgtalBoard2D-3-custom-classes.cpp
1 
16 //LICENSE-END
30 
31 #include <iostream>
32 #include "DGtal/base/Common.h"
33 #include "DGtal/io/boards/Board2D.h"
34 #include "DGtal/helpers/StdDefs.h"
35 #include "DGtal/io/Color.h"
37 
38 using namespace std;
39 using namespace DGtal;
40 using namespace DGtal::Z2i;
41 
43 int main()
44 {
45  trace.beginBlock ( "Example dgtalBoard2D-3-custom-classes" );
46 
47  Point p1( -3, -2 );
48  Point p2( 7, 3 );
49  Point p3( 0, 0 );
50  Domain domain( p1, p2 );
51 
52  Color red( 255, 0, 0 );
53  Color dred( 192, 0, 0 );
54  Color dgreen( 0, 192, 0 );
55  Color blue( 0, 0, 255 );
56  Color dblue( 0, 0, 192 );
57 
58  Board2D board;
59  board << domain
60  << CustomStyle( p1.className(), new CustomColors( red, dred ) )
61  << p1
62  << CustomStyle( p2.className(), new CustomFillColor( dgreen ) )
63  << p2
64  << CustomStyle( p3.className(),
65  new CustomPen( blue, dblue, 6.0,
66  Board2D::Shape::SolidStyle,
67  Board2D::Shape::RoundCap,
68  Board2D::Shape::RoundJoin ) )
69  << p3;
70  board.saveSVG("dgtalBoard2D-3-custom-classes.svg");
71  board.saveEPS("dgtalBoard2D-3-custom-classes.eps");
72  board.saveTikZ("dgtalBoard2D-3-custom-classes.tikz");
73 
74 #ifdef WITH_CAIRO
75  board.saveCairo("dgtalBoard2D-3-custom-classes-cairo.pdf", Board2D::CairoPDF);
76  board.saveCairo("dgtalBoard2D-3-custom-classes-cairo.png", Board2D::CairoPNG);
77  board.saveCairo("dgtalBoard2D-3-custom-classes-cairo.ps", Board2D::CairoPS);
78  board.saveCairo("dgtalBoard2D-3-custom-classes-cairo.svg", Board2D::CairoSVG);
79 #endif
80 
81  trace.endBlock();
82  return 0;
83 }
84 // //