DGtal 1.4.0
Loading...
Searching...
No Matches
LibBoard::Board Class Reference

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

#include <Board/Board.h>

Inheritance diagram for LibBoard::Board:
[legend]

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 ()
 
bool filled () const
 
ShaperotateDeg (double angle, const Point &center)
 
ShaperotateDeg (double angle)
 
Rect bbox ()
 
Shapeoperator-- ()
 
Shapeoperator++ ()
 
int depth () const
 
virtual void depth (int)
 
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 103 of file Board.cpp.

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

Referenced by rotated(), rotated(), scaled(), scaled(), and translated().

◆ Board() [2/2]

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

Copy constructor.

Parameters
otherThe object to be copied.

Definition at line 108 of file Board.cpp.

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

◆ ~Board()

LibBoard::Board::~Board ( )

Definition at line 145 of file Board.cpp.

146{
147
148}

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 766 of file Board.cpp.

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

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 781 of file Board.cpp.

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

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 350 of file Board.cpp.

351{
352 _backgroundColor = color;
353}

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 151 of file Board.cpp.

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

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

Referenced by checkCut(), checkOutputConvexHullBorder(), convexHull(), drawComplex(), exampleStandardDSS(), main(), main(), 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 460 of file Board.cpp.

461 {
462 int d = (depthValue != -1) ? depthValue : _nextDepth--;
463 _shapes.push_back( new Arc( _state.unit(x), _state.unit(y), _state.unit(radius),
464 angle1, angle2, neg,_state.penColor,
466}
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 399 of file Board.cpp.

402{
403 if ( depthValue != -1 )
404 _shapes.push_back( new Arrow( _state.unit(x1), _state.unit(y1),
405 _state.unit(x2), _state.unit(y2),
406 _state.penColor, filledArrow ? _state.penColor : DGtal::Color::None,
407 _state.lineWidth, _state.lineStyle, _state.lineCap, _state.lineJoin, depthValue ) );
408 else
409 _shapes.push_back( new Arrow( _state.unit(x1), _state.unit(y1),
410 _state.unit(x2), _state.unit(y2),
411 _state.penColor, filledArrow ? _state.penColor : DGtal::Color::None,
412 _state.lineWidth, _state.lineStyle, _state.lineCap, _state.lineJoin, _nextDepth-- ) );
413}
DGtal is the top-level namespace which contains all DGtal functions and types.

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 709 of file Board.cpp.

710{
711 int d = (depthValue != -1) ? depthValue : _nextDepth--;
712 Rect box = boundingBox();
713 _shapes.push_back( new Rectangle( _state.unit(box.left),
714 _state.unit(box.top),
715 _state.unit(box.width),
716 _state.unit(box.height),
723 d ) );
724}
Shape::LineJoin lineJoin
Definition Board.h:946
Shape::LineCap lineCap
Definition Board.h:945
DGtal::Color fillColor
Definition Board.h:942
Rect boundingBox() const

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 450 of file Board.cpp.

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

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 530 of file Board.cpp.

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

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 356 of file Board.cpp.

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

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 481 of file Board.cpp.

484{
485 int d = (depthValue != -1) ? depthValue : _nextDepth--;
486 _shapes.push_back( new Ellipse( _state.unit(x), _state.unit(y),
487 _state.unit(xRadius), _state.unit(yRadius),
492 d ) );
493}

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 427 of file Board.cpp.

430{
431 int d = (depthValue != -1) ? depthValue : _nextDepth--;
432 _shapes.push_back( new Image( _state.unit(x), _state.unit(y), _state.unit(width), _state.unit(height),
433 filename, d, alpha ) );
434}
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 367 of file Board.cpp.

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

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(), 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 510 of file Board.cpp.

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

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 383 of file Board.cpp.

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

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 416 of file Board.cpp.

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

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 692 of file Board.cpp.

694{
695 int d = (depthValue != -1) ? depthValue : _nextDepth--;
696 _shapes.push_back( new Text( _state.unit(x), _state.unit(y), text,
698}
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 701 of file Board.cpp.

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

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 589 of file Board.cpp.

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

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 570 of file Board.cpp.

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

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 470 of file Board.cpp.

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

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 496 of file Board.cpp.

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

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 646 of file Board.cpp.

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

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 663 of file Board.cpp.

671{
672 DGtal::Color color1( _state.penColor );
673 DGtal::Color color2( _state.penColor );
674 DGtal::Color color3( _state.penColor );
675 color1.red( static_cast<unsigned char>( std::min( 255.0f, color1.red() * brightness1 ) ) );
676 color1.green( static_cast<unsigned char>( std::min( 255.0f, color1.green() * brightness1 ) ) );
677 color1.blue( static_cast<unsigned char>( std::min( 255.0f, color1.blue() * brightness1 ) ) );
678 color2.red( static_cast<unsigned char>( std::min( 255.0f, color2.red() * brightness2 ) ) );
679 color2.green( static_cast<unsigned char>( std::min( 255.0f, color2.green() * brightness2 ) ) );
680 color2.blue( static_cast<unsigned char>( std::min( 255.0f, color2.blue() * brightness2 ) ) );
681 color3.red( static_cast<unsigned char>( std::min( 255.0f, color3.red() * brightness3 ) ) );
682 color3.green( static_cast<unsigned char>( std::min( 255.0f, color3.green() * brightness3 ) ) );
683 color3.blue( static_cast<unsigned char>( std::min( 255.0f, color3.blue() * brightness3 ) ) );
684 fillGouraudTriangle( Point( _state.unit(p1.x), _state.unit(p1.y) ), color1,
685 Point( _state.unit(p2.x), _state.unit(p2.y) ), color2,
686 Point( _state.unit(p3.x), _state.unit(p3.y) ), color3,
687 divisions,
688 depthValue );
689}
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:646

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 550 of file Board.cpp.

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

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 438 of file Board.cpp.

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

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 627 of file Board.cpp.

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

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 608 of file Board.cpp.

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

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 131 of file Board.cpp.

133{
135 return *this;
136}
void addShape(const Shape &shape, double scaleFactor)

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 138 of file Board.cpp.

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

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 116 of file Board.cpp.

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

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 167 of file Board.cpp.

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

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 159 of file Board.cpp.

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

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

Referenced by clear().

◆ rotated() [1/2]

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

Definition at line 214 of file Board.cpp.

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

References Board().

◆ rotated() [2/2]

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

Definition at line 208 of file Board.cpp.

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

References Board().

◆ 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 1107 of file Board.cpp.

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

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 1131 of file Board.cpp.

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

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 1143 of file Board.cpp.

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

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

References saveCairo().

Referenced by alphaShape(), convexHull(), drawArithmeticalDSL(), exampleNaiveDSL(), exampleNaiveDSS(), exampleStandardDSL(), exampleStandardDSS(), exampleUpdate(), main(), 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 811 of file Board.cpp.

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

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 804 of file Board.cpp.

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

References saveEPS().

Referenced by checkCut(), checkOutputConvexHullBorder(), drawingTestStabbingCircleComputer(), drawingTestStabbingLineComputer(), greedySegmentationVisualTest(), main(), main(), main(), SaturatedSegmentationVisualTest(), save(), saveEPS(), saveEPS(), saveEPS(), specificTestLatticePolytope2D(), testAlphaThickSegmentComputerFloatingPointContour(), testAlphaThickSegmentConvexHullAndBox(), testAlphaThickSegmentFreeman(), testAlphaThickSpecialInit(), testAngleLinearMinimizer(), testBreadthFirstPropagation(), testCellDrawOnBoard(), testCMAP(), testComputeInterior(), testConvexHullCompThickness(), testDepthFirstPropagation(), testDigitization(), testDisplay(), testDistancePropagation(), testLatticePolytope2D(), testMultiWidth(), testPNMReader(), testSegmentation(), testSegmentation(), testSegmentationLarger(), 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 819 of file Board.cpp.

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

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

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 916 of file Board.cpp.

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

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 906 of file Board.cpp.

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

References saveFIG().

Referenced by main(), main(), main(), save(), saveFIG(), saveFIG(), 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 925 of file Board.cpp.

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

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

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 1024 of file Board.cpp.

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

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 1011 of file Board.cpp.

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

References saveSVG().

Referenced by alphaShape(), convexHull(), exampleNaiveDSL(), exampleNaiveDSS(), exampleStandardDSL(), exampleStandardDSS(), exampleUpdate(), main(), main(), main(), moduleImages_example(), save(), saveSVG(), saveSVG(), 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 1034 of file Board.cpp.

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

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

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 1230 of file Board.cpp.

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

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 1218 of file Board.cpp.

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

References saveTikZ().

Referenced by main(), main(), main(), save(), saveTikZ(), saveTikZ(), 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 1238 of file Board.cpp.

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

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 1224 of file Board.cpp.

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

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 196 of file Board.cpp.

197{
198 Point delta = _clippingPath.center() - center();
199 delta *= s;
200 _clippingPath.scale( s );
201 ShapeList::scale( s );
202 delta = ( center() + delta ) - _clippingPath.center();
203 _clippingPath.translate( delta.x, delta.y );
204 return (*this);
205}
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)

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 183 of file Board.cpp.

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

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 testDigitalSetDraw().

◆ scaled() [1/2]

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

Definition at line 232 of file Board.cpp.

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

References Board().

◆ scaled() [2/2]

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

Definition at line 226 of file Board.cpp.

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

References Board().

◆ setClippingPath() [1/2]

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

Define a clipping path for the whole drawing.

Parameters
pathA path.

Definition at line 750 of file Board.cpp.

751{
752 _clippingPath = path;
753 _clippingPath.setClosed( true );
754 if ( _clippingPath.size() > 1 ) {
755 if ( _clippingPath[0] == _clippingPath[ _clippingPath.size() - 1 ] )
757 }
758 unsigned int n = _clippingPath.size();
759 for ( unsigned int i = 0; i < n; ++i ) {
761 }
762}
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 738 of file Board.cpp.

739{
741 std::vector<Point>::const_iterator it = points.begin();
742 std::vector<Point>::const_iterator end = points.end();
743 while ( it != end ) {
744 _clippingPath << _state.unit( *it );
745 ++it;
746 }
747}
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 727 of file Board.cpp.

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

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 321 of file Board.cpp.

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

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 314 of file Board.cpp.

315{
316 _state.fillColor.setRGBf( red, green, blue, alpha );
317 return *this;
318}
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 304 of file Board.cpp.

308{
309 _state.fillColor.setRGBi( red, green, blue, alpha );
310 return *this;
311}
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 335 of file Board.cpp.

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

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 343 of file Board.cpp.

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

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 328 of file Board.cpp.

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

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

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

◆ setPenColor()

◆ 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 287 of file Board.cpp.

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

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 277 of file Board.cpp.

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

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 258 of file Board.cpp.

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

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 175 of file Board.cpp.

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

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

Referenced by addColorMapSample().

◆ translated()

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

Definition at line 220 of file Board.cpp.

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

References Board().

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

◆ 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: