This example shows you how to use colormaps with Board2D streams. Note how we redefine the style of a specific mode for the drawable element.
#include <cmath>
#include <iostream>
#include "DGtal/base/Common.h"
#include "DGtal/io/boards/Board2D.h"
#include "DGtal/io/Color.h"
#include "DGtal/io/colormaps/GradientColorMap.h"
#include "DGtal/shapes/Shapes.h"
#include "DGtal/helpers/StdDefs.h"
using namespace Z2i;
{
trace.
beginBlock (
"Example dgtalBoard2D-4-colormaps" );
shape_set.erase( c1 );
shape_set.erase( c2 );
<<
SetMode( p1.className(),
"Paving" );
string specificStyle = p1.className() + "/Paving";
for ( DigitalSet::ConstIterator it = shape_set.begin();
it != shape_set.end();
++it )
{
unsigned int d = (unsigned int) ceil( ( *it - c1 ).norm() );
cmap_grad( d ) ) )
<< *it;
}
board.
saveSVG(
"dgtalBoard2D-4-colormaps.svg");
board.
saveEPS(
"dgtalBoard2D-4-colormaps.eps");
board.
saveTikZ(
"dgtalBoard2D-4-colormaps.tikz");
#ifdef WITH_CAIRO
board.
saveCairo(
"dgtalBoard2D-4-colormaps-cairo.pdf", Board2D::CairoPDF);
board.
saveCairo(
"dgtalBoard2D-4-colormaps-cairo.png", Board2D::CairoPNG);
board.
saveCairo(
"dgtalBoard2D-4-colormaps-cairo.ps", Board2D::CairoPS);
board.
saveCairo(
"dgtalBoard2D-4-colormaps-cairo.svg", Board2D::CairoSVG);
#endif
return 0;
}
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)....
Structure representing an RGB triple with alpha component.
Aim: This class template may be used to (linearly) convert scalar values in a given range into a colo...
void addColor(const Color &color)
Aim: A utility class for constructing different shapes (balls, diamonds, and others).
void beginBlock(const std::string &keyword="")
void saveTikZ(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
void saveEPS(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
void saveSVG(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
void saveCairo(const char *filename, CairoType type=CairoPNG, PageSize size=Board::BoundingBox, double margin=10.0) const
DGtal is the top-level namespace which contains all DGtal functions and types.
Custom style class redefining the pen color and the fill color. You may use Board2D::Color::None for ...
Modifier class in a Board2D stream. Useful to choose your own mode for a given class....
HyperRectDomain< Space > Domain
Z2i::DigitalSet DigitalSet