Board 0.9.6
examples/tilings.cpp
#include <Board.h>
using namespace LibBoard;
int main(int, char *[])
{
Board board;
board.clear(Color::White);
Style::setDefaultLineWidth(0.1);
Style::setDefaultLineStyle(SolidStyle);
Style::setDefaultLineCap(RoundCap);
Style::setDefaultLineJoin(RoundJoin);
Group g;
g << circle(10, 10, 20, Color::Blue, Color::Null);
Group grid;
grid << Line(0, 0, 100, 0, Color::Blue);
grid << Line(0, 0, 0, -200, Color::Blue);
Polyline l(Path::Open, Color::Blue, Color::Null);
l << Point(-10, 0) << Point(0, 0) << Point(0, 10);
grid << tiling(l, Point(0, 0), 10, 20, 0.0, IgnoreLineWidth);
grid.rotateDeg(45);
board << grid;
Ellipse circle = LibBoard::circle(10, 10, 20, Color::Blue, Color::Null, 1.0);
Rect bbox = board.boundingBox(UseLineWidth);
Line separator(bbox.topRight(), bbox.bottomRight(), Color::Black);
board.append(separator, Direction::Right, Alignment::Center);
board.append(circle, Direction::Right, Alignment::Top);
board.append(separator, Direction::Right, Alignment::Center);
board.append(circle, Direction::Right, Alignment::Center);
board.append(separator, Direction::Right, Alignment::Center);
board.append(circle, Direction::Right, Alignment::Bottom);
bbox = board.boundingBox(UseLineWidth);
separator = Line(bbox.bottomLeft(), bbox.bottomRight(), Color::Black);
board.append(separator, Direction::Bottom, Alignment::Left);
board.append(circle, Direction::Bottom, Alignment::Left);
board.append(separator, Direction::Bottom, Alignment::Left);
board.append(circle, Direction::Bottom, Alignment::Center);
board.append(separator, Direction::Bottom, Alignment::Left);
board.append(circle, Direction::Bottom, Alignment::Right);
board.append(separator, Direction::Bottom, Alignment::Left);
bbox = board.boundingBox(UseLineWidth);
separator = Line(bbox.topRight(), bbox.bottomRight(), Color::Black);
board.append(separator, Direction::Right, Alignment::Center);
board.append(LibBoard::grid(Point(0, 0), 12, 6, 120, 60, Color::Red, Color::Null, 0.5, SolidStyle, ButtCap, RoundJoin), Direction::Right, Alignment::Center);
board.saveEPS("tilings.eps");
board.scaleToWidth(25, UseLineWidth);
board.saveSVG("tilings.svg", PageSize::BoundingBox, 0.0, Unit::Centimeter);
}
Declaration of the Board class.
int main(int argc, char *argv[])
Definition arithmetic.cpp:16
Definition Board.h:55
Ellipse circle(double x, double y, double radius, Color penColor=Style::defaultPenColor(), Color fillColor=Style::defaultFillColor(), double lineWidth=Style::defaultLineWidth(), const LineStyle lineStyle=Style::defaultLineStyle())
Definition Ellipse.cpp:371
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:967
Class for EPS, FIG or SVG drawings.
Definition Board.h:61
void saveEPS(std::ostream &out, PageSize size=PageSize::BoundingBox, double margin=0.0, Unit unit=Unit::Millimeter, const std::string &title=std::string()) const
Definition Board.cpp:539
void clear(const Color &color=Color::Null)
Definition Board.cpp:149
void saveSVG(const char *filename, PageSize size=PageSize::BoundingBox, double margin=0.0, Unit unit=Unit::Millimeter) const
Definition Board.cpp:765
An ellipse.
Definition Ellipse.h:38
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
A line between two points.
Definition Line.h:38
Struct representing a 2D point.
Definition Point.h:42
A polygonal line described by a series of 2D points.
Definition Polyline.h:38
Struct representing a rectangle on the plane.
Definition Rect.h:40
Point bottomLeft() const
bottomLeft Bottom-left point of the rectangle
Definition Rect.h:89
Point bottomRight() const
bottomRight Bottom-right point of the rectangle
Definition Rect.h:95
Point topRight() const
topRight Top-right point of the rectangle
Definition Rect.h:83
Rect boundingBox(LineWidthFlag) const override
Definition ShapeList.cpp:405
ShapeList & append(const Shape &shape, Direction direction=Direction::Right, Alignment alignment=Alignment::Center, double margin=0.0, LineWidthFlag lineWidthFlag=UseLineWidth)
Definition ShapeList.cpp:232
Shape & rotateDeg(double angle, const Point &center)
Definition Shape.h:337
Shape & scaleToWidth(double w, LineWidthFlag lineWidthFlag)
Definition Shape.cpp:85