Board  0.9.5
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);
grid << Line(0, 0, 100, 0, Color::Blue);
grid << Line(0, 0, 0, -200, Color::Blue);
Polyline l(Path::OpenPath, Color::Blue, Color::Null);
l << Point(-10, 0) << Point(0, 0) << Point(0, 10);
grid.addTiling(l, Point(0, 0), 10, 20, 0.0, IgnoreLineWidth);
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, ShapeList::Right, ShapeList::AlignCenter);
board.append(circle, ShapeList::Right, ShapeList::AlignTop);
board.append(separator, ShapeList::Right, ShapeList::AlignCenter);
board.append(circle, ShapeList::Right, ShapeList::AlignCenter);
board.append(separator, ShapeList::Right, ShapeList::AlignCenter);
board.append(circle, ShapeList::Right, ShapeList::AlignBottom);
bbox = board.boundingBox(UseLineWidth);
separator = Line(bbox.bottomLeft(), bbox.bottomRight(), Color::Black);
board.append(separator, ShapeList::Bottom, ShapeList::AlignLeft);
board.append(circle, ShapeList::Bottom, ShapeList::AlignLeft);
board.append(separator, ShapeList::Bottom, ShapeList::AlignLeft);
board.append(circle, ShapeList::Bottom, ShapeList::AlignCenter);
board.append(separator, ShapeList::Bottom, ShapeList::AlignLeft);
board.append(circle, ShapeList::Bottom, ShapeList::AlignRight);
board.append(separator, ShapeList::Bottom, ShapeList::AlignLeft);
bbox = board.boundingBox(UseLineWidth);
separator = Line(bbox.topRight(), bbox.bottomRight(), Color::Black);
board.append(separator, ShapeList::Right, ShapeList::AlignCenter);
board.append(LibBoard::grid(Point(0, 0), 12, 6, 120, 60, Color::Red, Color::Null, 0.5, SolidStyle, ButtCap, RoundJoin), ShapeList::Right, ShapeList::AlignCenter);
board.saveEPS("tilings.eps");
board.scaleToWidth(25, UseLineWidth);
board.saveSVG("tilings.svg", Board::BoundingBox, 0.0, Board::UCentimeter);
}
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::Polyline
A polygonal line described by a series of 2D points.
Definition: Polyline.h:38
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::Shape::scaleToWidth
Shape & scaleToWidth(double w, LineWidthFlag lineWidthFlag)
Definition: Shape.cpp:85
LibBoard::Rect
Struct representing a rectangle on the plane.
Definition: Rect.h:39
LibBoard::Point
Struct representing a 2D point.
Definition: Point.h:42
LibBoard::Line
A line between two points.
Definition: Line.h:38
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::grid
Group grid(Point topLeft, size_t columns, size_t rows, double width, double height, const Style &style=Style::defaultStyle())
Definition: Board.cpp:963
LibBoard::Ellipse
An ellipse.
Definition: Ellipse.h:38
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::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
Board.h
Declaration of the Board class.
LibBoard::Board::clear
void clear(const Color &color=Color::Null)
Definition: Board.cpp:149
LibBoard::Board
Class for EPS, FIG or SVG drawings.
Definition: Board.h:62
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::ShapeList::boundingBox
Rect boundingBox(LineWidthFlag) const override
Definition: ShapeList.cpp:419