Go to the documentation of this file.
34 #include "BoardConfig.h"
91 static const double Degree;
138 void clear(
const Color & color = Color::Null);
147 inline void clear(
unsigned char red,
unsigned char green,
unsigned char blue);
204 void drawDot(
double x,
double y);
213 void drawLine(
double x1,
double y1,
double x2,
double y2);
253 void drawTriangle(
double x1,
double y1,
double x2,
double y2,
double x3,
double y3);
274 void fillTriangle(
double x1,
double y1,
double x2,
double y2,
double x3,
double y3);
289 const Point & p3,
const Color & color3,
unsigned char divisions = 3);
306 const double x2,
const double y2,
const Color & color2,
307 const double x3,
const double y3,
const Color & color3,
unsigned char divisions = 3);
321 const Point & p2,
const float brightness2,
322 const Point & p3,
const float brightness3,
unsigned char divisions = 3);
340 const double x2,
const double y2,
const float brightness2,
341 const double x3,
const double y3,
const float brightness3,
342 unsigned char divisions = 3);
393 void drawCircle(
double x,
double y,
double radius);
402 void fillCircle(
double x,
double y,
double radius);
412 void drawEllipse(
double x,
double y,
double xRadius,
double yRadius);
422 void fillEllipse(
double x,
double y,
double xRadius,
double yRadius);
452 void drawText(
double x,
double y,
const char * text);
469 void drawText(
double x,
double y,
const std::string & text);
486 Board &
setFont(
const Fonts::Font font,
double fontSize);
505 Board &
setPenColorRGBi(
unsigned char red,
unsigned char green,
unsigned char blue,
unsigned char alpha = 255);
537 Board &
setFillColorRGBi(
unsigned char red,
unsigned char green,
unsigned char blue,
unsigned char alpha = 255);
668 void addDuplicates(
const Shape & shape, std::size_t times,
double dx,
double dy,
double scaleX,
double scaleY,
double angle = 0.0);
680 void save(
const char * filename, PageSize
size = Board::BoundingBox,
double margin = 0.0, Unit unit = UMillimeter)
const;
693 void save(
const char * filename,
double pageWidth,
double pageHeight,
double margin = 0.0, Unit unit = UMillimeter)
const;
705 void saveEPS(std::ostream & out, PageSize
size = Board::BoundingBox,
double margin = 0.0, Unit unit = UMillimeter,
const std::string & title = std::string())
const;
717 void saveEPS(
const char * filename, PageSize
size = Board::BoundingBox,
double margin = 0.0, Unit unit = UMillimeter,
const std::string & title = std::string())
const;
729 void saveEPS(std::ostream & out,
double pageWidth,
double pageHeight,
double margin = 0.0, Unit unit = UMillimeter,
const std::string & title = std::string())
const;
742 void saveEPS(
const char * filename,
double pageWidth,
double pageHeight,
double margin = 0.0, Unit unit = UMillimeter,
const std::string & title = std::string())
const;
753 void saveFIG(
const char * filename, PageSize
size = Board::BoundingBox,
double margin = 0.0, Unit unit = UMillimeter)
const;
764 void saveFIG(std::ostream & out, PageSize
size = Board::BoundingBox,
double margin = 0.0, Unit unit = UMillimeter)
const;
775 void saveFIG(
const char * filename,
double pageWidth,
double pageHeight,
double margin = 0.0, Unit unit = UMillimeter)
const;
786 void saveFIG(std::ostream & out,
double pageWidth,
double pageHeight,
double margin = 0.0, Unit unit = UMillimeter)
const;
797 void saveSVG(
const char * filename, PageSize
size = Board::BoundingBox,
double margin = 0.0, Unit unit = UMillimeter)
const;
808 void saveSVG(std::ostream & out, PageSize
size = Board::BoundingBox,
double margin = 0.0, Unit unit = UMillimeter)
const;
819 void saveSVG(
const char * filename,
double pageWidth,
double pageHeight,
double margin = 0.0, Unit unit = UMillimeter)
const;
830 void saveSVG(std::ostream & out,
double pageWidth,
double pageHeight,
double margin = 0.0, Unit unit = UMillimeter)
const;
840 void saveTikZ(
const char * filename, PageSize
size = Board::BoundingBox,
double margin = 0.0)
const;
850 void saveTikZ(std::ostream & out, PageSize
size = Board::BoundingBox,
double margin = 0.0)
const;
860 void saveTikZ(
const char * filename,
double pageWidth,
double pageHeight,
double margin = 0.0)
const;
870 void saveTikZ(std::ostream & out,
double pageWidth,
double pageHeight,
double margin = 0.0)
const;
909 static double toMillimeter(
double x, Unit unit);
944 Group grid(
Point topLeft,
size_t columns,
size_t rows,
double width,
double height,
Color penColor,
Color fillColor,
double lineWidth,
const LineStyle style = SolidStyle,
const LineCap cap = ButtCap,
945 const LineJoin join = MiterJoin);
980 Group array(
Point topLeft,
const std::vector<Color> & colors,
unsigned int columns,
unsigned int rows,
double pixelWidth,
double pixelHeight = 0.0,
double lineWidth = 0.0);
1003 inline void Board::clear(
unsigned char red,
unsigned char green,
unsigned char blue)
1042 const double x2,
const double y2,
const Color & color2,
1043 const double x3,
const double y3,
const Color & color3,
1044 unsigned char divisions)
1050 const double x2,
const double y2,
const float brightness2,
1051 const double x3,
const double y3,
const float brightness3,
1052 unsigned char divisions)
Group array(Point topLeft, const std::vector< Color > &colors, unsigned int columns, unsigned int rows, double pixelWidth, double pixelHeight=0.0, double lineWidth=0.0)
Produce a rectangular color matrix.
Definition: Board.cpp:997
@copyright This source code is part of the Board project, a C++ library whose purpose is to allow sim...
DepthFirstIterator depthFirstBegin()
depthFirstBegin
Definition: ShapeList.h:645
Rect boundingBox(LineWidthFlag) const override
Definition: Polyline.cpp:328
Shape & rotateDeg(double angle, const Point ¢er)
Definition: Shape.h:336
void saveEPS(std::ostream &out, PageSize size=Board::BoundingBox, double margin=0.0, Unit unit=UMillimeter, const std::string &title=std::string()) const
Definition: Board.cpp:532
static const Color & defaultPenColor()
defaultPenColor
Definition: Style.h:281
T & last(const std::size_t position=0)
Definition: ShapeList.h:501
T & topLevelFindLast(std::size_t position=0)
Definition: ShapeList.h:518
bool isSeparing(Point &a, Point &b, const std::vector< Point > &points)
isSeparing
Definition: hull.cpp:34
void drawRectangle(double left, double top, double width, double height)
Definition: Board.cpp:323
Path & scale(double sx, double sy)
Definition: Path.cpp:167
@copyright This source code is part of the Board project, a C++ library whose purpose is to allow sim...
Board rotated(double angle, const Point ¢er)
Definition: Board.cpp:207
Board & setFillColor(const Color &color)
Definition: Board.cpp:268
Definition: Exception.h:36
Arrow translated(double dx, double dy) const
Definition: Arrow.cpp:66
Group & scale(double sx, double sy) override
Definition: Group.cpp:77
The Point structure. @copyright This source code is part of the Board project, a C++ library whose pu...
void setClippingPath(const std::vector< Point > &points)
Definition: Group.cpp:134
static const double & defaultLineWidth()
defaultLineWidth
Definition: Style.h:276
A polygonal line described by a series of 2D points.
Definition: Polyline.h:38
static void disableLineWidthScaling()
Definition: Board.cpp:139
void saveSVG(const char *filename, PageSize size=Board::BoundingBox, double margin=0.0, Unit unit=UMillimeter) const
Definition: Board.cpp:758
std::size_t deepSize() const
Recursively counts the number of shapes in the list.
Definition: ShapeList.cpp:515
@copyright This source code is part of the Board project, a C++ library whose purpose is to allow sim...
Shape & scaleToWidth(double w, LineWidthFlag lineWidthFlag)
Definition: Shape.cpp:85
Group * accept(CompositeShapeTransform &transform) const override
Accept a composite shape transform.
Definition: Group.cpp:221
const Color & penColor() const
penColor
Definition: Board.h:1026
Board & operator=(const Board &other)
Definition: Board.cpp:108
Path mid(const Path &a, const Path &b, double time)
Definition: Path.cpp:387
A line between two points with an arrow at one extremity.
Definition: Arrow.h:38
virtual void accept(ShapeVisitor &visitor) override
Accepts a visitor object.
Definition: Line.cpp:200
Style withLineStyle(LineStyle lineStyle) const
Definition: Style.h:250
Point normalised() const
Definition: Point.h:403
Board translated(double dx, double dy)
Definition: Board.cpp:217
Board & setFont(const Fonts::Font font, double fontSize)
Definition: Board.cpp:280
Board & setLineCap(LineCap cap)
Definition: Board.h:1014
Board & scale(double sx, double sy) override
Definition: Board.cpp:176
ShapeList findAll(ShapeList &list)
Definition: traversal.cpp:68
Struct representing a rectangle on the plane.
Definition: Rect.h:39
ExtremityType
Definition: Arrow.h:40
ShapeList & push_back(Shape *shape)
Definition: ShapeList.cpp:441
void setClippingPath(const std::vector< Point > &points)
Definition: Board.cpp:469
Board & setFillColorRGBi(unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha=255)
Definition: Board.cpp:250
Line & scale(double sx, double sy) override
Definition: Line.cpp:99
@ Closed
Definition: Arrow.h:43
ShapeList & rotate(double angle, const Point ¢er) override
Definition: ShapeList.cpp:301
Polyline rotated(double angle, const Point ¢er) const
Definition: Polyline.cpp:72
Line rotated(double angle, const Point ¢er) const
Definition: Line.cpp:67
DepthFirstIterator depthFirstEnd()
depthFirstEnd
Definition: ShapeList.h:650
@copyright This source code is part of the Board project, a C++ library whose purpose is to allow sim...
Group & translate(double dx, double dy) override
Definition: Group.cpp:70
@copyright This source code is part of the Board project, a C++ library whose purpose is to allow sim...
Rect boundingBox(LineWidthFlag) const override
Definition: Line.cpp:242
@ Plain
Definition: Arrow.h:44
void drawClosedPolyline(const std::vector< Point > &points)
Definition: Board.cpp:372
Definition: RoughVisitor.h:46
void fillPolyline(const std::vector< Point > &points)
Definition: Board.cpp:377
Color _backgroundColor
Definition: Board.h:921
The Exception type. @copyright This source code is part of the Board project, a C++ library whose pur...
double x
Definition: Point.h:43
A line between two points.
Definition: Dot.h:42
@copyright This source code is part of the Board project, a C++ library whose purpose is to allow sim...
A piece of text.
Definition: Text.h:40
void fillCircle(double x, double y, double radius)
Definition: Board.cpp:352
double fontSize
Definition: Board.h:917
void drawDot(double x, double y)
Definition: Board.cpp:298
Struct representing a 2D point.
Definition: Point.h:42
@copyright This source code is part of the Board project, a C++ library whose purpose is to allow sim...
Shape & moveCenter(double x, double y, LineWidthFlag lineWidthFlag=IgnoreLineWidth)
Definition: Shape.cpp:64
Board(const Color &backgroundColor=Color::Null)
Definition: Board.cpp:104
The BreadthFirstIterator struct allows to traverse the shape tree using a breadth-first strategy.
Definition: ShapeList.h:388
A line between two points.
Definition: Line.h:38
Board & setPenColorRGBi(unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha=255)
Definition: Board.cpp:232
Group & addTiling(const Shape &shape, Point topLeftCorner, std::size_t columns, std::size_t rows, double spacing=0.0, LineWidthFlag lineWidthFlag=UseLineWidth)
Definition: ShapeList.cpp:210
void drawText(double x, double y, const char *text)
Definition: Board.cpp:428
A cubice polygonal line described by a series of 2D points.
Definition: Bezier.h:40
Point rotatedPI2() const
Definition: Point.h:369
@copyright This source code is part of the Board project, a C++ library whose purpose is to allow sim...
Group framed(const Shape &shape, const Color &color=Style::defaultPenColor(), double lineWidth=Style::defaultLineWidth(), double margin=0.0, int sketchyCount=0)
Surround a shape with a rectangular frame.
Definition: Board.cpp:1023
Board & rotate(double angle, const Point ¢er) override
Definition: Board.cpp:155
Abstract structure for a 2D shape.
Definition: Shape.h:63
@copyright This source code is part of the Board project, a C++ library whose purpose is to allow sim...
Group cross(Point p, const Style &style=Style::defaultStyle())
Definition: Board.cpp:968
ShapeList & translate(double dx, double dy) override
Definition: ShapeList.cpp:328
Board & setFillColorHSV(float hue, float saturation, float value, float alpha=1.0f)
Definition: Board.cpp:262
State _state
Definition: Board.h:920
static void enableLineWidthScaling()
Definition: Board.cpp:134
Shape & top()
Definition: ShapeList.cpp:452
void setClippingRectangle(double x, double y, double width, double height)
Definition: Board.cpp:455
void fillRectangle(double left, double top, double width, double height)
Definition: Board.cpp:333
Point & normalise()
Definition: Point.h:408
Board scaled(double sx, double sy)
Definition: Board.cpp:222
void saveTikZ(const char *filename, PageSize size=Board::BoundingBox, double margin=0.0) const
Definition: Board.cpp:849
ShapeList translated(double dx, double dy)
Definition: ShapeList.cpp:339
A path, according to Postscript and SVG definition.
Definition: Path.h:45
Board & setPenColorRGBf(float red, float green, float blue, float alpha=1.0f)
Definition: Board.cpp:238
@copyright This source code is part of the Board project, a C++ library whose purpose is to allow sim...
void drawCircle(double x, double y, double radius)
Definition: Board.cpp:347
Board & translate(double dx, double dy) override
Definition: Board.cpp:169
void fillTriangle(double x1, double y1, double x2, double y2, double x3, double y3)
Definition: Board.cpp:394
ShapeList & clear()
Definition: ShapeList.cpp:86
@ Stick
Definition: Arrow.h:42
void backgroundColor(const Color &color)
Definition: Board.cpp:293
Board & setFontSize(double fontSize)
Definition: Board.cpp:287
Bezier scaled(double sx, double sy) const
Definition: Bezier.cpp:184
An ellipse.
Definition: Ellipse.h:38
Polyline translated(double dx, double dy) const
Definition: Polyline.cpp:99
@copyright This source code is part of the Board project, a C++ library whose purpose is to allow sim...
A group of shapes. A group is basically a ShapeList except that when rendered in either an SVG of a F...
Definition: Group.h:40
Group & rotate(double angle, const Point ¢er) override
Definition: Group.cpp:56
Polyline & rotate(double angle, const Point ¢er) override
Definition: Polyline.cpp:61
static void slideRandomly(Point &point, const double &radius)
Definition: RoughVisitor.cpp:320
std::size_t size() const
The number of shapes in the list (at top level).
Definition: ShapeList.h:665
Group grid(Point topLeft, size_t columns, size_t rows, double width, double height, Color penColor, Color fillColor, double lineWidth, const LineStyle style=SolidStyle, const LineCap cap=ButtCap, const LineJoin join=MiterJoin)
Definition: Board.cpp:942
Ellipse translated(double dx, double dy) const
Definition: Ellipse.cpp:93
A group of shapes.
Definition: ShapeList.h:46
void drawArrow(double x1, double y1, double x2, double y2, Arrow::ExtremityType type=Arrow::Plain)
Definition: Board.cpp:313
Style style
Definition: Board.h:915
void addDuplicates(const Shape &shape, std::size_t times, double dx, double dy, double scale=1.0)
Definition: Board.cpp:490
ShapeList & scale(double sx, double sy) override
Definition: ShapeList.cpp:344
virtual Point center(LineWidthFlag lineWidthFlag=IgnoreLineWidth) const
Definition: Shape.cpp:59
Polyline bezierControls(const Bezier &bezier, const Style &style=Style::defaultStyle())
Produce a polyline of the Biezer vertices and control points.
Definition: Board.cpp:976
Declaration of the Board class.
const Style & style() const
Definition: Board.h:1036
void clear(const Color &color=Color::Null)
Definition: Board.cpp:149
ShapeList rotated(double angle, const Point ¢er)
Definition: ShapeList.cpp:312
The DepthFirstIterator struct allows to traverse the shape tree using a depth-first strategy.
Definition: ShapeList.h:366
void fillEllipse(double x, double y, double xRadius, double yRadius)
Definition: Board.cpp:362
Class for EPS, FIG or SVG drawings.
Definition: Board.h:62
@copyright This source code is part of the Board project, a C++ library whose purpose is to allow sim...
Leaf visitor may be used to apply a function on each Shape with style, in back-to-front order.
Definition: ShapeVisitor.h:247
ShapeList scaled(double sx, double sy) const
Definition: ShapeList.cpp:366
Board & setLineJoin(LineJoin join)
Definition: Board.h:1020
void drawBoundingBox(LineWidthFlag lineWidthFlag)
Definition: Board.cpp:448
double norm() const
Definition: Point.h:398
Fonts::Font font
Definition: Board.h:916
Board & operator<<(const Shape &shape)
Definition: Board.cpp:126
void drawEllipse(double x, double y, double xRadius, double yRadius)
Definition: Board.cpp:357
Board & setLineStyle(LineStyle style)
Definition: Board.h:1008
@copyright This source code is part of the Board project, a C++ library whose purpose is to allow sim...
void drawPolyline(const std::vector< Point > &points)
Definition: Board.cpp:367
static void setLineWidthScaling(bool)
Definition: Board.cpp:144
@copyright This source code is part of the Board project, a C++ library whose purpose is to allow sim...
Ellipse & scale(double sx, double sy) override
Definition: Ellipse.cpp:98
void save(const char *filename, PageSize size=Board::BoundingBox, double margin=0.0, Unit unit=UMillimeter) const
Definition: Board.cpp:933
void drawLine(double x1, double y1, double x2, double y2)
Definition: Board.cpp:303
Point rotated(double angle) const
Definition: Point.h:351
const std::string & name() const override
Definition: ShapeList.cpp:49
Rect boundingBox(LineWidthFlag) const override
Definition: Group.cpp:212
Board & setPenColor(const Color &color)
Definition: Board.cpp:244
double y
Definition: Point.h:44
void saveFIG(const char *filename, PageSize size=Board::BoundingBox, double margin=0.0, Unit unit=UMillimeter) const
Definition: Board.cpp:629
void fillGouraudTriangle(const Point &p1, const Color &color1, const Point &p2, const Color &color2, const Point &p3, const Color &color3, unsigned char divisions=3)
Definition: Board.cpp:406
Board & setLineWidth(double width)
Definition: Board.cpp:274
ShapeList & append(const Shape &shape, Direction direction=ShapeList::Right, Alignment alignment=ShapeList::AlignCenter, double margin=0.0, LineWidthFlag lineWidthFlag=UseLineWidth)
Definition: ShapeList.cpp:246
static const Style & defaultStyle()
defaultStyle
Definition: Style.h:271
The Exception type. @copyright This source code is part of the Board project, a C++ library whose pur...
void drawTriangle(double x1, double y1, double x2, double y2, double x3, double y3)
Definition: Board.cpp:382
Rect boundingBox(LineWidthFlag) const override
Definition: ShapeList.cpp:419
const Color & fillColor() const
fillColor
Definition: Board.h:1031
Structure for a bitmap image shape.
Definition: Image.h:41
Structure representing an RGB triple.
Definition: Color.h:43
Board & setFillColorRGBf(float red, float green, float blue, float alpha=1.0f)
Definition: Board.cpp:256