DGtal  0.9.2
dgtalBoard2D-3-custom-classes.cpp
1 
16 //LICENSE-END
30 #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 // //
void beginBlock(const std::string &keyword="")
Custom style class redefining the pen attributes. You may use Board2D::Color::None for transparent co...
Definition: Board2D.h:373
Trace trace
Definition: Common.h:130
Custom style class redefining the fill color. You may use Board2D::Color::None for transparent color...
Definition: Board2D.h:342
STL namespace.
double endBlock()
Custom style class redefining the pen color and the fill color. You may use Board2D::Color::None for ...
Definition: Board2D.h:278
void saveCairo(const char *filename, CairoType type=CairoPNG, PageSize size=Board::BoundingBox, double margin=10.0) const
Definition: Board.cpp:1139
void saveTikZ(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
Definition: Board.cpp:1219
Z2i this namespace gathers the standard of types for 2D imagery.
DGtal is the top-level namespace which contains all DGtal functions and types.
void saveSVG(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
Definition: Board.cpp:1012
void saveEPS(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
Definition: Board.cpp:805
Structure representing an RGB triple with alpha component.
Definition: Color.h:66
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)...
Definition: Board2D.h:70