Board  0.9.5
Board.h
Go to the documentation of this file.
1 /* -*- mode: c++ -*- */
27 #ifndef BOARD_BOARD_H
28 #define BOARD_BOARD_H
29 
30 #include <ostream>
31 #include <string>
32 #include <vector>
33 
34 #include "BoardConfig.h"
35 #include "board/Arrow.h"
36 #include "board/Bezier.h"
37 #include "board/BoardFontText.h"
38 #include "board/Dot.h"
39 #include "board/Ellipse.h"
40 #include "board/Exception.h"
41 #include "board/Group.h"
42 #include "board/Image.h"
43 #include "board/Line.h"
44 #include "board/Path.h"
45 #include "board/Point.h"
46 #include "board/Polyline.h"
47 #include "board/RoughVisitor.h"
48 #include "board/Shape.h"
49 #include "board/ShapeList.h"
50 #include "board/SketchFilter.h"
51 #include "board/Style.h"
52 #include "board/Text.h"
53 
54 namespace LibBoard
55 {
56 
62 struct Board : public ShapeList {
63 
64 public:
65  enum PageSize
66  {
67  BoundingBox = 0,
68  A0,
69  A1,
70  A2,
71  A3,
72  A4,
73  A5,
74  A6,
75  A7,
76  A8,
77  A9,
78  A10,
79  Letter,
80  Legal,
81  Executive
82  };
83 
84  enum Unit
85  {
86  UPoint,
87  UInche,
88  UCentimeter,
89  UMillimeter
90  };
91  static const double Degree;
92 
93  enum AspectRatioFlag
94  {
95  IgnoreAspectRatio,
96  KeepAspectRatio
97  };
98 
104  Board(const Color & backgroundColor = Color::Null);
105 
111  Board(const Board & other);
112 
113  ~Board() override;
114 
122  Board & operator=(const Board & other);
123 
131  Board & operator<<(const Shape & shape);
132 
138  void clear(const Color & color = Color::Null);
139 
147  inline void clear(unsigned char red, unsigned char green, unsigned char blue);
148 
149  Board & rotate(double angle, const Point & center) override;
150 
151  Board & rotate(double angle) override;
152 
153  Board & translate(double dx, double dy) override;
154 
155  Board & scale(double sx, double sy) override;
156 
157  Board & scale(double s) override;
158 
165  Board rotated(double angle, const Point & center);
166 
173  Board rotated(double angle);
174 
181  Board translated(double dx, double dy);
182 
189  Board scaled(double sx, double sy);
190 
196  Board scaled(double s);
197 
204  void drawDot(double x, double y);
205 
213  void drawLine(double x1, double y1, double x2, double y2);
214 
221  void drawLine(Point p, Point q);
222 
232  void drawArrow(double x1, double y1, double x2, double y2, Arrow::ExtremityType type = Arrow::Plain);
233 
242 
253  void drawTriangle(double x1, double y1, double x2, double y2, double x3, double y3);
254 
262  void drawTriangle(const Point & p1, const Point & p2, const Point & p3);
263 
274  void fillTriangle(double x1, double y1, double x2, double y2, double x3, double y3);
275 
287  void fillGouraudTriangle(const Point & p1, const Color & color1, //
288  const Point & p2, const Color & color2, //
289  const Point & p3, const Color & color3, unsigned char divisions = 3);
290 
305  inline void fillGouraudTriangle(const double x1, const double y1, const Color & color1, //
306  const double x2, const double y2, const Color & color2, //
307  const double x3, const double y3, const Color & color3, unsigned char divisions = 3);
308 
320  void fillGouraudTriangle(const Point & p1, const float brightness1, //
321  const Point & p2, const float brightness2, //
322  const Point & p3, const float brightness3, unsigned char divisions = 3);
323 
339  inline void fillGouraudTriangle(const double x1, const double y1, const float brightness1, //
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);
343 
351  void fillTriangle(const Point & p1, const Point & p2, const Point & p3);
352 
361  void drawRectangle(double left, double top, double width, double height);
362 
368  void drawRectangle(const Rect & rect);
369 
378  void fillRectangle(double left, double top, double width, double height);
379 
384  void fillRectangle(const Rect & rect);
385 
393  void drawCircle(double x, double y, double radius);
394 
402  void fillCircle(double x, double y, double radius);
403 
412  void drawEllipse(double x, double y, double xRadius, double yRadius);
413 
422  void fillEllipse(double x, double y, double xRadius, double yRadius);
423 
429  void drawPolyline(const std::vector<Point> & points);
430 
436  void drawClosedPolyline(const std::vector<Point> & points);
437 
443  void fillPolyline(const std::vector<Point> & points);
444 
452  void drawText(double x, double y, const char * text);
453 
460  void drawText(Point p, const char * text);
461 
469  void drawText(double x, double y, const std::string & text);
470 
477  void drawText(Point p, const std::string & str);
478 
486  Board & setFont(const Fonts::Font font, double fontSize);
487 
494  Board & setFontSize(double fontSize);
495 
505  Board & setPenColorRGBi(unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha = 255);
506 
517  Board & setPenColorRGBf(float red, float green, float blue, float alpha = 1.0f);
518 
526  Board & setPenColor(const Color & color);
527 
537  Board & setFillColorRGBi(unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha = 255);
538 
548  Board & setFillColorRGBf(float red, float green, float blue, float alpha = 1.0f);
549 
559  Board & setFillColorHSV(float hue, float saturation, float value, float alpha = 1.0f);
560 
568  Board & setFillColor(const Color & color);
569 
576  Board & setLineWidth(double width);
577 
584  Board & setLineStyle(LineStyle style);
585 
591  inline Board & setLineCap(LineCap cap);
592 
598  inline Board & setLineJoin(LineJoin join);
599 
605  void backgroundColor(const Color & color);
606 
612  void drawBoundingBox(LineWidthFlag lineWidthFlag);
613 
622  void setClippingRectangle(double x, double y, double width, double height);
623 
629  void setClippingRectangle(const Rect & rect);
630 
636  void setClippingPath(const std::vector<Point> & points);
637 
642  void setClippingPath(const Path & path);
643 
654  void addDuplicates(const Shape & shape, std::size_t times, double dx, double dy, double scale = 1.0);
655 
668  void addDuplicates(const Shape & shape, std::size_t times, double dx, double dy, double scaleX, double scaleY, double angle = 0.0);
669 
680  void save(const char * filename, PageSize size = Board::BoundingBox, double margin = 0.0, Unit unit = UMillimeter) const;
681 
693  void save(const char * filename, double pageWidth, double pageHeight, double margin = 0.0, Unit unit = UMillimeter) const;
694 
705  void saveEPS(std::ostream & out, PageSize size = Board::BoundingBox, double margin = 0.0, Unit unit = UMillimeter, const std::string & title = std::string()) const;
706 
717  void saveEPS(const char * filename, PageSize size = Board::BoundingBox, double margin = 0.0, Unit unit = UMillimeter, const std::string & title = std::string()) const;
718 
729  void saveEPS(std::ostream & out, double pageWidth, double pageHeight, double margin = 0.0, Unit unit = UMillimeter, const std::string & title = std::string()) const;
730 
742  void saveEPS(const char * filename, double pageWidth, double pageHeight, double margin = 0.0, Unit unit = UMillimeter, const std::string & title = std::string()) const;
743 
753  void saveFIG(const char * filename, PageSize size = Board::BoundingBox, double margin = 0.0, Unit unit = UMillimeter) const;
754 
764  void saveFIG(std::ostream & out, PageSize size = Board::BoundingBox, double margin = 0.0, Unit unit = UMillimeter) const;
765 
775  void saveFIG(const char * filename, double pageWidth, double pageHeight, double margin = 0.0, Unit unit = UMillimeter) const;
776 
786  void saveFIG(std::ostream & out, double pageWidth, double pageHeight, double margin = 0.0, Unit unit = UMillimeter) const;
787 
797  void saveSVG(const char * filename, PageSize size = Board::BoundingBox, double margin = 0.0, Unit unit = UMillimeter) const;
798 
808  void saveSVG(std::ostream & out, PageSize size = Board::BoundingBox, double margin = 0.0, Unit unit = UMillimeter) const;
809 
819  void saveSVG(const char * filename, double pageWidth, double pageHeight, double margin = 0.0, Unit unit = UMillimeter) const;
820 
830  void saveSVG(std::ostream & out, double pageWidth, double pageHeight, double margin = 0.0, Unit unit = UMillimeter) const;
831 
840  void saveTikZ(const char * filename, PageSize size = Board::BoundingBox, double margin = 0.0) const;
841 
850  void saveTikZ(std::ostream & out, PageSize size = Board::BoundingBox, double margin = 0.0) const;
851 
860  void saveTikZ(const char * filename, double pageWidth, double pageHeight, double margin = 0.0) const;
861 
870  void saveTikZ(std::ostream & out, double pageWidth, double pageHeight, double margin = 0.0) const;
871 
877  inline const Color & penColor() const;
878 
884  inline const Color & fillColor() const;
885 
891  inline const Style & style() const;
892 
896  static void enableLineWidthScaling();
897 
901  static void disableLineWidthScaling();
902 
906  static void setLineWidthScaling(bool);
907 
908 protected:
909  static double toMillimeter(double x, Unit unit);
910 
914  struct State {
916  Fonts::Font font;
917  double fontSize;
918  State();
919  };
922  Path _clippingPath;
923 };
924 
925 // Helper functions
926 
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);
946 
959 Group grid(Point topLeft, size_t columns, size_t rows, double width, double height, const Style & style = Style::defaultStyle());
960 
967 Group cross(Point p, const Style & style = Style::defaultStyle());
968 
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);
981 
991 Group framed(const Shape & shape, const Color & color = Style::defaultPenColor(), double lineWidth = Style::defaultLineWidth(), double margin = 0.0, int sketchyCount = 0);
992 
999 Polyline bezierControls(const Bezier & bezier, const Style & style = Style::defaultStyle());
1000 
1001 // Inline methods and functions
1002 
1003 inline void Board::clear(unsigned char red, unsigned char green, unsigned char blue)
1004 {
1005  clear(Color(red, green, blue));
1006 }
1007 
1008 inline Board & Board::setLineStyle(LineStyle style)
1009 {
1010  _state.style.lineStyle = style;
1011  return *this;
1012 }
1013 
1014 inline Board & Board::setLineCap(LineCap cap)
1015 {
1016  _state.style.lineCap = cap;
1017  return *this;
1018 }
1019 
1020 inline Board & Board::setLineJoin(LineJoin join)
1021 {
1022  _state.style.lineJoin = join;
1023  return *this;
1024 }
1025 
1026 const Color & Board::penColor() const
1027 {
1028  return _state.style.penColor;
1029 }
1030 
1031 const Color & Board::fillColor() const
1032 {
1033  return _state.style.fillColor;
1034 }
1035 
1036 const Style & Board::style() const
1037 {
1038  return _state.style;
1039 }
1040 
1041 inline void Board::fillGouraudTriangle(const double x1, const double y1, const Color & color1, //
1042  const double x2, const double y2, const Color & color2, //
1043  const double x3, const double y3, const Color & color3, //
1044  unsigned char divisions)
1045 {
1046  fillGouraudTriangle(Point(x1, y1), color1, Point(x2, y2), color2, Point(x3, y3), color3, divisions);
1047 }
1048 
1049 inline void Board::fillGouraudTriangle(const double x1, const double y1, const float brightness1, //
1050  const double x2, const double y2, const float brightness2, //
1051  const double x3, const double y3, const float brightness3, //
1052  unsigned char divisions)
1053 {
1054  fillGouraudTriangle(Point(x1, y1), brightness1, Point(x2, y2), brightness2, Point(x3, y3), brightness3, divisions);
1055 }
1056 
1057 } // namespace LibBoard
1058 
1059 // TODO : Add rectangle tilling from a vector of colors (2A array) ( https://github.com/c-koi/libboard/pull/7 )
1060 
1061 #endif
LibBoard::array
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
Shape.h
@copyright This source code is part of the Board project, a C++ library whose purpose is to allow sim...
LibBoard::ShapeList::depthFirstBegin
DepthFirstIterator depthFirstBegin()
depthFirstBegin
Definition: ShapeList.h:645
LibBoard::Polyline::boundingBox
Rect boundingBox(LineWidthFlag) const override
Definition: Polyline.cpp:328
LibBoard::Shape::rotateDeg
Shape & rotateDeg(double angle, const Point &center)
Definition: Shape.h:336
LibBoard::Board::saveEPS
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
LibBoard::Style::defaultPenColor
static const Color & defaultPenColor()
defaultPenColor
Definition: Style.h:281
LibBoard::ShapeList::last
T & last(const std::size_t position=0)
Definition: ShapeList.h:501
LibBoard::ShapeList::topLevelFindLast
T & topLevelFindLast(std::size_t position=0)
Definition: ShapeList.h:518
isSeparing
bool isSeparing(Point &a, Point &b, const std::vector< Point > &points)
isSeparing
Definition: hull.cpp:34
LibBoard::Board::drawRectangle
void drawRectangle(double left, double top, double width, double height)
Definition: Board.cpp:323
LibBoard::Path::scale
Path & scale(double sx, double sy)
Definition: Path.cpp:167
Style.h
@copyright This source code is part of the Board project, a C++ library whose purpose is to allow sim...
LibBoard::Board::rotated
Board rotated(double angle, const Point &center)
Definition: Board.cpp:207
LibBoard::Board::setFillColor
Board & setFillColor(const Color &color)
Definition: Board.cpp:268
LibBoard::Exception
Definition: Exception.h:36
ShapeList.h
ShapeList class.
LibBoard::Arrow::translated
Arrow translated(double dx, double dy) const
Definition: Arrow.cpp:66
LibBoard::Style
Definition: Style.h:69
LibBoard::Group::scale
Group & scale(double sx, double sy) override
Definition: Group.cpp:77
Point.h
The Point structure. @copyright This source code is part of the Board project, a C++ library whose pu...
LibBoard::Group::setClippingPath
void setClippingPath(const std::vector< Point > &points)
Definition: Group.cpp:134
LibBoard::Style::defaultLineWidth
static const double & defaultLineWidth()
defaultLineWidth
Definition: Style.h:276
LibBoard::Polyline
A polygonal line described by a series of 2D points.
Definition: Polyline.h:38
LibBoard::Board::disableLineWidthScaling
static void disableLineWidthScaling()
Definition: Board.cpp:139
LibBoard::Board::saveSVG
void saveSVG(const char *filename, PageSize size=Board::BoundingBox, double margin=0.0, Unit unit=UMillimeter) const
Definition: Board.cpp:758
LibBoard::ShapeList::deepSize
std::size_t deepSize() const
Recursively counts the number of shapes in the list.
Definition: ShapeList.cpp:515
Path.h
@copyright This source code is part of the Board project, a C++ library whose purpose is to allow sim...
LibBoard::Shape::scaleToWidth
Shape & scaleToWidth(double w, LineWidthFlag lineWidthFlag)
Definition: Shape.cpp:85
LibBoard::Group::accept
Group * accept(CompositeShapeTransform &transform) const override
Accept a composite shape transform.
Definition: Group.cpp:221
LibBoard::Board::penColor
const Color & penColor() const
penColor
Definition: Board.h:1026
LibBoard::Board::operator=
Board & operator=(const Board &other)
Definition: Board.cpp:108
LibBoard::mid
Path mid(const Path &a, const Path &b, double time)
Definition: Path.cpp:387
Group.h
Group class.
LibBoard::Arrow
A line between two points with an arrow at one extremity.
Definition: Arrow.h:38
LibBoard::Line::accept
virtual void accept(ShapeVisitor &visitor) override
Accepts a visitor object.
Definition: Line.cpp:200
LibBoard::Style::withLineStyle
Style withLineStyle(LineStyle lineStyle) const
Definition: Style.h:250
LibBoard::Point::normalised
Point normalised() const
Definition: Point.h:403
LibBoard::Board::translated
Board translated(double dx, double dy)
Definition: Board.cpp:217
LibBoard::Board::setFont
Board & setFont(const Fonts::Font font, double fontSize)
Definition: Board.cpp:280
LibBoard::Board::setLineCap
Board & setLineCap(LineCap cap)
Definition: Board.h:1014
LibBoard::Board::scale
Board & scale(double sx, double sy) override
Definition: Board.cpp:176
findAll
ShapeList findAll(ShapeList &list)
Definition: traversal.cpp:68
LibBoard::Rect
Struct representing a rectangle on the plane.
Definition: Rect.h:39
LibBoard::Arrow::ExtremityType
ExtremityType
Definition: Arrow.h:40
LibBoard::ShapeList::push_back
ShapeList & push_back(Shape *shape)
Definition: ShapeList.cpp:441
LibBoard::Board::setClippingPath
void setClippingPath(const std::vector< Point > &points)
Definition: Board.cpp:469
LibBoard::Board::setFillColorRGBi
Board & setFillColorRGBi(unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha=255)
Definition: Board.cpp:250
LibBoard::Line::scale
Line & scale(double sx, double sy) override
Definition: Line.cpp:99
LibBoard::Arrow::Closed
@ Closed
Definition: Arrow.h:43
LibBoard::ShapeList::rotate
ShapeList & rotate(double angle, const Point &center) override
Definition: ShapeList.cpp:301
LibBoard::Polyline::rotated
Polyline rotated(double angle, const Point &center) const
Definition: Polyline.cpp:72
LibBoard::Line::rotated
Line rotated(double angle, const Point &center) const
Definition: Line.cpp:67
LibBoard::ShapeList::depthFirstEnd
DepthFirstIterator depthFirstEnd()
depthFirstEnd
Definition: ShapeList.h:650
PathBoundaries.h
@copyright This source code is part of the Board project, a C++ library whose purpose is to allow sim...
LibBoard::Group::translate
Group & translate(double dx, double dy) override
Definition: Group.cpp:70
RoughVisitor.h
@copyright This source code is part of the Board project, a C++ library whose purpose is to allow sim...
LibBoard::Line::boundingBox
Rect boundingBox(LineWidthFlag) const override
Definition: Line.cpp:242
LibBoard::Arrow::Plain
@ Plain
Definition: Arrow.h:44
BoardFontText.h
Group class.
LibBoard::Board::drawClosedPolyline
void drawClosedPolyline(const std::vector< Point > &points)
Definition: Board.cpp:372
LibBoard::RoughVisitor
Definition: RoughVisitor.h:46
LibBoard::Board::fillPolyline
void fillPolyline(const std::vector< Point > &points)
Definition: Board.cpp:377
LibBoard::Board::_backgroundColor
Color _backgroundColor
Definition: Board.h:921
Exception.h
The Exception type. @copyright This source code is part of the Board project, a C++ library whose pur...
LibBoard::Point::x
double x
Definition: Point.h:43
LibBoard::Dot
A line between two points.
Definition: Dot.h:42
Bezier.h
@copyright This source code is part of the Board project, a C++ library whose purpose is to allow sim...
LibBoard::Text
A piece of text.
Definition: Text.h:40
LibBoard::Board::fillCircle
void fillCircle(double x, double y, double radius)
Definition: Board.cpp:352
LibBoard::Board::State::fontSize
double fontSize
Definition: Board.h:917
LibBoard::Board::drawDot
void drawDot(double x, double y)
Definition: Board.cpp:298
LibBoard::Point
Struct representing a 2D point.
Definition: Point.h:42
Line.h
@copyright This source code is part of the Board project, a C++ library whose purpose is to allow sim...
LibBoard::Shape::moveCenter
Shape & moveCenter(double x, double y, LineWidthFlag lineWidthFlag=IgnoreLineWidth)
Definition: Shape.cpp:64
LibBoard::Board::Board
Board(const Color &backgroundColor=Color::Null)
Definition: Board.cpp:104
LibBoard::ShapeList::BreadthFirstIterator
The BreadthFirstIterator struct allows to traverse the shape tree using a breadth-first strategy.
Definition: ShapeList.h:388
LibBoard::Line
A line between two points.
Definition: Line.h:38
LibBoard::Board::setPenColorRGBi
Board & setPenColorRGBi(unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha=255)
Definition: Board.cpp:232
LibBoard::ShapeList::addTiling
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
LibBoard::Board::drawText
void drawText(double x, double y, const char *text)
Definition: Board.cpp:428
LibBoard::Bezier
A cubice polygonal line described by a series of 2D points.
Definition: Bezier.h:40
LibBoard::Point::rotatedPI2
Point rotatedPI2() const
Definition: Point.h:369
Arrow.h
@copyright This source code is part of the Board project, a C++ library whose purpose is to allow sim...
LibBoard::framed
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
LibBoard::Board::rotate
Board & rotate(double angle, const Point &center) override
Definition: Board.cpp:155
LibBoard::Shape
Abstract structure for a 2D shape.
Definition: Shape.h:63
Image.h
@copyright This source code is part of the Board project, a C++ library whose purpose is to allow sim...
LibBoard::cross
Group cross(Point p, const Style &style=Style::defaultStyle())
Definition: Board.cpp:968
LibBoard::ShapeList::translate
ShapeList & translate(double dx, double dy) override
Definition: ShapeList.cpp:328
LibBoard::Board::setFillColorHSV
Board & setFillColorHSV(float hue, float saturation, float value, float alpha=1.0f)
Definition: Board.cpp:262
LibBoard::Board::_state
State _state
Definition: Board.h:920
LibBoard::Board::enableLineWidthScaling
static void enableLineWidthScaling()
Definition: Board.cpp:134
LibBoard::ShapeList::top
Shape & top()
Definition: ShapeList.cpp:452
LibBoard::Board::setClippingRectangle
void setClippingRectangle(double x, double y, double width, double height)
Definition: Board.cpp:455
LibBoard::Board::fillRectangle
void fillRectangle(double left, double top, double width, double height)
Definition: Board.cpp:333
LibBoard::Point::normalise
Point & normalise()
Definition: Point.h:408
LibBoard::Board::scaled
Board scaled(double sx, double sy)
Definition: Board.cpp:222
LibBoard::Board::saveTikZ
void saveTikZ(const char *filename, PageSize size=Board::BoundingBox, double margin=0.0) const
Definition: Board.cpp:849
LibBoard::ShapeList::translated
ShapeList translated(double dx, double dy)
Definition: ShapeList.cpp:339
LibBoard::Path
A path, according to Postscript and SVG definition.
Definition: Path.h:45
LibBoard::Board::setPenColorRGBf
Board & setPenColorRGBf(float red, float green, float blue, float alpha=1.0f)
Definition: Board.cpp:238
Text.h
@copyright This source code is part of the Board project, a C++ library whose purpose is to allow sim...
LibBoard::Board::drawCircle
void drawCircle(double x, double y, double radius)
Definition: Board.cpp:347
LibBoard::Board::translate
Board & translate(double dx, double dy) override
Definition: Board.cpp:169
LibBoard::Board::fillTriangle
void fillTriangle(double x1, double y1, double x2, double y2, double x3, double y3)
Definition: Board.cpp:394
LibBoard::ShapeList::clear
ShapeList & clear()
Definition: ShapeList.cpp:86
LibBoard::Arrow::Stick
@ Stick
Definition: Arrow.h:42
LibBoard::Board::backgroundColor
void backgroundColor(const Color &color)
Definition: Board.cpp:293
LibBoard::Board::setFontSize
Board & setFontSize(double fontSize)
Definition: Board.cpp:287
LibBoard::Bezier::scaled
Bezier scaled(double sx, double sy) const
Definition: Bezier.cpp:184
LibBoard::Ellipse
An ellipse.
Definition: Ellipse.h:38
LibBoard::Polyline::translated
Polyline translated(double dx, double dy) const
Definition: Polyline.cpp:99
SketchFilter.h
@copyright This source code is part of the Board project, a C++ library whose purpose is to allow sim...
LibBoard::Group
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
LibBoard::Group::rotate
Group & rotate(double angle, const Point &center) override
Definition: Group.cpp:56
LibBoard::Polyline::rotate
Polyline & rotate(double angle, const Point &center) override
Definition: Polyline.cpp:61
LibBoard::RoughVisitor::slideRandomly
static void slideRandomly(Point &point, const double &radius)
Definition: RoughVisitor.cpp:320
LibBoard::ShapeList::size
std::size_t size() const
The number of shapes in the list (at top level).
Definition: ShapeList.h:665
LibBoard::grid
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
LibBoard::Ellipse::translated
Ellipse translated(double dx, double dy) const
Definition: Ellipse.cpp:93
LibBoard::ShapeList
A group of shapes.
Definition: ShapeList.h:46
LibBoard::Board::drawArrow
void drawArrow(double x1, double y1, double x2, double y2, Arrow::ExtremityType type=Arrow::Plain)
Definition: Board.cpp:313
LibBoard::Board::State::style
Style style
Definition: Board.h:915
LibBoard::Board::addDuplicates
void addDuplicates(const Shape &shape, std::size_t times, double dx, double dy, double scale=1.0)
Definition: Board.cpp:490
LibBoard::Board::State
Definition: Board.h:914
LibBoard::ShapeList::scale
ShapeList & scale(double sx, double sy) override
Definition: ShapeList.cpp:344
LibBoard::Shape::center
virtual Point center(LineWidthFlag lineWidthFlag=IgnoreLineWidth) const
Definition: Shape.cpp:59
LibBoard::bezierControls
Polyline bezierControls(const Bezier &bezier, const Style &style=Style::defaultStyle())
Produce a polyline of the Biezer vertices and control points.
Definition: Board.cpp:976
Board.h
Declaration of the Board class.
LibBoard::Board::style
const Style & style() const
Definition: Board.h:1036
LibBoard::Board::clear
void clear(const Color &color=Color::Null)
Definition: Board.cpp:149
LibBoard::ShapeList::rotated
ShapeList rotated(double angle, const Point &center)
Definition: ShapeList.cpp:312
LibBoard::ShapeList::DepthFirstIterator
The DepthFirstIterator struct allows to traverse the shape tree using a depth-first strategy.
Definition: ShapeList.h:366
LibBoard::Board::fillEllipse
void fillEllipse(double x, double y, double xRadius, double yRadius)
Definition: Board.cpp:362
LibBoard::Board
Class for EPS, FIG or SVG drawings.
Definition: Board.h:62
Dot.h
@copyright This source code is part of the Board project, a C++ library whose purpose is to allow sim...
LibBoard::ShapeWithStyleVisitor
Leaf visitor may be used to apply a function on each Shape with style, in back-to-front order.
Definition: ShapeVisitor.h:247
LibBoard::ShapeList::scaled
ShapeList scaled(double sx, double sy) const
Definition: ShapeList.cpp:366
LibBoard::Board::setLineJoin
Board & setLineJoin(LineJoin join)
Definition: Board.h:1020
LibBoard::Board::drawBoundingBox
void drawBoundingBox(LineWidthFlag lineWidthFlag)
Definition: Board.cpp:448
LibBoard::Point::norm
double norm() const
Definition: Point.h:398
LibBoard::Board::State::font
Fonts::Font font
Definition: Board.h:916
LibBoard::Board::operator<<
Board & operator<<(const Shape &shape)
Definition: Board.cpp:126
LibBoard::Board::drawEllipse
void drawEllipse(double x, double y, double xRadius, double yRadius)
Definition: Board.cpp:357
LibBoard::Board::setLineStyle
Board & setLineStyle(LineStyle style)
Definition: Board.h:1008
Polyline.h
@copyright This source code is part of the Board project, a C++ library whose purpose is to allow sim...
Tools.h
@copyright This source code is part of the Board project, a C++ library whose purpose is to allow sim...
LibBoard::Board::drawPolyline
void drawPolyline(const std::vector< Point > &points)
Definition: Board.cpp:367
LibBoard::Board::setLineWidthScaling
static void setLineWidthScaling(bool)
Definition: Board.cpp:144
Ellipse.h
@copyright This source code is part of the Board project, a C++ library whose purpose is to allow sim...
LibBoard::Ellipse::scale
Ellipse & scale(double sx, double sy) override
Definition: Ellipse.cpp:98
LibBoard::Board::save
void save(const char *filename, PageSize size=Board::BoundingBox, double margin=0.0, Unit unit=UMillimeter) const
Definition: Board.cpp:933
LibBoard::Board::drawLine
void drawLine(double x1, double y1, double x2, double y2)
Definition: Board.cpp:303
LibBoard::Point::rotated
Point rotated(double angle) const
Definition: Point.h:351
LibBoard::ShapeList::name
const std::string & name() const override
Definition: ShapeList.cpp:49
LibBoard::Group::boundingBox
Rect boundingBox(LineWidthFlag) const override
Definition: Group.cpp:212
LibBoard::Board::setPenColor
Board & setPenColor(const Color &color)
Definition: Board.cpp:244
LibBoard::Point::y
double y
Definition: Point.h:44
LibBoard::Board::saveFIG
void saveFIG(const char *filename, PageSize size=Board::BoundingBox, double margin=0.0, Unit unit=UMillimeter) const
Definition: Board.cpp:629
LibBoard::Board::fillGouraudTriangle
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
LibBoard::Board::setLineWidth
Board & setLineWidth(double width)
Definition: Board.cpp:274
LibBoard::ShapeList::append
ShapeList & append(const Shape &shape, Direction direction=ShapeList::Right, Alignment alignment=ShapeList::AlignCenter, double margin=0.0, LineWidthFlag lineWidthFlag=UseLineWidth)
Definition: ShapeList.cpp:246
LibBoard::Style::defaultStyle
static const Style & defaultStyle()
defaultStyle
Definition: Style.h:271
Debug.h
The Exception type. @copyright This source code is part of the Board project, a C++ library whose pur...
LibBoard::Board::drawTriangle
void drawTriangle(double x1, double y1, double x2, double y2, double x3, double y3)
Definition: Board.cpp:382
LibBoard::ShapeList::boundingBox
Rect boundingBox(LineWidthFlag) const override
Definition: ShapeList.cpp:419
LibBoard::Board::fillColor
const Color & fillColor() const
fillColor
Definition: Board.h:1031
LibBoard::Image
Structure for a bitmap image shape.
Definition: Image.h:41
LibBoard::Color
Structure representing an RGB triple.
Definition: Color.h:43
LibBoard::Board::setFillColorRGBf
Board & setFillColorRGBf(float red, float green, float blue, float alpha=1.0f)
Definition: Board.cpp:256