DGtal 1.3.0
Loading...
Searching...
No Matches
Data Structures | Public Types | Public Member Functions | Static Public Attributes | Protected Attributes
LibBoard::Board Class Reference

Class for EPS, FIG or SVG drawings. More...

#include <Board/Board.h>

Inheritance diagram for LibBoard::Board:
LibBoard::ShapeList LibBoard::Shape DGtal::Board2D

Data Structures

struct  State
 

Public Types

enum  CairoType {
  CairoPDF , CairoPNG , CairoPS , CairoEPS ,
  CairoSVG
}
 
enum  PageSize { BoundingBox , A4 , Letter }
 
enum  Unit { UPoint , UInche , UCentimeter , UMillimeter }
 
- Public Types inherited from LibBoard::Shape
enum  LineCap { ButtCap = 0 , RoundCap , SquareCap }
 
enum  LineJoin { MiterJoin = 0 , RoundJoin , BevelJoin }
 
enum  LineStyle {
  SolidStyle = 0 , DashStyle , DotStyle , DashDotStyle ,
  DashDotDotStyle , DashDotDotDotStyle
}
 

Public Member Functions

 Board (const DGtal::Color &backgroundColor=DGtal::Color::None)
 
 Board (const Board &other)
 
 ~Board ()
 
Boardoperator= (const Board &other)
 
Boardoperator<< (const Shape &shape)
 
Boardoperator<< (Unit unit)
 
void clear (const DGtal::Color &color=DGtal::Color::None)
 
void clear (unsigned char red, unsigned char green, unsigned char blue)
 
Shaperotate (double angle, const Point &center)
 
Shaperotate (double angle)
 
Shapetranslate (double dx, double dy)
 
Shapescale (double sx, double sy)
 
Shapescale (double s)
 
Board rotated (double angle, const Point &center)
 
Board rotated (double angle)
 
Board translated (double dx, double dy)
 
Board scaled (double sx, double sy)
 
Board scaled (double s)
 
void setUnit (Unit unit)
 
void setUnit (double factor, Unit unit)
 
void drawDot (double x, double y, int depthValue=-1)
 
void drawLine (double x1, double y1, double x2, double y2, int depthValue=-1)
 
void drawQuadraticBezierCurve (double x1, double y1, double x2, double y2, double x3, double y3, int depthValue=-1)
 
void drawArrow (double x1, double y1, double x2, double y2, bool filled=true, int depthValue=-1)
 
void drawTriangle (double x1, double y1, double x2, double y2, double x3, double y3, int depthValue=-1)
 
void drawTriangle (const Point &p1, const Point &p2, const Point &p3, int depthValue=-1)
 
void drawArc (double x, double y, double radius, double angle1, double angle2, bool neg, int depthValue=-1)
 
void fillTriangle (double x1, double y1, double x2, double y2, double x3, double y3, int depthValue=-1)
 
void fillGouraudTriangle (const Point &p1, const DGtal::Color &color1, const Point &p2, const DGtal::Color &color2, const Point &p3, const DGtal::Color &color3, unsigned char divisions=3, int depthValue=-1)
 
void fillGouraudTriangle (const double x1, const double y1, const DGtal::Color &color1, const double x2, const double y2, const DGtal::Color &color2, const double x3, const double y3, const DGtal::Color &color3, unsigned char divisions=3, int depthValue=-1)
 
void fillGouraudTriangle (const Point &p1, const float brightness1, const Point &p2, const float brightness2, const Point &p3, const float brightness3, unsigned char divisions=3, int depthValue=-1)
 
void fillGouraudTriangle (const double x1, const double y1, const float brightness1, const double x2, const double y2, const float brightness2, const double x3, const double y3, const float brightness3, unsigned char divisions=3, int depthValue=-1)
 
void fillTriangle (const Point &p1, const Point &p2, const Point &p3, int depthValue=-1)
 
void drawRectangle (double x, double y, double width, double height, int depthValue=-1)
 
void drawImage (std::string filename, double x, double y, double width, double height, int depthValue=-1, double alpha=1.0)
 
void fillRectangle (double x, double y, double width, double height, int depthValue=-1)
 
void drawCircle (double x, double y, double radius, int depthValue=-1)
 
void fillCircle (double x, double y, double radius, int depthValue=-1)
 
void drawEllipse (double x, double y, double xRadius, double yRadius, int depthValue=-1)
 
void fillEllipse (double x, double y, double xRadius, double yRadius, int depthValue=-1)
 
void drawPolyline (const std::vector< Point > &points, int depthValue=-1)
 
void drawClosedPolyline (const std::vector< Point > &points, int depthValue=-1)
 
void fillPolyline (const std::vector< Point > &points, int depthValue=-1)
 
void drawText (double x, double y, const char *text, int depthValue=-1)
 
void drawText (double x, double y, const std::string &str, int depthValue=-1)
 
BoardsetFont (const Fonts::Font font, double fontSize)
 
BoardsetFontSize (double fontSize)
 
BoardsetPenColorRGBi (unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha=255)
 
BoardsetPenColorRGBf (float red, float green, float blue, float alpha=1.0f)
 
BoardsetPenColor (const DGtal::Color &color)
 
BoardsetFillColorRGBi (unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha=255)
 
BoardsetFillColorRGBf (float red, float green, float blue, float alpha=1.0f)
 
BoardsetFillColor (const DGtal::Color &color)
 
BoardsetLineWidth (double width)
 
BoardsetLineStyle (Shape::LineStyle style)
 
BoardsetLineCap (Shape::LineCap cap)
 
BoardsetLineJoin (Shape::LineJoin join)
 
void backgroundColor (const DGtal::Color &color)
 
void drawBoundingBox (int depthValue=-1)
 
void setClippingRectangle (double x, double y, double width, double height)
 
void setClippingPath (const std::vector< Point > &points)
 
void setClippingPath (const Path &path)
 
void addDuplicates (const Shape &shape, unsigned int times, double dx, double dy, double scale=1.0)
 
void addDuplicates (const Shape &shape, unsigned int times, double dx, double dy, double scaleX, double scaleY, double angle=0.0)
 
void save (const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
 
void save (const char *filename, double pageWidth, double pageHeight, double margin=10.0) const
 
void saveEPS (const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
 
void saveEPS (std::ostream &out, PageSize size=Board::BoundingBox, double margin=10.0) const
 
void saveEPS (const char *filename, double pageWidth, double pageHeight, double margin=10.0) const
 
void saveEPS (std::ostream &out, double pageWidth, double pageHeight, double margin=10.0) const
 
void saveFIG (const char *filename, PageSize size=Board::BoundingBox, double margin=10.0, bool includeFIGHeader=true) const
 
void saveFIG (std::ostream &out, PageSize size=Board::BoundingBox, double margin=10.0, bool includeFIGHeader=true) const
 
void saveFIG (const char *filename, double pageWidth, double pageHeight, double margin=10.0, bool includeFIGHeader=true) const
 
void saveFIG (std::ostream &out, double pageWidth, double pageHeight, double margin=10.0, bool includeFIGHeader=true) const
 
void saveSVG (const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
 
void saveSVG (std::ostream &out, PageSize size=Board::BoundingBox, double margin=10.0) const
 
void saveSVG (const char *filename, double pageWidth, double pageHeight, double margin=10.0) const
 
void saveSVG (std::ostream &out, double pageWidth, double pageHeight, double margin=10.0, std::string filename="output.svg") const
 
void saveCairo (const char *filename, CairoType type=CairoPNG, PageSize size=Board::BoundingBox, double margin=10.0) const
 
void saveCairo (const char *filename, CairoType type, double pageWidth, double pageHeight, double margin=10.0) const
 
void saveTikZ (const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
 
void saveTikZ (std::ostream &out, PageSize size=Board::BoundingBox, double margin=10.0) const
 
void saveTikZ (const char *filename, double pageWidth, double pageHeight, double margin=10.0) const
 
void saveTikZ (std::ostream &out, double pageWidth, double pageHeight, double margin=10.0) const
 
- Public Member Functions inherited from LibBoard::ShapeList
 ShapeList (int depth=-1)
 
 ShapeList (const ShapeList &other)
 
 ~ShapeList ()
 
const std::string & name () const
 
ShapeListclear ()
 
Point center () const
 
Shaperotate (double angle, const Point &center)
 
ShapeList rotated (double angle, const Point &center)
 
Shaperotate (double angle)
 
ShapeList rotated (double angle)
 
Shapetranslate (double dx, double dy)
 
ShapeList translated (double dx, double dy)
 
Shapescale (double sx, double sy)
 
Shapescale (double s)
 
ShapeList scaled (double sx, double sy)
 
ShapeList scaled (double s)
 
void scaleAll (double s)
 
void flushPostscript (std::ostream &stream, const TransformEPS &transform) const
 
void flushFIG (std::ostream &stream, const TransformFIG &transform, std::map< DGtal::Color, int > &colormap) const
 
void flushSVG (std::ostream &stream, const TransformSVG &transform) const
 
void flushCairo (cairo_t *cr, const TransformCairo &transform) const
 
void flushTikZ (std::ostream &stream, const TransformTikZ &transform) const
 
Rect boundingBox () const
 
virtual int minDepth () const
 
virtual int maxDepth () const
 
void shiftDepth (int shift)
 
Shapeclone () const
 
ShapeListoperator= (const ShapeList &other)
 
ShapeListoperator<< (const Shape &shape)
 
ShapeListoperator+= (const Shape &shape)
 
ShapeListinsert (const Shape &shape, int depth)
 
ShapeListdup (unsigned int copies=1)
 
template<typename T >
T & last (const unsigned int position=0)
 
Shapelast (const unsigned int position=0)
 
Shapetop ()
 
- Public Member Functions inherited from LibBoard::Shape
 Shape (DGtal::Color penColor, DGtal::Color fillColor, double lineWidth, LineStyle style, const LineCap cap, const LineJoin join, int depth)
 
virtual ~Shape ()
 
virtual const std::string & name () const
 
virtual Shapeclone () const =0
 
bool filled () const
 
virtual Point center () const =0
 
virtual Shaperotate (double angle, const Point &center)=0
 
virtual Shaperotate (double angle)=0
 
ShaperotateDeg (double angle, const Point &center)
 
ShaperotateDeg (double angle)
 
virtual Shapetranslate (double dx, double dy)=0
 
virtual Shapescale (double sx, double sy)=0
 
virtual Shapescale (double s)=0
 
virtual Rect boundingBox () const =0
 
Rect bbox ()
 
Shapeoperator-- ()
 
Shapeoperator++ ()
 
virtual void scaleAll (double s)=0
 
virtual void flushPostscript (std::ostream &stream, const TransformEPS &transform) const =0
 
virtual void flushFIG (std::ostream &stream, const TransformFIG &transform, std::map< DGtal::Color, int > &colormap) const =0
 
virtual void flushSVG (std::ostream &stream, const TransformSVG &transform) const =0
 
virtual void flushCairo (cairo_t *cr, const TransformCairo &transform) const =0
 
virtual void flushTikZ (std::ostream &stream, const TransformTikZ &transform) const =0
 
int depth () const
 
virtual void depth (int)
 
virtual void shiftDepth (int shift)
 
const DGtal::ColorpenColor () const
 
const DGtal::ColorfillColor () const
 

Static Public Attributes

static const double Degree = 3.14159265358979323846 / 180.0
 

Protected Attributes

State _state
 
DGtal::Color _backgroundColor
 
Path _clippingPath
 
- Protected Attributes inherited from LibBoard::ShapeList
std::vector< Shape * > _shapes
 
int _nextDepth
 
- Protected Attributes inherited from LibBoard::Shape
int _depth
 
DGtal::Color _penColor
 
DGtal::Color _fillColor
 
double _lineWidth
 
LineStyle _lineStyle
 
LineCap _lineCap
 
LineJoin _lineJoin
 

Additional Inherited Members

- Protected Member Functions inherited from LibBoard::ShapeList
void addShape (const Shape &shape, double scaleFactor)
 
void free ()
 
- Protected Member Functions inherited from LibBoard::Shape
std::string svgProperties (const TransformSVG &transform) const
 
std::string postscriptProperties () const
 
void setCairoDashStyle (cairo_t *cr, LineStyle type) const
 
std::string tikzProperties (const TransformTikZ &transform) const
 

Detailed Description

Class for EPS, FIG or SVG drawings.

The Board class.

Version
0.5

Definition at line 35 of file Board.h.

Member Enumeration Documentation

◆ CairoType

Enumerator
CairoPDF 
CairoPNG 
CairoPS 
CairoEPS 
CairoSVG 

Definition at line 40 of file Board.h.

◆ PageSize

Enumerator
BoundingBox 
A4 
Letter 

Definition at line 42 of file Board.h.

◆ Unit

Enumerator
UPoint 
UInche 
UCentimeter 
UMillimeter 

Definition at line 43 of file Board.h.

Constructor & Destructor Documentation

◆ Board() [1/2]

LibBoard::Board::Board ( const DGtal::Color backgroundColor = DGtal::Color::None)

Constructs a new board and sets the background color, if any.

Parameters
backgroundColorA color for the drawing's background.

Definition at line 104 of file Board.cpp.

105 : _backgroundColor( bgColor )
106{
107}
DGtal::Color _backgroundColor
Definition: Board.h:956

◆ Board() [2/2]

LibBoard::Board::Board ( const Board other)

Copy constructor.

Parameters
otherThe object to be copied.

Definition at line 109 of file Board.cpp.

110 : ShapeList( other ),
111 _state( other._state ),
112 _backgroundColor( other._backgroundColor )
113{
114}
State _state
Definition: Board.h:955
ShapeList(int depth=-1)

◆ ~Board()

LibBoard::Board::~Board ( )

Definition at line 146 of file Board.cpp.

147{
148
149}

Member Function Documentation

◆ addDuplicates() [1/2]

void LibBoard::Board::addDuplicates ( const Shape shape,
unsigned int  times,
double  dx,
double  dy,
double  scale = 1.0 
)

Insert duplicates of a shape, n times, starting at its current position and iterating given translations and scalings.

Parameters
shapeThe shape to be duplicated.
timesThe number of duplicates.
dxThe x shift.
dyThe y shift.
scaleA scale factor between each copy.

Definition at line 767 of file Board.cpp.

770{
771 Shape * s = shape.clone();
772 while ( times-- ) {
773 (*this) << (*s);
774 if ( scaleValue != 1.0 )
775 s->scale( scaleValue );
776 s->translate( dx, dy );
777 }
778 delete s;
779}

References LibBoard::Shape::clone(), LibBoard::Shape::scale(), and LibBoard::Shape::translate().

◆ addDuplicates() [2/2]

void LibBoard::Board::addDuplicates ( const Shape shape,
unsigned int  times,
double  dx,
double  dy,
double  scaleX,
double  scaleY,
double  angle = 0.0 
)

Insert duplicates of a shape, n times, starting at its current position and iterating a given translation.

Parameters
shapeThe shape to be duplicated.
timesThe number of duplicates.
dxThe x shift.
dyThe y shift.
scaleXAn x scale factor between each copy.
scaleYA y scale factor between each copy.
angleAn angular increment.

Definition at line 782 of file Board.cpp.

787{
788 Shape * s = shape.clone();
789 while ( times-- ) {
790 (*this) << (*s);
791 if ( scaleX != 1.0 || scaleY != 1.0 ) s->scale( scaleX, scaleY );
792 if ( dx != 0.0 || dy != 0.0 ) s->translate( dx, dy );
793 if ( angle != 0.0 ) s->rotate( angle );
794 }
795 delete s;
796}

References LibBoard::Shape::clone(), LibBoard::Shape::rotate(), LibBoard::Shape::scale(), and LibBoard::Shape::translate().

◆ backgroundColor()

void LibBoard::Board::backgroundColor ( const DGtal::Color color)

Changes the background color of the whole drawing.

Parameters
colorA color (may be Color::None).

Definition at line 351 of file Board.cpp.

352{
353 _backgroundColor = color;
354}

References _backgroundColor.

◆ clear() [1/2]

void LibBoard::Board::clear ( const DGtal::Color color = DGtal::Color::None)

Clears the board with a given background color.

Parameters
colorThe board background color (may be Color::None).
Examples
arithmetic/lower-integer-convex-hull.cpp, doc-examples/kernelDomain.cpp, geometry/curves/exampleArithmeticalDSS.cpp, geometry/curves/exampleGridCurve2d.cpp, geometry/tools/exampleConvexHull2D.cpp, geometry/volumes/distance/distancetransform2D.cpp, geometry/volumes/distance/voronoimap2D.cpp, graph/graphTraversal.cpp, images/exampleConstImageAdapter.cpp, images/exampleTiledImage.cpp, io/boards/dgtalBoard2D-2-sets.cpp, io/boards/exampleBezierCurve.cpp, topology/cubical-complex-illustrations.cpp, and topology/generateSimplicityTables2D.cpp.

Definition at line 152 of file Board.cpp.

153{
155 _backgroundColor = color;
156}
ShapeList & clear()
Definition: ShapeList.cpp:43

References _backgroundColor, and LibBoard::ShapeList::clear().

Referenced by checkCut(), checkOutputConvexHullBorder(), convexHull(), drawComplex(), exampleStandardDSS(), main(), moduleImages_example(), specificTestLatticePolytope2D(), testBoard2D(), testBoard2DCustomStyle(), testCellDrawOnBoard(), testChessboard(), testCMAP(), testDepthFirstPropagation(), testDigitalSetBoardSnippet(), testDistanceTransformation(), testDistanceTransformationBorder(), testDistanceTransformationNeg(), testDTFromSet(), testGetSetVal(), testImageAdapter(), testImplicitShape(), testKanungo2D(), testLatticePolytope2D(), testLayers(), testObjectBorder(), testSimpleExpander(), testSimplePoints2D(), and testVoronoiMap().

◆ clear() [2/2]

void LibBoard::Board::clear ( unsigned char  red,
unsigned char  green,
unsigned char  blue 
)

Clears the board and set the background color from an RGB triple.

Parameters
redred
greengreen
blueblue

References rotate().

◆ drawArc()

void LibBoard::Board::drawArc ( double  x,
double  y,
double  radius,
double  angle1,
double  angle2,
bool  neg,
int  depthValue = -1 
)

Draws an arc.

Parameters
xFirst coordinate of the arc center.
ySecond coordinate of the arc center.
radiusarc radius.
angle1first angle.
angle2second angle.
negneg
depthValueDepth of the arc.

Definition at line 461 of file Board.cpp.

462 {
463 int d = (depthValue != -1) ? depthValue : _nextDepth--;
464 _shapes.push_back( new Arc( _state.unit(x), _state.unit(y), _state.unit(radius),
465 angle1, angle2, neg,_state.penColor,
467}
static const Color None
Definition: Color.h:412
double unit(const double &x)
Definition: Board.h:951
DGtal::Color penColor
Definition: Board.h:941
Shape::LineStyle lineStyle
Definition: Board.h:944
std::vector< Shape * > _shapes
Definition: ShapeList.h:169

References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::lineStyle, LibBoard::Board::State::lineWidth, DGtal::Color::None, LibBoard::Board::State::penColor, and LibBoard::Board::State::unit().

◆ drawArrow()

void LibBoard::Board::drawArrow ( double  x1,
double  y1,
double  x2,
double  y2,
bool  filled = true,
int  depthValue = -1 
)

Draws a line from (x1,y1) to (x2,y2) with an arrow at (x2,y2).

Parameters
x1First coordinate of the first extremity.
y1Second coordinate of the first extremity.
x2First coordinate of the second extremity.
y2Second coordinate of the second extremity.
filledWhether or not the arrow is filled.
depthValueDepth of the line.
Examples
geometry/curves/exampleArithmeticalDSL.cpp, and geometry/curves/exampleArithmeticalDSS.cpp.

Definition at line 400 of file Board.cpp.

403{
404 if ( depthValue != -1 )
405 _shapes.push_back( new Arrow( _state.unit(x1), _state.unit(y1),
406 _state.unit(x2), _state.unit(y2),
409 else
410 _shapes.push_back( new Arrow( _state.unit(x1), _state.unit(y1),
411 _state.unit(x2), _state.unit(y2),
414}
Shape::LineJoin lineJoin
Definition: Board.h:946
Shape::LineCap lineCap
Definition: Board.h:945

References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::lineCap, LibBoard::Board::State::lineJoin, LibBoard::Board::State::lineStyle, LibBoard::Board::State::lineWidth, DGtal::Color::None, LibBoard::Board::State::penColor, and LibBoard::Board::State::unit().

Referenced by drawArithmeticalDSL(), exampleNaiveDSL(), exampleStandardDSL(), and exampleUpdate().

◆ drawBoundingBox()

void LibBoard::Board::drawBoundingBox ( int  depthValue = -1)

Draws the current drawing's bounding box as a rectangle.

Parameters
depthValueThe depth of the rectangle.

Definition at line 710 of file Board.cpp.

711{
712 int d = (depthValue != -1) ? depthValue : _nextDepth--;
713 Rect box = boundingBox();
714 _shapes.push_back( new Rectangle( _state.unit(box.left),
715 _state.unit(box.top),
716 _state.unit(box.width),
717 _state.unit(box.height),
724 d ) );
725}
DGtal::Color fillColor
Definition: Board.h:942
Rect boundingBox() const
Definition: ShapeList.cpp:379

References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::ShapeList::boundingBox(), LibBoard::Board::State::fillColor, LibBoard::Rect::height, LibBoard::Rect::left, LibBoard::Board::State::lineCap, LibBoard::Board::State::lineJoin, LibBoard::Board::State::lineStyle, LibBoard::Board::State::lineWidth, LibBoard::Board::State::penColor, LibBoard::Rect::top, LibBoard::Board::State::unit(), and LibBoard::Rect::width.

◆ drawCircle()

void LibBoard::Board::drawCircle ( double  x,
double  y,
double  radius,
int  depthValue = -1 
)

Draws a circle.

Parameters
xFirst coordinate of the circle's center.
ySecond coordinate of the circle's center.
radiusRadius of the circle.
depthValueDepth of the circle.
Examples
geometry/tools/exampleConvexHull2D.cpp.

Definition at line 451 of file Board.cpp.

453{
454 int d = (depthValue != -1) ? depthValue : _nextDepth--;
455 _shapes.push_back( new Circle( _state.unit(x), _state.unit(y), _state.unit(radius),
458}

References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::fillColor, LibBoard::Board::State::lineStyle, LibBoard::Board::State::lineWidth, LibBoard::Board::State::penColor, and LibBoard::Board::State::unit().

Referenced by convexHull(), testAlphaThickSegmentFreeman(), testConvexHullCompThickness(), and testThicknessDefinitions().

◆ drawClosedPolyline()

void LibBoard::Board::drawClosedPolyline ( const std::vector< Point > &  points,
int  depthValue = -1 
)

Draws a closed polygonal line.

Parameters
pointsA vector of points.
depthValueThe depth of the polyline.

Definition at line 531 of file Board.cpp.

533{
534 int d = (depthValue != -1) ? depthValue : _nextDepth--;
535 std::vector<Point> v = points;
536 std::vector<Point>::iterator it = v.begin();
537 std::vector<Point>::iterator end = v.end();
538 while ( it != end ) {
539 (*it) = _state.unit( *it );
540 ++it;
541 }
542 _shapes.push_back( new Polyline( v, true, _state.penColor, _state.fillColor,
547 d ) );
548}

References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::fillColor, LibBoard::Board::State::lineCap, LibBoard::Board::State::lineJoin, LibBoard::Board::State::lineStyle, LibBoard::Board::State::lineWidth, LibBoard::Board::State::penColor, and LibBoard::Board::State::unit().

◆ drawDot()

void LibBoard::Board::drawDot ( double  x,
double  y,
int  depthValue = -1 
)

Draws a dot at coordinates (x,y).

Parameters
xFirst coordinate of the dot.
ySecond coordinate of the dot.
depthValueDepth of the line.

Definition at line 357 of file Board.cpp.

358{
359 if ( depthValue != -1 )
360 _shapes.push_back( new Dot( _state.unit(x), _state.unit(y),
361 _state.penColor, _state.lineWidth, depthValue ) );
362 else
363 _shapes.push_back( new Dot( _state.unit(x), _state.unit(y),
365}

References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::lineWidth, LibBoard::Board::State::penColor, and LibBoard::Board::State::unit().

◆ drawEllipse()

void LibBoard::Board::drawEllipse ( double  x,
double  y,
double  xRadius,
double  yRadius,
int  depthValue = -1 
)

Draws an ellipse.

Parameters
xFirst coordinate of the circle's center.
ySecond coordinate of the circle's center.
xRadiusRadius of the circle.
yRadiusRadius of the circle.
depthValueDepth of the circle.

Definition at line 482 of file Board.cpp.

485{
486 int d = (depthValue != -1) ? depthValue : _nextDepth--;
487 _shapes.push_back( new Ellipse( _state.unit(x), _state.unit(y),
488 _state.unit(xRadius), _state.unit(yRadius),
493 d ) );
494}
Aim: Model of the concept StarShaped represents any ellipse in the plane.
Definition: Ellipse2D.h:65

References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::fillColor, LibBoard::Board::State::lineStyle, LibBoard::Board::State::lineWidth, LibBoard::Board::State::penColor, and LibBoard::Board::State::unit().

◆ drawImage()

void LibBoard::Board::drawImage ( std::string  filename,
double  x,
double  y,
double  width,
double  height,
int  depthValue = -1,
double  alpha = 1.0 
)

Draws an image.

Parameters
filenamefilename
xFirst coordinate of the upper left corner.
ySecond coordinate of the upper left corner.
widthWidth of the rectangle.
heightHeight of the rectangle.
depthValueDepth of the rectangle.
alphaTransparency used in the image display.

Definition at line 428 of file Board.cpp.

431{
432 int d = (depthValue != -1) ? depthValue : _nextDepth--;
433 _shapes.push_back( new Image( _state.unit(x), _state.unit(y), _state.unit(width), _state.unit(height),
434 filename, d, alpha ) );
435}
ImageContainerBySTLVector< Domain, Value > Image

References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, and LibBoard::Board::State::unit().

Referenced by main().

◆ drawLine()

void LibBoard::Board::drawLine ( double  x1,
double  y1,
double  x2,
double  y2,
int  depthValue = -1 
)

Draws a line from (x1,y1) to (x2,y2).

Parameters
x1First coordinate of the first extremity.
y1Second coordinate of the first extremity.
x2First coordinate of the second extremity.
y2Second coordinate of the second extremity.
depthValueDepth of the line.
Examples
geometry/curves/exampleAlphaThickSegmentNoisy.cpp, geometry/curves/exampleDigitalConvexity.cpp, geometry/curves/exampleRationalConvexity.cpp, and geometry/tools/exampleConvexHull2D.cpp.

Definition at line 368 of file Board.cpp.

370{
371 if ( depthValue != -1 )
372 _shapes.push_back( new Line( _state.unit(x1), _state.unit(y1),
373 _state.unit(x2), _state.unit(y2),
375 _state.lineStyle, _state.lineCap, _state.lineJoin, depthValue ) );
376 else
377 _shapes.push_back( new Line( _state.unit(x1), _state.unit(y1),
378 _state.unit(x2), _state.unit(y2),
381}

References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::lineCap, LibBoard::Board::State::lineJoin, LibBoard::Board::State::lineStyle, LibBoard::Board::State::lineWidth, LibBoard::Board::State::penColor, and LibBoard::Board::State::unit().

Referenced by convexHull(), main(), testAlphaThickSegmentComputerFloatingPointContour(), testAlphaThickSegmentConvexHullAndBox(), testAlphaThickSpecialInit(), testConvexHullCompThickness(), and testThicknessDefinitions().

◆ drawPolyline()

void LibBoard::Board::drawPolyline ( const std::vector< Point > &  points,
int  depthValue = -1 
)

Draws a polygonal line.

Parameters
pointsA vector of points.
depthValueThe depth of the polyline.

Definition at line 511 of file Board.cpp.

513{
514 int d = (depthValue != -1) ? depthValue : _nextDepth--;
515 std::vector<Point> v = points;
516 std::vector<Point>::iterator it = v.begin();
517 std::vector<Point>::iterator end = v.end();
518 while ( it != end ) {
519 (*it) = _state.unit( *it );
520 ++it;
521 }
522 _shapes.push_back( new Polyline( v, false, _state.penColor, _state.fillColor,
527 d ) );
528}

References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::fillColor, LibBoard::Board::State::lineCap, LibBoard::Board::State::lineJoin, LibBoard::Board::State::lineStyle, LibBoard::Board::State::lineWidth, LibBoard::Board::State::penColor, and LibBoard::Board::State::unit().

◆ drawQuadraticBezierCurve()

void LibBoard::Board::drawQuadraticBezierCurve ( double  x1,
double  y1,
double  x2,
double  y2,
double  x3,
double  y3,
int  depthValue = -1 
)

Draws a quadratic Bezier curve from (x1,y1) to (x3,y3), with (x2,y2) as middle control point.

Parameters
x1First coordinate of the first point.
y1Second coordinate of the first point.
x2First coordinate of the middle point.
y2Second coordinate of the middle point.
x3First coordinate of the last point.
y3Second coordinate of the last point.
depthValueDepth of the line.
Examples
io/boards/exampleBezierCurve.cpp.

Definition at line 384 of file Board.cpp.

386{
387 if ( depthValue != -1 )
388 _shapes.push_back( new QuadraticBezierCurve( _state.unit(x1), _state.unit(y1),
389 _state.unit(x2), _state.unit(y2), _state.unit(x3), _state.unit(y3),
391 _state.lineStyle, _state.lineCap, _state.lineJoin, depthValue ) );
392 else
393 _shapes.push_back( new QuadraticBezierCurve( _state.unit(x1), _state.unit(y1),
394 _state.unit(x2), _state.unit(y2), _state.unit(x3), _state.unit(y3),
397}

References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::fillColor, LibBoard::Board::State::lineCap, LibBoard::Board::State::lineJoin, LibBoard::Board::State::lineStyle, LibBoard::Board::State::lineWidth, LibBoard::Board::State::penColor, and LibBoard::Board::State::unit().

Referenced by main().

◆ drawRectangle()

void LibBoard::Board::drawRectangle ( double  x,
double  y,
double  width,
double  height,
int  depthValue = -1 
)

Draws a rectangle.

Parameters
xFirst coordinate of the upper left corner.
ySecond coordinate of the upper left corner.
widthWidth of the rectangle.
heightHeight of the rectangle.
depthValueDepth of the rectangle.

Definition at line 417 of file Board.cpp.

420{
421 int d = (depthValue != -1) ? depthValue : _nextDepth--;
422 _shapes.push_back( new Rectangle( _state.unit(x), _state.unit(y), _state.unit(width), _state.unit(height),
425}

References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::fillColor, LibBoard::Board::State::lineCap, LibBoard::Board::State::lineJoin, LibBoard::Board::State::lineStyle, LibBoard::Board::State::lineWidth, LibBoard::Board::State::penColor, and LibBoard::Board::State::unit().

Referenced by addColorMapSample().

◆ drawText() [1/2]

void LibBoard::Board::drawText ( double  x,
double  y,
const char *  text,
int  depthValue = -1 
)

Draws a string of text.

Parameters
xThe first coordinates of the lower left corner.
yThe second coordinates of the lower left corner.
textThe text.
depthValueThe depth of the text.

Definition at line 693 of file Board.cpp.

695{
696 int d = (depthValue != -1) ? depthValue : _nextDepth--;
697 _shapes.push_back( new Text( _state.unit(x), _state.unit(y), text,
699}
Fonts::Font font
Definition: Board.h:947

References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::font, LibBoard::Board::State::fontSize, LibBoard::Board::State::penColor, and LibBoard::Board::State::unit().

Referenced by addColorMapSample().

◆ drawText() [2/2]

void LibBoard::Board::drawText ( double  x,
double  y,
const std::string &  str,
int  depthValue = -1 
)

Draws a string of text.

Parameters
xThe first coordinates of the lower left corner.
yThe second coordinates of the lower left corner.
strThe text.
depthValueThe depth of the text.

Definition at line 702 of file Board.cpp.

703{
704 int d = (depthValue != -1) ? depthValue : _nextDepth--;
705 _shapes.push_back( new Text( _state.unit(x), _state.unit(y), str,
707}

References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::font, LibBoard::Board::State::fontSize, LibBoard::Board::State::penColor, and LibBoard::Board::State::unit().

◆ drawTriangle() [1/2]

void LibBoard::Board::drawTriangle ( const Point p1,
const Point p2,
const Point p3,
int  depthValue = -1 
)

Draws a triangle.

Parameters
p1First vertex.
p2Second vertex.
p3Third vertex.
depthValueDepth of the triangle.

Definition at line 590 of file Board.cpp.

594{
595 int d = (depthValue != -1) ? depthValue : _nextDepth--;
596 std::vector<Point> points;
597 points.push_back( Point( _state.unit(p1.x), _state.unit(p1.y) ) );
598 points.push_back( Point( _state.unit(p2.x), _state.unit(p2.y) ) );
599 points.push_back( Point( _state.unit(p3.x), _state.unit(p3.y) ) );
600 _shapes.push_back( new Polyline( points, true, _state.penColor, _state.fillColor,
605 d ) );
606}
MyPointD Point
Definition: testClone2.cpp:383

References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::fillColor, LibBoard::Board::State::lineCap, LibBoard::Board::State::lineJoin, LibBoard::Board::State::lineStyle, LibBoard::Board::State::lineWidth, LibBoard::Board::State::penColor, LibBoard::Board::State::unit(), LibBoard::Point::x, and LibBoard::Point::y.

◆ drawTriangle() [2/2]

void LibBoard::Board::drawTriangle ( double  x1,
double  y1,
double  x2,
double  y2,
double  x3,
double  y3,
int  depthValue = -1 
)

Draws a triangle.

Parameters
x1First coordinate of the first vertex.
y1Second coordinate of the first vertex.
x2First coordinate of the second vertex.
y2Second coordinate of the second vertex.
x3First coordinate of the third vertex.
y3Second coordinate of the third vertex.
depthValueDepth of the triangle.

Definition at line 571 of file Board.cpp.

575{
576 int d = (depthValue != -1) ? depthValue : _nextDepth--;
577 std::vector<Point> points;
578 points.push_back( Point( _state.unit(x1), _state.unit(y1) ) );
579 points.push_back( Point( _state.unit(x2), _state.unit(y2) ) );
580 points.push_back( Point( _state.unit(x3), _state.unit(y3) ) );
581 _shapes.push_back( new Polyline( points, true, _state.penColor, _state.fillColor,
586 d ) );
587}

References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::fillColor, LibBoard::Board::State::lineCap, LibBoard::Board::State::lineJoin, LibBoard::Board::State::lineStyle, LibBoard::Board::State::lineWidth, LibBoard::Board::State::penColor, and LibBoard::Board::State::unit().

◆ fillCircle()

void LibBoard::Board::fillCircle ( double  x,
double  y,
double  radius,
int  depthValue = -1 
)

Draws a circle filled with the current pen color.

Parameters
xFirst coordinate of the circle's center.
ySecond coordinate of the circle's center.
radiusRadius of the circle.
depthValueDepth of the circle.
Examples
geometry/curves/exampleAlphaThickSegmentTgtCover.cpp.

Definition at line 471 of file Board.cpp.

474{
475 int d = (depthValue != -1) ? depthValue : _nextDepth--;
476 _shapes.push_back( new Circle( _state.unit(x), _state.unit(y), _state.unit(radius),
478 0.0f, _state.lineStyle, d ) );
479}

References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::lineStyle, DGtal::Color::None, LibBoard::Board::State::penColor, and LibBoard::Board::State::unit().

Referenced by main(), testAlphaThickSegmentConvexHullAndBox(), testAlphaThickSegmentFreeman(), and testAlphaThickSpecialInit().

◆ fillEllipse()

void LibBoard::Board::fillEllipse ( double  x,
double  y,
double  xRadius,
double  yRadius,
int  depthValue = -1 
)

Draws an ellipse filled with the current pen color.

Parameters
xFirst coordinate of the circle's center.
ySecond coordinate of the circle's center.
xRadiusX axis radius of the ellipse.
yRadiusY axis radius of the ellipse.
depthValueDepth of the circle.

Definition at line 497 of file Board.cpp.

500{
501 int d = depthValue ? depthValue : _nextDepth--;
502 _shapes.push_back( new Ellipse( _state.unit(x), _state.unit(y), _state.unit(xRadius), _state.unit(yRadius),
505 0.0f,
507 d ) );
508}

References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::lineStyle, DGtal::Color::None, LibBoard::Board::State::penColor, and LibBoard::Board::State::unit().

◆ fillGouraudTriangle() [1/4]

void LibBoard::Board::fillGouraudTriangle ( const double  x1,
const double  y1,
const DGtal::Color color1,
const double  x2,
const double  y2,
const DGtal::Color color2,
const double  x3,
const double  y3,
const DGtal::Color color3,
unsigned char  divisions = 3,
int  depthValue = -1 
)

Draws a triangle with Gouraud-like shaded colors.

Parameters
x1x1
y1y1
color1color1
x2x2
y2y2
color2color2
x3x3
y3y3
color3color3
divisionsnumber of subdivisions
depthValuedepth

◆ fillGouraudTriangle() [2/4]

void LibBoard::Board::fillGouraudTriangle ( const double  x1,
const double  y1,
const float  brightness1,
const double  x2,
const double  y2,
const float  brightness2,
const double  x3,
const double  y3,
const float  brightness3,
unsigned char  divisions = 3,
int  depthValue = -1 
)

Draws a triangle with a Gouraud-like shaded color according to the current fill color and a brightness value given for each vertex.

Parameters
x1x1
y1y1
brightness1b1
x2x2
y2y2
brightness2b2
x3x3
y3y3
brightness3b3
divisionsnumber of sudivisions
depthValuedepth

◆ fillGouraudTriangle() [3/4]

void LibBoard::Board::fillGouraudTriangle ( const Point p1,
const DGtal::Color color1,
const Point p2,
const DGtal::Color color2,
const Point p3,
const DGtal::Color color3,
unsigned char  divisions = 3,
int  depthValue = -1 
)

Draws a triangle with Gouraud-like shaded colors.

Parameters
p1p1
color1color1
p2p2
color2color2
p3p3
color3color3
divisionsnumber of triangle subdivisions.
depthValueThe depth of the triangle.

Definition at line 647 of file Board.cpp.

655{
656 int d = (depthValue != -1) ? depthValue : _nextDepth--;
657 _shapes.push_back( new GouraudTriangle( Point( _state.unit(p1.x), _state.unit(p1.y) ), color1,
658 Point( _state.unit(p2.x), _state.unit(p2.y) ), color2,
659 Point( _state.unit(p3.x), _state.unit(p3.y) ), color3,
660 divisions, d ) );
661}

References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::unit(), LibBoard::Point::x, and LibBoard::Point::y.

Referenced by fillGouraudTriangle().

◆ fillGouraudTriangle() [4/4]

void LibBoard::Board::fillGouraudTriangle ( const Point p1,
const float  brightness1,
const Point p2,
const float  brightness2,
const Point p3,
const float  brightness3,
unsigned char  divisions = 3,
int  depthValue = -1 
)

Draws a triangle with a Gouraud-like shaded color according to the current fill color and a brightness value given for each vertex.

Parameters
p1p1
brightness1brightness1
p2p2
brightness2brightness2
p3p3
brightness3brightness3
divisionsnumber of triangle subdivisions.
depthValueThe depth of the triangle.

Definition at line 664 of file Board.cpp.

672{
673 DGtal::Color color1( _state.penColor );
674 DGtal::Color color2( _state.penColor );
675 DGtal::Color color3( _state.penColor );
676 color1.red( static_cast<unsigned char>( std::min( 255.0f, color1.red() * brightness1 ) ) );
677 color1.green( static_cast<unsigned char>( std::min( 255.0f, color1.green() * brightness1 ) ) );
678 color1.blue( static_cast<unsigned char>( std::min( 255.0f, color1.blue() * brightness1 ) ) );
679 color2.red( static_cast<unsigned char>( std::min( 255.0f, color2.red() * brightness2 ) ) );
680 color2.green( static_cast<unsigned char>( std::min( 255.0f, color2.green() * brightness2 ) ) );
681 color2.blue( static_cast<unsigned char>( std::min( 255.0f, color2.blue() * brightness2 ) ) );
682 color3.red( static_cast<unsigned char>( std::min( 255.0f, color3.red() * brightness3 ) ) );
683 color3.green( static_cast<unsigned char>( std::min( 255.0f, color3.green() * brightness3 ) ) );
684 color3.blue( static_cast<unsigned char>( std::min( 255.0f, color3.blue() * brightness3 ) ) );
685 fillGouraudTriangle( Point( _state.unit(p1.x), _state.unit(p1.y) ), color1,
686 Point( _state.unit(p2.x), _state.unit(p2.y) ), color2,
687 Point( _state.unit(p3.x), _state.unit(p3.y) ), color3,
688 divisions,
689 depthValue );
690}
Structure representing an RGB triple with alpha component.
Definition: Color.h:68
void fillGouraudTriangle(const Point &p1, const DGtal::Color &color1, const Point &p2, const DGtal::Color &color2, const Point &p3, const DGtal::Color &color3, unsigned char divisions=3, int depthValue=-1)
Definition: Board.cpp:647

References _state, DGtal::Color::blue(), fillGouraudTriangle(), DGtal::Color::green(), LibBoard::Board::State::penColor, DGtal::Color::red(), LibBoard::Board::State::unit(), LibBoard::Point::x, and LibBoard::Point::y.

◆ fillPolyline()

void LibBoard::Board::fillPolyline ( const std::vector< Point > &  points,
int  depthValue = -1 
)

Draws a filled polygon.

Parameters
pointsA vector of points.
depthValueThe depth of the polygon.
Examples
geometry/curves/exampleAlphaThickSegmentTgtCover.cpp, and geometry/curves/greedyAlphaThickDecomposition.cpp.

Definition at line 551 of file Board.cpp.

553{
554 int d = (depthValue != -1) ? depthValue : _nextDepth--;
555 std::vector<Point> v = points;
556 std::vector<Point>::iterator it = v.begin();
557 std::vector<Point>::iterator end = v.end();
558 while ( it != end ) {
559 (*it) = _state.unit( *it );
560 ++it;
561 }
562 _shapes.push_back( new Polyline( v, true, DGtal::Color::None, _state.penColor,
563 0.0f,
567 d ) );
568}

References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::lineCap, LibBoard::Board::State::lineJoin, LibBoard::Board::State::lineStyle, DGtal::Color::None, LibBoard::Board::State::penColor, and LibBoard::Board::State::unit().

Referenced by main().

◆ fillRectangle()

void LibBoard::Board::fillRectangle ( double  x,
double  y,
double  width,
double  height,
int  depthValue = -1 
)

Draws a rectangle filled with the current pen color.

Parameters
xFirst coordinate of the upper left corner.
ySecond coordinate of the upper left corner.
widthWidth of the rectangle.
heightHeight of the rectangle.
depthValueDepth of the rectangle.

Definition at line 439 of file Board.cpp.

442{
443 int d = (depthValue != -1) ? depthValue : _nextDepth--;
444 _shapes.push_back( new Rectangle( _state.unit(x), _state.unit(y), _state.unit(width), _state.unit(height),
447 d ) );
448}

References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::lineCap, LibBoard::Board::State::lineJoin, LibBoard::Board::State::lineStyle, DGtal::Color::None, LibBoard::Board::State::penColor, and LibBoard::Board::State::unit().

◆ fillTriangle() [1/2]

void LibBoard::Board::fillTriangle ( const Point p1,
const Point p2,
const Point p3,
int  depthValue = -1 
)

Draws a filled triangle.

Parameters
p1First vertex.
p2Second vertex.
p3Third vertex.
depthValueDepth of the triangle.

Definition at line 628 of file Board.cpp.

632{
633 int d = (depthValue != -1) ? depthValue : _nextDepth--;
634 std::vector<Point> points;
635 points.push_back( Point( _state.unit(p1.x), _state.unit(p1.y) ) );
636 points.push_back( Point( _state.unit(p2.x), _state.unit(p2.y) ) );
637 points.push_back( Point( _state.unit(p3.x), _state.unit(p3.y) ) );
638 _shapes.push_back( new Polyline( points, true, DGtal::Color::None, _state.penColor,
639 0.0f,
643 d ) );
644}

References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::lineCap, LibBoard::Board::State::lineJoin, LibBoard::Board::State::lineStyle, DGtal::Color::None, LibBoard::Board::State::penColor, LibBoard::Board::State::unit(), LibBoard::Point::x, and LibBoard::Point::y.

◆ fillTriangle() [2/2]

void LibBoard::Board::fillTriangle ( double  x1,
double  y1,
double  x2,
double  y2,
double  x3,
double  y3,
int  depthValue = -1 
)

Draws a filled triangle.

Parameters
x1First coordinate of the first vertex.
y1Second coordinate of the first vertex.
x2First coordinate of the second vertex.
y2Second coordinate of the second vertex.
x3First coordinate of the third vertex.
y3Second coordinate of the third vertex.
depthValueDepth of the triangle.

Definition at line 609 of file Board.cpp.

613{
614 int d = (depthValue != -1) ? depthValue : _nextDepth--;
615 std::vector<Point> points;
616 points.push_back( Point( _state.unit(x1), _state.unit(y1) ) );
617 points.push_back( Point( _state.unit(x2), _state.unit(y2) ) );
618 points.push_back( Point( _state.unit(x3), _state.unit(y3) ) );
619 _shapes.push_back( new Polyline( points, true, DGtal::Color::None, _state.penColor,
620 0.0f,
624 d ) );
625}

References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::lineCap, LibBoard::Board::State::lineJoin, LibBoard::Board::State::lineStyle, DGtal::Color::None, LibBoard::Board::State::penColor, and LibBoard::Board::State::unit().

◆ operator<<() [1/2]

Board & LibBoard::Board::operator<< ( const Shape shape)

Add a shape to the board, using the current unit factor.

Parameters
shapeA shape. (Might be a list of shapes, actually!)
Returns
The board itself, as a ShapeList.

Definition at line 132 of file Board.cpp.

134{
136 return *this;
137}
void addShape(const Shape &shape, double scaleFactor)
Definition: ShapeList.cpp:122

References _state, LibBoard::ShapeList::addShape(), and LibBoard::Board::State::unitFactor.

◆ operator<<() [2/2]

Board & LibBoard::Board::operator<< ( Unit  unit)

Overloaded operator to set the current unit.

Parameters
unitThe unit to be used in next drawing functions and shape insertions.
Returns
The board itself, as a ShapeList.

Definition at line 139 of file Board.cpp.

141{
142 setUnit( unit );
143 return *this;
144}
void setUnit(Unit unit)
Definition: Board.cpp:240

References setUnit().

◆ operator=()

Board & LibBoard::Board::operator= ( const Board other)

The operator =

Parameters
otherThe object to be copied.
Returns
A reference to the left operand.

Definition at line 117 of file Board.cpp.

118{
119 free();
120 if ( ! other._shapes.size() ) return (*this);
121 _shapes.resize( other._shapes.size(), 0 );
122 std::vector<Shape*>::iterator t = _shapes.begin();
123 std::vector<Shape*>::const_iterator i = other._shapes.begin();
124 std::vector<Shape*>::const_iterator end = other._shapes.end();
125 while ( i != end ) {
126 *t = (*i)->clone();
127 ++i; ++t;
128 }
129 return *this;
130}

References LibBoard::ShapeList::_shapes, and LibBoard::ShapeList::free().

Referenced by DGtal::Board2D::operator=().

◆ rotate() [1/2]

Shape & LibBoard::Board::rotate ( double  angle)
virtual

Rotate the shape around its center.

Parameters
angleThe rotation angle in radian.
Returns
A reference to the shape itself.

Implements LibBoard::Shape.

Definition at line 168 of file Board.cpp.

169{
170 ShapeList::rotate( angle );
171 _clippingPath.rotate( angle, center() );
172 return (*this);
173}
Path _clippingPath
Definition: Board.h:957
Path & rotate(double angle, const Point &center)
Definition: Path.cpp:43
Shape & rotate(double angle, const Point &center)
Definition: ShapeList.cpp:205
Point center() const
Definition: ShapeList.cpp:192

References _clippingPath, LibBoard::ShapeList::center(), LibBoard::Path::rotate(), and LibBoard::ShapeList::rotate().

◆ rotate() [2/2]

Shape & LibBoard::Board::rotate ( double  angle,
const Point center 
)
virtual

Rotate the shape around a given center of rotation.

Parameters
angleThe rotation angle in radian.
centerThe center of rotation.
Returns
A reference to the shape itself.

Implements LibBoard::Shape.

Definition at line 160 of file Board.cpp.

161{
162 ShapeList::rotate( angle, aCenter );
163 _clippingPath.rotate( angle, aCenter );
164 return (*this);
165}

References _clippingPath, LibBoard::Path::rotate(), and LibBoard::ShapeList::rotate().

Referenced by clear(), and rotated().

◆ rotated() [1/2]

Board LibBoard::Board::rotated ( double  angle)

Definition at line 215 of file Board.cpp.

216{
217 return static_cast<const Board &>( Board( *this ).rotate( angle ) );
218}
Board(const DGtal::Color &backgroundColor=DGtal::Color::None)
Definition: Board.cpp:104

References rotate().

◆ rotated() [2/2]

Board LibBoard::Board::rotated ( double  angle,
const Point center 
)

Definition at line 209 of file Board.cpp.

210{
211 return static_cast<const Board &>( Board( *this ).rotate( angle, aCenter ) );
212}

References rotate().

◆ save() [1/2]

void LibBoard::Board::save ( const char *  filename,
double  pageWidth,
double  pageHeight,
double  margin = 10.0 
) const

Save the drawing in an EPS, XFIG or SVG file depending on the filename extension. When a size is given (not BoundingBox), the drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.

Parameters
filenamePath of the file to be created.
pageWidthWidth of the page in millimeters.
pageHeightHeight of the page in millimeters.
marginMinimal margin around the figure in the page, in millimeters.

Definition at line 1108 of file Board.cpp.

1109{
1110 const char * extension = filename + strlen( filename );
1111 while ( extension > filename && *extension != '.' )
1112 --extension;
1113 if ( !(strcmp( extension, ".eps" )) || !(strcmp( extension, ".EPS" )) ) {
1114 saveEPS( filename, pageWidth, pageHeight, margin );
1115 return;
1116 }
1117 if ( !(strcmp( extension, ".fig" )) || !(strcmp( extension, ".FIG" )) ) {
1118 saveFIG( filename, pageWidth, pageHeight, margin );
1119 return;
1120 }
1121 if ( !(strcmp( extension, ".svg" )) || !(strcmp( extension, ".SVG" )) ) {
1122 saveSVG( filename, pageWidth, pageHeight, margin );
1123 return;
1124 }
1125 if ( !(strcmp( extension, ".tikz" )) || !(strcmp( extension, ".TIKZ" )) ) {
1126 saveTikZ( filename, pageWidth, pageHeight, margin );
1127 return;
1128 }
1129}
void saveTikZ(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
Definition: Board.cpp:1219
void saveFIG(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0, bool includeFIGHeader=true) const
Definition: Board.cpp:907
void saveEPS(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
Definition: Board.cpp:805
void saveSVG(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
Definition: Board.cpp:1012

References saveEPS(), saveFIG(), saveSVG(), and saveTikZ().

◆ save() [2/2]

void LibBoard::Board::save ( const char *  filename,
PageSize  size = Board::BoundingBox,
double  margin = 10.0 
) const

Save the drawing in an EPS, XFIG or SVG file depending on the filename extension. When a size is given (not BoundingBox), the drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.

Parameters
filenamePath of the file to be created.
sizePage size (Either BoundingBox (default), A4 or Letter).
marginMinimal margin around the figure in the page, in millimeters.

Definition at line 1132 of file Board.cpp.

1133{
1134 save( filename, pageSizes[size][0], pageSizes[size][1], margin );
1135}
void save(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
Definition: Board.cpp:1132

References save().

Referenced by save().

◆ saveCairo() [1/2]

void LibBoard::Board::saveCairo ( const char *  filename,
CairoType  type,
double  pageWidth,
double  pageHeight,
double  margin = 10.0 
) const

Save the drawing with cairo. When a size is given (not BoundingBox), the drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.

Parameters
filenameThe name of the file.
typeOutput type: CairoPDF, CairoPNG, CairoPS, CairoSVG.
pageWidthWidth of the page in millimeters.
pageHeightHeight of the page in millimeters.
marginMinimal margin around the figure in the page, in millimeters.

Definition at line 1144 of file Board.cpp.

1145{
1146 cairo_surface_t *surface;
1147 cairo_t *cr;
1148
1149 double cairoWidth, cairoHeight;
1150
1151 TransformCairo transform;
1152 Rect box = boundingBox();
1153
1154 bool clipping = _clippingPath.size() > 2;
1155 if ( clipping )
1156 box = box && _clippingPath.boundingBox();
1157 transform.setBoundingBox( box, pageWidth, pageHeight, margin );
1158
1159 if ( pageWidth > 0 && pageHeight > 0 )
1160 {
1161 cairoWidth = pageWidth;
1162 cairoHeight = pageHeight;
1163 }
1164 else
1165 {
1166 cairoWidth = box.width;
1167 cairoHeight = box.height;
1168 }
1169
1170 switch (type)
1171 {
1172 case CairoPDF:
1173 surface = cairo_pdf_surface_create (filename, cairoWidth, cairoHeight); break;
1174 case CairoPS:
1175 surface = cairo_ps_surface_create (filename, cairoWidth, cairoHeight); break;
1176 case CairoEPS:
1177 surface = cairo_ps_surface_create (filename, cairoWidth, cairoHeight);
1178 cairo_ps_surface_set_eps(surface, true); break;
1179 case CairoSVG:
1180 surface = cairo_svg_surface_create (filename, cairoWidth, cairoHeight); break;
1181 case CairoPNG:
1182 default:
1183 surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, (int)cairoWidth, (int)cairoHeight);
1184 }
1185
1186 cr = cairo_create (surface);
1187
1188 /* For 1.0 x 1.0 coordinate space */
1189 //cairo_scale (cr, cairoWidth, cairoHeight);
1190
1191 //temp: http://zetcode.com/tutorials/cairographicstutorial/basicdrawing/
1192 //temp: http://www.graphviz.org/pub/scm/graphviz-cairo/plugin/cairo/gvrender_cairo.c
1193
1194 // Draw the background color if needed.
1196 Rectangle r( box, DGtal::Color::None, _backgroundColor, 0.0 );
1197 r.flushCairo( cr, transform );
1198 }
1199
1200 // Draw the shapes.
1201 std::vector< Shape* > shapes = _shapes;
1202 stable_sort( shapes.begin(), shapes.end(), shapeGreaterDepth );
1203 std::vector< Shape* >::const_iterator i = shapes.begin();
1204 std::vector< Shape* >::const_iterator end = shapes.end();
1205 while ( i != end ) {
1206 (*i)->flushCairo( cr, transform );
1207 ++i;
1208 }
1209
1210 if (type==CairoPNG)
1211 cairo_surface_write_to_png (surface, filename);
1212
1213 cairo_destroy (cr);
1214 cairo_surface_destroy (surface);
1215}
bool shapeGreaterDepth(const Shape *s1, const Shape *s2)
Definition: Shapes.cpp:95
unsigned int size() const
Definition: Path.h:249
Rect boundingBox() const
Definition: Path.cpp:272
double width
Definition: Rect.h:30

References _backgroundColor, _clippingPath, LibBoard::ShapeList::_shapes, LibBoard::Path::boundingBox(), LibBoard::ShapeList::boundingBox(), CairoEPS, CairoPDF, CairoPNG, CairoPS, CairoSVG, LibBoard::Rect::height, DGtal::Color::None, LibBoard::shapeGreaterDepth(), LibBoard::Path::size(), and LibBoard::Rect::width.

◆ saveCairo() [2/2]

void LibBoard::Board::saveCairo ( const char *  filename,
CairoType  type = CairoPNG,
PageSize  size = Board::BoundingBox,
double  margin = 10.0 
) const

Save the drawing with cairo. When a size is given (not BoundingBox), the drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.

Parameters
filenameThe name of the file.
typeOutput type: CairoPDF, CairoPNG, CairoPS, CairoSVG.
sizethe page size.
marginMinimal margin around the figure in the page, in millimeters.
Examples
geometry/curves/convex-and-concave-parts.cpp, geometry/curves/exampleArithmeticalDSL.cpp, geometry/curves/exampleArithmeticalDSS.cpp, geometry/curves/exampleFrechetShortcut.cpp, geometry/curves/greedy-dss-decomposition.cpp, geometry/tools/exampleAlphaShape.cpp, geometry/tools/exampleConvexHull2D.cpp, geometry/tools/examplePreimage.cpp, images/exampleTiledImage.cpp, io/boards/dgtalBoard2D-1-points.cpp, io/boards/dgtalBoard2D-2-sets.cpp, io/boards/dgtalBoard2D-3-custom-classes.cpp, io/boards/dgtalBoard2D-3-custom-points.cpp, io/boards/dgtalBoard2D-4-colormaps.cpp, and io/boards/exampleBezierCurve.cpp.

Definition at line 1139 of file Board.cpp.

1140{
1141 saveCairo( filename, type, pageSizes[size][0], pageSizes[size][1], margin );
1142}
void saveCairo(const char *filename, CairoType type=CairoPNG, PageSize size=Board::BoundingBox, double margin=10.0) const
Definition: Board.cpp:1139

References saveCairo().

Referenced by alphaShape(), convexHull(), drawArithmeticalDSL(), exampleNaiveDSL(), exampleNaiveDSS(), exampleStandardDSL(), exampleStandardDSS(), exampleUpdate(), main(), saveCairo(), testDisplay(), testExactMetricBalls(), testImageAdapter(), and testInexactMetricBalls().

◆ saveEPS() [1/4]

void LibBoard::Board::saveEPS ( const char *  filename,
double  pageWidth,
double  pageHeight,
double  margin = 10.0 
) const

Saves the drawing in an EPS file. When a size is given (not BoundingBox), the drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.

Parameters
filenameThe EPS file name.
pageWidthWidth of the page in millimeters.
pageHeightHeight of the page in millimeters.
marginMinimal margin around the figure in the page, in millimeters.

Definition at line 812 of file Board.cpp.

813{
814 std::ofstream file( filename );
815 saveEPS(file, pageWidth, pageHeight, margin);
816 file.close();
817}

References saveEPS().

◆ saveEPS() [2/4]

void LibBoard::Board::saveEPS ( const char *  filename,
PageSize  size = Board::BoundingBox,
double  margin = 10.0 
) const

Saves the drawing in an EPS file. When a size is given (not BoundingBox), the drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.

Parameters
filenameThe EPS file name.
sizePage size (Either BoundingBox (default), A4 or Letter).
marginMinimal margin around the figure in the page, in millimeters.
Examples
arithmetic/lower-integer-convex-hull.cpp, doc-examples/demo-kernel-1.cpp, geometry/curves/exampleAlphaThickSegment.cpp, geometry/curves/exampleAlphaThickSegmentNoisy.cpp, geometry/curves/exampleAlphaThickSegmentTgtCover.cpp, geometry/curves/exampleDigitalConvexity.cpp, geometry/curves/exampleFrechetShortcut.cpp, geometry/curves/exampleGridCurve2d.cpp, geometry/curves/exampleRationalConvexity.cpp, geometry/curves/greedy-dss-decomposition.cpp, geometry/curves/greedyAlphaThickDecomposition.cpp, geometry/tools/examplePreimage.cpp, geometry/volumes/fullConvexityCollapsiblePoints2D.cpp, geometry/volumes/fullConvexityLUT2D.cpp, graph/graphTraversal.cpp, io/boards/dgtalBoard2D-1-points.cpp, io/boards/dgtalBoard2D-2-sets.cpp, io/boards/dgtalBoard2D-3-custom-classes.cpp, io/boards/dgtalBoard2D-3-custom-points.cpp, io/boards/dgtalBoard2D-4-colormaps.cpp, io/boards/exampleBezierCurve.cpp, topology/ctopo-1.cpp, topology/ctopo-2.cpp, topology/ctopo-fillContours.cpp, topology/digitalSetToCubicalComplexes2D.cpp, topology/generateSimplicityTables2D.cpp, and tutorial-examples/freemanChainFromImage.cpp.

Definition at line 805 of file Board.cpp.

806{
807 saveEPS( filename, pageSizes[size][0], pageSizes[size][1], margin );
808}

References saveEPS().

Referenced by checkCut(), checkOutputConvexHullBorder(), drawingTestStabbingCircleComputer(), drawingTestStabbingLineComputer(), greedySegmentationVisualTest(), main(), SaturatedSegmentationVisualTest(), save(), saveEPS(), specificTestLatticePolytope2D(), testAlphaThickSegmentComputerFloatingPointContour(), testAlphaThickSegmentConvexHullAndBox(), testAlphaThickSegmentFreeman(), testAlphaThickSpecialInit(), testAngleLinearMinimizer(), testBreadthFirstPropagation(), testCellDrawOnBoard(), testCMAP(), testComputeInterior(), testConvexHullCompThickness(), testDepthFirstPropagation(), testDigitization(), testDisplay(), testDistancePropagation(), testLatticePolytope2D(), testMultiWidth(), testPNMReader(), testSegmentation(), testSurfelAdjacency(), and testThicknessDefinitions().

◆ saveEPS() [3/4]

void LibBoard::Board::saveEPS ( std::ostream &  out,
double  pageWidth,
double  pageHeight,
double  margin = 10.0 
) const

Saves the drawing in an EPS format through an output stream. When a size is given (not BoundingBox), the drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.

Parameters
outThe output stream.
pageWidthWidth of the page in millimeters.
pageHeightHeight of the page in millimeters.
marginMinimal margin around the figure in the page, in millimeters.

Definition at line 820 of file Board.cpp.

821{
822 Rect box = boundingBox();
823 bool clipping = _clippingPath.size() > 2;
824 if ( clipping )
825 box = box && _clippingPath.boundingBox();
826
827 TransformEPS transform;
828 transform.setBoundingBox( box, pageWidth, pageHeight, margin );
829
830 out << "%!PS-Adobe-2.0 EPSF-2.0" << std::endl;
831 out << "%%Title: output.eps " << std::endl;
832 out << "%%Creator: Board library (Copyleft)2007 Sebastien Fourey" << std::endl;
833 {
834 time_t t = time(0);
835 char str_time[255];
836 secured_ctime( str_time, &t, 255 );
837 out << "%%CreationDate: " << str_time;
838 }
839 out << "%%BoundingBox: " << std::setprecision( 8 )
840 << transform.mapX( box.left ) << " "
841 << transform.mapY( box.top - box.height ) << " "
842 << transform.mapX( box.left + box.width ) << " "
843 << transform.mapY( box.top ) << std::endl;
844
845 out << "%Magnification: 1.0000" << std::endl;
846 out << "%%EndComments" << std::endl;
847
848 out << std::endl;
849 out << "/cp {closepath} bind def" << std::endl;
850 out << "/ef {eofill} bind def" << std::endl;
851 out << "/gr {grestore} bind def" << std::endl;
852 out << "/gs {gsave} bind def" << std::endl;
853 out << "/sa {save} bind def" << std::endl;
854 out << "/rs {restore} bind def" << std::endl;
855 out << "/l {lineto} bind def" << std::endl;
856 out << "/m {moveto} bind def" << std::endl;
857 out << "/rm {rmoveto} bind def" << std::endl;
858 out << "/n {newpath} bind def" << std::endl;
859 out << "/s {stroke} bind def" << std::endl;
860 out << "/sh {show} bind def" << std::endl;
861 out << "/slc {setlinecap} bind def" << std::endl;
862 out << "/slj {setlinejoin} bind def" << std::endl;
863 out << "/slw {setlinewidth} bind def" << std::endl;
864 out << "/srgb {setrgbcolor} bind def" << std::endl;
865 out << "/rot {rotate} bind def" << std::endl;
866 out << "/sc {scale} bind def" << std::endl;
867 out << "/sd {setdash} bind def" << std::endl;
868 out << "/ff {findfont} bind def" << std::endl;
869 out << "/sf {setfont} bind def" << std::endl;
870 out << "/scf {scalefont} bind def" << std::endl;
871 out << "/sw {stringwidth} bind def" << std::endl;
872 out << "/sd {setdash} bind def" << std::endl;
873 out << "/tr {translate} bind def" << std::endl;
874 out << " 0.5 setlinewidth" << std::endl;
875
876 if ( clipping ) {
877 out << " newpath ";
878 _clippingPath.flushPostscript( out, transform );
879 out << " 0 slw clip " << std::endl;
880 }
881
882 // Draw the background color if needed.
884 Rectangle r( box, DGtal::Color::None, _backgroundColor, 0.0f );
885 r.flushPostscript( out, transform );
886 }
887
888 // Draw the shapes
889 std::vector< Shape* > shapes = _shapes;
890
891 stable_sort( shapes.begin(), shapes.end(), shapeGreaterDepth );
892 std::vector< Shape* >::const_iterator i = shapes.begin();
893 std::vector< Shape* >::const_iterator end = shapes.end();
894
895 while ( i != end ) {
896 (*i)->flushPostscript( out, transform );
897 ++i;
898 }
899 out << "showpage" << std::endl;
900 out << "%%Trailer" << std::endl;
901 out << "%EOF" << std::endl;
902}
void secured_ctime(char *str, const time_t *t, size_t count)
void flushPostscript(std::ostream &stream, const TransformEPS &transform) const
Definition: Path.cpp:154

References _backgroundColor, _clippingPath, LibBoard::ShapeList::_shapes, LibBoard::Path::boundingBox(), LibBoard::ShapeList::boundingBox(), LibBoard::Path::flushPostscript(), LibBoard::Rect::height, LibBoard::Rect::left, DGtal::Color::None, LibBoard::secured_ctime(), LibBoard::TransformEPS::setBoundingBox(), LibBoard::shapeGreaterDepth(), LibBoard::Path::size(), LibBoard::Rect::top, and LibBoard::Rect::width.

◆ saveEPS() [4/4]

void LibBoard::Board::saveEPS ( std::ostream &  out,
PageSize  size = Board::BoundingBox,
double  margin = 10.0 
) const

Saves the drawing in EPS format through an output stream. When a size is given (not BoundingBox), the drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.

Parameters
outThe output stream.
sizePage size (Either BoundingBox (default), A4 or Letter).
marginMinimal margin around the figure in the page, in millimeters.

Definition at line 799 of file Board.cpp.

800{
801 saveEPS( out, pageSizes[size][0], pageSizes[size][1], margin );
802}

References saveEPS().

◆ saveFIG() [1/4]

void LibBoard::Board::saveFIG ( const char *  filename,
double  pageWidth,
double  pageHeight,
double  margin = 10.0,
bool  includeFIGHeader = true 
) const

Saves the drawing in an XFig file. When a size is given (not BoundingBox), the drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.

Parameters
filenameThe XFig file name.
pageWidthWidth of the page in millimeters.
pageHeightHeight of the page in millimeters.
marginMinimal margin around the figure in the page, in millimeters.
includeFIGHeaderIndicates if the header is included in the output stream. Useful to merge several XFIG figures (default true)

Definition at line 917 of file Board.cpp.

919{
920 std::ofstream file( filename );
921 saveFIG( file, pageWidth, pageHeight, margin, includeFIGHeader);
922 file.close();
923}

References saveFIG().

◆ saveFIG() [2/4]

void LibBoard::Board::saveFIG ( const char *  filename,
PageSize  size = Board::BoundingBox,
double  margin = 10.0,
bool  includeFIGHeader = true 
) const

Saves the drawing in an XFig file. When a size is given (not BoundingBox), the drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.

Parameters
filenameThe name of the FIG file.
sizePage size (Either BoundingBox (default), A4 or Letter).
marginMinimal margin around the figure in the page, in millimeters.
includeFIGHeaderIndicates if the header is included in the exported file. Useful to merge several XFIG figures (default true)
Examples
io/boards/exampleBezierCurve.cpp, topology/ctopo-2.cpp, topology/ctopo-fillContours.cpp, and topology/khalimskySpaceScanner.cpp.

Definition at line 907 of file Board.cpp.

908{
909 saveFIG( filename, pageSizes[size][0], pageSizes[size][1], margin, includeFIGHeader );
910}

References saveFIG().

Referenced by main(), save(), saveFIG(), and testDisplay().

◆ saveFIG() [3/4]

void LibBoard::Board::saveFIG ( std::ostream &  out,
double  pageWidth,
double  pageHeight,
double  margin = 10.0,
bool  includeFIGHeader = true 
) const

Saves the drawing in an XFig format through an output stream. When a size is given (not BoundingBox), the drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.

Parameters
outout The output stream.
pageWidthWidth of the page in millimeters.
pageHeightHeight of the page in millimeters.
marginMinimal margin around the figure in the page, in millimeters.
includeFIGHeaderIndicates if the header is included in the output stream. Useful to merge several XFIG figures (default true)

Definition at line 926 of file Board.cpp.

927{
928
929
930 TransformFIG transform;
931 Rect box = boundingBox();
932 transform.setBoundingBox( box, pageWidth, pageHeight, margin );
933 transform.setDepthRange( *this );
934 if(includeFIGHeader){
935 file << "#FIG 3.2 Produced by the Board library (Copyleft)2007 Sebastien Fourey\n";
936 file << "Portrait\n";
937 file << "Center\n";
938 file << "Metric\n";
939 file << "A4\n";
940 file << "100.00\n";
941 file << "Single\n";
942 file << "-2\n";
943 file << "1200 2\n";
944 }else{
945 file << "\n";
946 }
947 std::map<DGtal::Color,int> colormap;
948 int maxColor = 32;
949
950
951 colormap[DGtal::Color(0,0,0)] = 0;
952 colormap[DGtal::Color(0,0,255)] = 1;
953 colormap[DGtal::Color(0,255,0)] = 2;
954 colormap[DGtal::Color(0,255,255)] = 0;
955 colormap[DGtal::Color(255,0,0)] = 4;
956 colormap[DGtal::Color(255,0,255)] = 0;
957 colormap[DGtal::Color(255,255,0)] = 6;
958 colormap[DGtal::Color(255,255,255)] = 7;
959
960
961 std::vector< Shape* > shapes = _shapes;
962 stable_sort( shapes.begin(), shapes.end(), shapeGreaterDepth );
963 std::vector< Shape* >::const_iterator i = shapes.begin();
964 std::vector< Shape* >::const_iterator end = shapes.end();
965 while ( i != end ) {
966 if ( colormap.find( (*i)->penColor() ) == colormap.end()
967 && (*i)->penColor().valid() )
968 colormap[ (*i)->penColor() ] = maxColor++;
969 if ( colormap.find( (*i)->fillColor() ) == colormap.end()
970 && (*i)->fillColor().valid() )
971 colormap[ (*i)->fillColor() ] = maxColor++;
972 ++i;
973 }
974
975 if ( colormap.find( _backgroundColor ) == colormap.end()
977 colormap[ _backgroundColor ] = maxColor++;
978
979 // Write the colormap
980 std::map<DGtal::Color,int>::const_iterator iColormap = colormap.begin();
981 std::map<DGtal::Color,int>::const_iterator endColormap = colormap.end();
982 char colorString[255];
983 while ( iColormap != endColormap ) {
984 secured_sprintf( colorString, 255,
985 "0 %d #%02x%02x%02x\n",
986 iColormap->second,
987 iColormap->first.red(),
988 iColormap->first.green(),
989 iColormap->first.blue() );
990 if ( iColormap->second >= 32 ) file << colorString;
991 ++iColormap;
992 }
993
994 // Draw the background color if needed.
996 Rectangle r( box, DGtal::Color::None, _backgroundColor, 0.0f );
997 r.depth( std::numeric_limits<int>::max() );
998 r.flushFIG( file, transform, colormap );
999 }
1000
1001 // Draw the shapes.
1002 i = shapes.begin();
1003 while ( i != end ) {
1004 // notice << (*i)->name() << " " << (*i)->depth() << '\n';
1005 (*i)->flushFIG( file, transform, colormap );
1006 ++i;
1007 }
1008}
bool valid() const

References _backgroundColor, LibBoard::ShapeList::_shapes, LibBoard::ShapeList::boundingBox(), DGtal::Color::None, LibBoard::shapeGreaterDepth(), and DGtal::Color::valid().

◆ saveFIG() [4/4]

void LibBoard::Board::saveFIG ( std::ostream &  out,
PageSize  size = Board::BoundingBox,
double  margin = 10.0,
bool  includeFIGHeader = true 
) const

Saves the drawing in XFig format through an output stream. When a size is given (not BoundingBox), the drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.

Parameters
outThe output stream.
sizePage size (Either BoundingBox (default), A4 or Letter).
marginMinimal margin around the figure in the page, in millimeters.
includeFIGHeaderIndicates if the header is included in the output stream. Useful to merge several XFIG figures (default true)

Definition at line 912 of file Board.cpp.

913{
914 saveFIG( out, pageSizes[size][0], pageSizes[size][1], margin, includeFIGHeader );
915}

References saveFIG().

◆ saveSVG() [1/4]

void LibBoard::Board::saveSVG ( const char *  filename,
double  pageWidth,
double  pageHeight,
double  margin = 10.0 
) const

Saves the drawing in an SVG file. When a size is given (not BoundingBox), the drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.

Parameters
filenameThe SVG file name.
pageWidthWidth of the page in millimeters.
pageHeightHeight of the page in millimeters.
marginMinimal margin around the figure in the page, in millimeters.

Definition at line 1025 of file Board.cpp.

1026{
1027 std::ofstream file( filename );
1028 saveSVG(file, pageWidth, pageHeight, margin);
1029 file.close();
1030}

References saveSVG().

◆ saveSVG() [2/4]

void LibBoard::Board::saveSVG ( const char *  filename,
PageSize  size = Board::BoundingBox,
double  margin = 10.0 
) const

Save the drawing in an SVG file. When a size is given (not BoundingBox), the drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.

Parameters
filenameThe name of the file.
sizePage size (Either BoundingBox (default), A4 or Letter).
marginMinimal margin around the figure in the page, in millimeters.
Examples
dec/exampleDiscreteExteriorCalculusChladni.cpp, dec/exampleDiscreteExteriorCalculusSolve.cpp, dec/exampleDiscreteExteriorCalculusUsage.cpp, dec/examplePropagation.cpp, doc-examples/demo-kernel-1.cpp, doc-examples/kernelDomain.cpp, geometry/curves/convex-and-concave-parts.cpp, geometry/curves/exampleArithmeticalDSL.cpp, geometry/curves/exampleArithmeticalDSS.cpp, geometry/curves/greedy-dss-decomposition.cpp, geometry/surfaces/dvcm-2d-curvature.cpp, geometry/tools/exampleAlphaShape.cpp, geometry/tools/exampleConvexHull2D.cpp, geometry/tools/examplePreimage.cpp, geometry/volumes/distance/distancetransform2D.cpp, geometry/volumes/distance/toricdomainvolumetric.cpp, geometry/volumes/distance/voronoimap2D.cpp, geometry/volumes/dvcm-2d.cpp, images/exampleConstImageAdapter.cpp, images/exampleTiledImage.cpp, io/boards/dgtalBoard2D-1-points.cpp, io/boards/dgtalBoard2D-2-sets.cpp, io/boards/dgtalBoard2D-3-custom-classes.cpp, io/boards/dgtalBoard2D-3-custom-points.cpp, io/boards/dgtalBoard2D-4-colormaps.cpp, io/boards/exampleBezierCurve.cpp, io/boards/logoDGtal.cpp, shapes/exampleEuclideanShapesDecorator.cpp, topology/ctopo-1.cpp, and topology/khalimskySpaceScanner.cpp.

Definition at line 1012 of file Board.cpp.

1013{
1014 saveSVG( filename, pageSizes[size][0], pageSizes[size][1], margin );
1015}

References saveSVG().

Referenced by alphaShape(), convexHull(), exampleNaiveDSL(), exampleNaiveDSS(), exampleStandardDSL(), exampleStandardDSS(), exampleUpdate(), main(), moduleImages_example(), save(), saveSVG(), saveVoroMap(), showGreedySegmantation(), test_linear_ring(), test_linear_structure(), test_manual_operators_2d(), testBIGINTEGERSpace(), testBoard2D(), testBoard2DCustomStyle(), testCellDrawOnBoard(), testChessboard(), testDigitalSetBoardSnippet(), testDigitalSetDraw(), testDigitization(), testDisplay(), testDistanceTransformation(), testDistanceTransformationBorder(), testDistanceTransformationNeg(), testDraw(), testDSS4drawing(), testDSS8drawing(), testDTFromSet(), testGetSetVal(), testImageAdapter(), testImplicitShape(), testKanungo2D(), testLatticePolytope2D(), testLayers(), testObjectBorder(), testPNMWriter(), testSegmentation(), testSimpleExpander(), testSimplePoints2D(), testSurfelAdjacency(), and testVoronoiMap().

◆ saveSVG() [3/4]

void LibBoard::Board::saveSVG ( std::ostream &  out,
double  pageWidth,
double  pageHeight,
double  margin = 10.0,
std::string  filename = "output.svg" 
) const

Saves the drawing in an SVG format through an output stream. When a size is given (not BoundingBox), the drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.

Parameters
outThe output stream.
pageWidthWidth of the page in millimeters.
pageHeightHeight of the page in millimeters.
marginMinimal margin around the figure in the page, in millimeters.
filenamedefault filename

Definition at line 1035 of file Board.cpp.

1036{
1037
1038 TransformSVG transform;
1039 Rect box = boundingBox();
1040 bool clipping = _clippingPath.size() > 2;
1041 if ( clipping )
1042 box = box && _clippingPath.boundingBox();
1043 transform.setBoundingBox( box, pageWidth, pageHeight, margin );
1044
1045 file << "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" standalone=\"no\"?>" << std::endl;
1046 file << "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"" << std::endl;
1047 file << " \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">" << std::endl;
1048
1049 if ( pageWidth > 0 && pageHeight > 0 ) {
1050 file << "<svg width=\""
1051 << pageWidth << "mm\" height=\""
1052 << pageHeight << "mm\" " << std::endl;
1053 file << " viewBox=\"0 0 "
1054 << pageWidth * ppmm << " "
1055 << pageHeight * ppmm << "\" " << std::endl;
1056 file << " xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" >" << std::endl;
1057 } else {
1058 file << "<svg width=\""
1059 << ( box.width / ppmm ) << "mm"
1060 << "\" height=\""
1061 << ( box.height / ppmm ) << "mm"
1062 << "\" " << std::endl;
1063 file << " viewBox=\"0 0 "
1064 << box.width << " "
1065 << box.height << "\" " << std::endl;
1066 file << " xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" >" << std::endl;
1067
1068 }
1069
1070 file << "<desc>" << filename
1071 << ", created with the Board library (Copyleft) 2007 Sebastien Fourey"
1072 << "</desc>" << std::endl;
1073
1074 if ( clipping ) {
1075 file << "<g clip-rule=\"nonzero\">\n"
1076 << " <clipPath id=\"GlobalClipPath\">\n"
1077 << " <path clip-rule=\"evenodd\" d=\"";
1078 _clippingPath.flushSVGCommands( file, transform );
1079 file << "\" />\n";
1080 file << " </clipPath>\n";
1081 file << "<g clip-path=\"url(#GlobalClipPath)\">\n";
1082 }
1083
1084 // Draw the background color if needed.
1086 Rectangle r( box, DGtal::Color::None, _backgroundColor, 0.0 );
1087 r.flushSVG( file, transform );
1088 }
1089
1090 // Draw the shapes.
1091 std::vector< Shape* > shapes = _shapes;
1092 stable_sort( shapes.begin(), shapes.end(), shapeGreaterDepth );
1093 std::vector< Shape* >::const_iterator i = shapes.begin();
1094 std::vector< Shape* >::const_iterator end = shapes.end();
1095 while ( i != end ) {
1096 (*i)->flushSVG( file, transform );
1097 ++i;
1098 }
1099
1100 if ( clipping )
1101 file << "</g>\n</g>";
1102 file << "</svg>" << std::endl;
1103
1104}
void flushSVGCommands(std::ostream &stream, const TransformSVG &transform) const
Definition: Path.cpp:193

References _backgroundColor, _clippingPath, LibBoard::ShapeList::_shapes, LibBoard::Path::boundingBox(), LibBoard::ShapeList::boundingBox(), LibBoard::Path::flushSVGCommands(), LibBoard::Rect::height, DGtal::Color::None, LibBoard::shapeGreaterDepth(), LibBoard::Path::size(), and LibBoard::Rect::width.

◆ saveSVG() [4/4]

void LibBoard::Board::saveSVG ( std::ostream &  out,
PageSize  size = Board::BoundingBox,
double  margin = 10.0 
) const

Save the drawing in an SVG format through an output stream. When a size is given (not BoundingBox), the drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.

Parameters
outThe output stream.
sizePage size (Either BoundingBox (default), A4 or Letter).
marginMinimal margin around the figure in the page, in millimeters.

Definition at line 1018 of file Board.cpp.

1019{
1020 saveSVG( out, pageSizes[size][0], pageSizes[size][1], margin );
1021}

References saveSVG().

◆ saveTikZ() [1/4]

void LibBoard::Board::saveTikZ ( const char *  filename,
double  pageWidth,
double  pageHeight,
double  margin = 10.0 
) const

Save the drawing in an TikZ file. When a size is given (not BoundingBox), the drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.

Parameters
filenameThe name of the file.
pageWidthWidth of the page in millimeters.
pageHeightHeight of the page in millimeters.
marginMinimal margin around the figure in the page, in millimeters.

Definition at line 1231 of file Board.cpp.

1232{
1233 std::ofstream file( filename );
1234 saveTikZ(file, pageHeight, pageHeight, margin);
1235 file.close();
1236}

References saveTikZ().

◆ saveTikZ() [2/4]

void LibBoard::Board::saveTikZ ( const char *  filename,
PageSize  size = Board::BoundingBox,
double  margin = 10.0 
) const

Save the drawing in an TikZ file. When a size is given (not BoundingBox), the drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.

Parameters
filenameThe name of the file.
sizePage size (Either BoundingBox (default), A4 or Letter).
marginMinimal margin around the figure in the page, in millimeters.
Examples
io/boards/dgtalBoard2D-1-points.cpp, io/boards/dgtalBoard2D-2-sets.cpp, io/boards/dgtalBoard2D-3-custom-classes.cpp, io/boards/dgtalBoard2D-3-custom-points.cpp, io/boards/dgtalBoard2D-4-colormaps.cpp, io/boards/exampleBezierCurve.cpp, and topology/cubical-complex-illustrations.cpp.

Definition at line 1219 of file Board.cpp.

1220{
1221 saveTikZ( filename, pageSizes[size][0], pageSizes[size][1], margin );
1222}

References saveTikZ().

Referenced by main(), save(), and saveTikZ().

◆ saveTikZ() [3/4]

void LibBoard::Board::saveTikZ ( std::ostream &  out,
double  pageWidth,
double  pageHeight,
double  margin = 10.0 
) const

Save the drawing in an TikZ format through an output stream. When a size is given (not BoundingBox), the drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.

Parameters
outThe output stream.
pageWidthWidth of the page in millimeters.
pageHeightHeight of the page in millimeters.
marginMinimal margin around the figure in the page, in millimeters.

Definition at line 1239 of file Board.cpp.

1240{
1241 TransformTikZ transform;
1242 Rect box = boundingBox();
1243 bool clipping = _clippingPath.size() > 2;
1244 if ( clipping )
1245 box = box && _clippingPath.boundingBox();
1246 transform.setBoundingBox( box, pageWidth, pageHeight, margin );
1247
1248 out << "\\begin{tikzpicture}[anchor=south west,text depth=0,x={(1pt,0pt)},y={(0pt,-1pt)}]" << std::endl;
1249
1250 if ( clipping ) {
1251 out << "\\clip ";
1252 _clippingPath.flushSVGCommands( out, transform );
1253 out << "\n";
1254 }
1255
1256 // Draw the background color if needed.
1258 Rectangle r( box, DGtal::Color::None, _backgroundColor, 0.0 );
1259 r.flushTikZ( out, transform );
1260 }
1261
1262 // Draw the shapes.
1263 std::vector< Shape* > shapes = _shapes;
1264 stable_sort( shapes.begin(), shapes.end(), shapeGreaterDepth );
1265 std::vector< Shape* >::const_iterator i = shapes.begin();
1266 std::vector< Shape* >::const_iterator end = shapes.end();
1267 while ( i != end ) {
1268 (*i)->flushTikZ( out, transform );
1269 ++i;
1270 }
1271
1272 //if ( clipping )
1273 // out << "</g>\n</g>";
1274 out << "\\end{tikzpicture}" << std::endl;
1275}

References _backgroundColor, _clippingPath, LibBoard::ShapeList::_shapes, LibBoard::Path::boundingBox(), LibBoard::ShapeList::boundingBox(), LibBoard::Path::flushSVGCommands(), DGtal::Color::None, LibBoard::shapeGreaterDepth(), and LibBoard::Path::size().

◆ saveTikZ() [4/4]

void LibBoard::Board::saveTikZ ( std::ostream &  out,
PageSize  size = Board::BoundingBox,
double  margin = 10.0 
) const

Save the drawing in an TikZ file format through an output stream. When a size is given (not BoundingBox), the drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.

Parameters
outThe output stream.
sizePage size (Either BoundingBox (default), A4 or Letter).
marginMinimal margin around the figure in the page, in millimeters.

Definition at line 1225 of file Board.cpp.

1226{
1227 saveTikZ( out, pageSizes[size][0], pageSizes[size][1], margin );
1228}

References saveTikZ().

◆ scale() [1/2]

Shape & LibBoard::Board::scale ( double  s)
virtual

Scale the shape along both axis.

Parameters
sThe scale factor along both axis.
Returns
The shape itself.

Implements LibBoard::Shape.

Definition at line 197 of file Board.cpp.

198{
199 Point delta = _clippingPath.center() - center();
200 delta *= s;
201 _clippingPath.scale( s );
202 ShapeList::scale( s );
203 delta = ( center() + delta ) - _clippingPath.center();
204 _clippingPath.translate( delta.x, delta.y );
205 return (*this);
206}
Path & scale(double sx, double sy)
Definition: Path.cpp:108
Point center() const
Definition: Path.cpp:36
Path & translate(double dx, double dy)
Definition: Path.cpp:81
Shape & scale(double sx, double sy)
Definition: ShapeList.cpp:254

References _clippingPath, LibBoard::Path::center(), LibBoard::ShapeList::center(), LibBoard::Path::scale(), LibBoard::ShapeList::scale(), LibBoard::Path::translate(), LibBoard::Point::x, and LibBoard::Point::y.

◆ scale() [2/2]

Shape & LibBoard::Board::scale ( double  sx,
double  sy 
)
virtual

Scale the shape along the x an y axis.

Parameters
sxThe scale factor along the x axis.
syThe scale factor along the y axis.
Returns
The shape itself.

Implements LibBoard::Shape.

Definition at line 184 of file Board.cpp.

185{
186 Point delta = _clippingPath.center() - center();
187 delta.x *= sx;
188 delta.y *= sy;
189 _clippingPath.scale( sx, sy );
190 ShapeList::scale( sx, sy );
191 delta = ( center() + delta ) - _clippingPath.center();
192 _clippingPath.translate( delta.x, delta.y );
193 return (*this);
194}

References _clippingPath, LibBoard::Path::center(), LibBoard::ShapeList::center(), LibBoard::Path::scale(), LibBoard::ShapeList::scale(), LibBoard::Path::translate(), LibBoard::Point::x, and LibBoard::Point::y.

Referenced by scaled(), and testDigitalSetDraw().

◆ scaled() [1/2]

Board LibBoard::Board::scaled ( double  s)

Definition at line 233 of file Board.cpp.

234{
235 return static_cast<const Board &>( Board( *this ).scale( s ) );
236}

References scale().

◆ scaled() [2/2]

Board LibBoard::Board::scaled ( double  sx,
double  sy 
)

Definition at line 227 of file Board.cpp.

228{
229 return static_cast<const Board &>( Board( *this ).scale( sx, sy ) );
230}

References scale().

◆ setClippingPath() [1/2]

void LibBoard::Board::setClippingPath ( const Path path)

Define a clipping path for the whole drawing.

Parameters
pathA path.

Definition at line 751 of file Board.cpp.

752{
753 _clippingPath = path;
754 _clippingPath.setClosed( true );
755 if ( _clippingPath.size() > 1 ) {
756 if ( _clippingPath[0] == _clippingPath[ _clippingPath.size() - 1 ] )
758 }
759 unsigned int n = _clippingPath.size();
760 for ( unsigned int i = 0; i < n; ++i ) {
762 }
763}
Path & pop_back()
Definition: Path.cpp:22
void setClosed(bool closed)
Definition: Path.h:255

References _clippingPath, _state, LibBoard::Path::pop_back(), LibBoard::Path::setClosed(), LibBoard::Path::size(), and LibBoard::Board::State::unit().

◆ setClippingPath() [2/2]

void LibBoard::Board::setClippingPath ( const std::vector< Point > &  points)

Define a clipping path for the whole drawing.

Parameters
pointsA path.

Definition at line 739 of file Board.cpp.

740{
742 std::vector<Point>::const_iterator it = points.begin();
743 std::vector<Point>::const_iterator end = points.end();
744 while ( it != end ) {
745 _clippingPath << _state.unit( *it );
746 ++it;
747 }
748}
void clear()
Definition: Path.h:231

References _clippingPath, _state, LibBoard::Path::clear(), and LibBoard::Board::State::unit().

◆ setClippingRectangle()

void LibBoard::Board::setClippingRectangle ( double  x,
double  y,
double  width,
double  height 
)

Define a clipping rectangle for the whole drawing.

Parameters
xx
yy
widthwidth
heightheight

Definition at line 728 of file Board.cpp.

730{
732 _clippingPath << _state.unit( Point( xLeft, yTop ) );
733 _clippingPath << _state.unit( Point( xLeft + rectWidth, yTop ) );
734 _clippingPath << _state.unit( Point( xLeft + rectWidth, yTop - rectHeight) );
735 _clippingPath << _state.unit( Point( xLeft , yTop - rectHeight ) );
736}

References _clippingPath, _state, LibBoard::Path::clear(), and LibBoard::Board::State::unit().

◆ setFillColor()

Board & LibBoard::Board::setFillColor ( const DGtal::Color color)

Changes the current fill color.

In order to use no fill color, one may set this color to Color::None.

Parameters
colorThe fill color.
Returns
The board itself.
Examples
io/boards/dgtalBoard2D-3-custom-points.cpp, and io/boards/exampleBezierCurve.cpp.

Definition at line 322 of file Board.cpp.

323{
324 _state.fillColor = color;
325 return *this;
326}

References _state, and LibBoard::Board::State::fillColor.

Referenced by addColorMapSample(), main(), DGtal::CustomColors::setStyle(), DGtal::CustomFillColor::setStyle(), and DGtal::CustomPen::setStyle().

◆ setFillColorRGBf()

Board & LibBoard::Board::setFillColorRGBf ( float  red,
float  green,
float  blue,
float  alpha = 1.0f 
)

Changes the current fill color.

Parameters
redRed component.
greenGreen component.
blueBlue component.
alphaThe opacity.
Returns
The board itself.

Definition at line 315 of file Board.cpp.

316{
317 _state.fillColor.setRGBf( red, green, blue, alpha );
318 return *this;
319}
Color & setRGBf(float red, float green, float blue, float alpha=1.0)
Definition: Color.cpp:65

References _state, LibBoard::Board::State::fillColor, and DGtal::Color::setRGBf().

◆ setFillColorRGBi()

Board & LibBoard::Board::setFillColorRGBi ( unsigned char  red,
unsigned char  green,
unsigned char  blue,
unsigned char  alpha = 255 
)

Changes the current fill color.

Parameters
redRed component.
greenGreen component.
blueBlue component.
alphaThe opacity.
Returns
The board itself.

Definition at line 305 of file Board.cpp.

309{
310 _state.fillColor.setRGBi( red, green, blue, alpha );
311 return *this;
312}
Color & setRGBi(const unsigned char aRedValue, const unsigned char aGreenValue, const unsigned char aBlueValue, const unsigned char aAlphaValue=255)

References _state, LibBoard::Board::State::fillColor, and DGtal::Color::setRGBi().

◆ setFont()

Board & LibBoard::Board::setFont ( const Fonts::Font  font,
double  fontSize 
)

Changes the current font and font size.

Parameters
fontThe name of the font.
fontSizeThe new font size. (The unit is 1pt = 1/72 in).
Returns
The board itself.

Definition at line 336 of file Board.cpp.

337{
338 _state.font = font;
339 _state.fontSize = fontSize;
340 return *this;
341}

References _state, LibBoard::Board::State::font, and LibBoard::Board::State::fontSize.

Referenced by addColorMapSample().

◆ setFontSize()

Board & LibBoard::Board::setFontSize ( double  fontSize)

Changes the font size.

Parameters
fontSizeThe new font size. (The unit is 1pt = 1/72 in).
Returns
The board itself.

Definition at line 344 of file Board.cpp.

345{
346 _state.fontSize = fontSize;
347 return *this;
348}

References _state, and LibBoard::Board::State::fontSize.

◆ setLineCap()

Board & LibBoard::Board::setLineCap ( Shape::LineCap  cap)

Set the line cap style.

Parameters
capThe cap-style which can be Shape::ButtCap, Shape::RoundCap or Shape::SquareCap.
Returns
The board itself.

Referenced by DGtal::CustomPen::setStyle().

◆ setLineJoin()

Board & LibBoard::Board::setLineJoin ( Shape::LineJoin  join)

Set the line joine style.

Parameters
joinThe join-style which can be Shape::MiterJoin, Shape::RoundJoin or Shape::BevelJoin.
Returns
The board itself.

Referenced by DGtal::CustomPen::setStyle().

◆ setLineStyle()

Board & LibBoard::Board::setLineStyle ( Shape::LineStyle  style)

Changes the current line style.

Parameters
styleThe new line style.
Returns
The board itself.

Referenced by DGtal::CustomPen::setStyle().

◆ setLineWidth()

Board & LibBoard::Board::setLineWidth ( double  width)

Changes the current line thickness (1/72 inche unit).

Parameters
widthThe new line thickness.
Returns
The board itself.
Examples
geometry/curves/exampleRationalConvexity.cpp.

Definition at line 329 of file Board.cpp.

330{
331 _state.lineWidth = width;
332 return *this;
333}

References _state, and LibBoard::Board::State::lineWidth.

Referenced by DGtal::CustomPen::setStyle(), testAlphaThickSegmentComputerFloatingPointContour(), testAlphaThickSegmentConvexHullAndBox(), and testThicknessDefinitions().

◆ setPenColor()

Board & LibBoard::Board::setPenColor ( const DGtal::Color color)

◆ setPenColorRGBf()

Board & LibBoard::Board::setPenColorRGBf ( float  red,
float  green,
float  blue,
float  alpha = 1.0f 
)

Changes the current pen color.

Parameters
redRed
greengreen
blueblue
alphaalpha
Returns
The board itself.

Definition at line 288 of file Board.cpp.

292{
293 _state.penColor.setRGBf( red, green, blue, alpha );
294 return *this;
295}

References _state, LibBoard::Board::State::penColor, and DGtal::Color::setRGBf().

◆ setPenColorRGBi()

Board & LibBoard::Board::setPenColorRGBi ( unsigned char  red,
unsigned char  green,
unsigned char  blue,
unsigned char  alpha = 255 
)

Changes the current pen color.

Parameters
redRed component.
greenGreen component.
blueBlue component.
alphaalpha component.
Returns
The board itself.
Examples
geometry/curves/exampleArithmeticalDSL.cpp, geometry/curves/exampleDigitalConvexity.cpp, and geometry/curves/exampleRationalConvexity.cpp.

Definition at line 278 of file Board.cpp.

282{
283 _state.penColor.setRGBi( red, green, blue, alpha );
284 return *this;
285}

References _state, LibBoard::Board::State::penColor, and DGtal::Color::setRGBi().

Referenced by drawArithmeticalDSL(), and main().

◆ setUnit() [1/2]

void LibBoard::Board::setUnit ( double  factor,
Unit  unit 
)

Set the unit used by the drawSomething methods.

Parameters
factorThe factor of the unit.
unitThe unit to be used in { PT, IN, CM, MM }.

Definition at line 259 of file Board.cpp.

260{
261 switch ( unit ) {
262 case UPoint:
263 _state.unitFactor = factor;
264 break;
265 case UInche:
266 _state.unitFactor = 720.0f * factor;
267 break;
268 case UCentimeter:
269 _state.unitFactor = 10.0f * ppmm * factor;
270 break;
271 case UMillimeter:
272 _state.unitFactor = ppmm * factor;
273 break;
274 }
275}

References _state, UCentimeter, UInche, UMillimeter, LibBoard::Board::State::unitFactor, and UPoint.

◆ setUnit() [2/2]

void LibBoard::Board::setUnit ( Unit  unit)

◆ translate()

Shape & LibBoard::Board::translate ( double  dx,
double  dy 
)
virtual

Translate the shape by a given offset.

Parameters
dxThe x offset.
dyThe y offset.
Returns
A reference to the shape itself.

Implements LibBoard::Shape.

Definition at line 176 of file Board.cpp.

177{
178 ShapeList::translate( dx, dy );
179 _clippingPath.translate( dx, dy );
180 return (*this);
181}
Shape & translate(double dx, double dy)
Definition: ShapeList.cpp:236

References _clippingPath, LibBoard::Path::translate(), and LibBoard::ShapeList::translate().

Referenced by addColorMapSample(), and translated().

◆ translated()

Board LibBoard::Board::translated ( double  dx,
double  dy 
)

Definition at line 221 of file Board.cpp.

222{
223 return static_cast<const Board &>( Board( *this ).translate( dx, dy ) );
224}

References translate().

Field Documentation

◆ _backgroundColor

DGtal::Color LibBoard::Board::_backgroundColor
protected

The color of the background.

Definition at line 956 of file Board.h.

Referenced by backgroundColor(), clear(), saveCairo(), saveEPS(), saveFIG(), saveSVG(), and saveTikZ().

◆ _clippingPath

Path LibBoard::Board::_clippingPath
protected

◆ _state

State LibBoard::Board::_state
protected

◆ Degree

const double LibBoard::Board::Degree = 3.14159265358979323846 / 180.0
static

Definition at line 44 of file Board.h.


The documentation for this class was generated from the following files: