#include <ctime>
{
RoughVisitor::slideRandomly(a, 1);
RoughVisitor::slideRandomly(b, 1);
try {
g << *rline;
} catch (const char * message) {
std::cerr << message << std::endl;
}
delete rline;
return g;
}
{
for (double r = 0.0; r <= 1.0; r += 0.1) {
}
return g;
}
{
l.
append(poly, Direction::Right, Alignment::Center);
Arrow arrow(0, 0, 60, 60, Arrow::ExtremityType::Stick, Color::Red, Color::White);
l.
append(arrow, Direction::Right, Alignment::Center);
Ellipse e(0, 0, 15, 25, Color::Red, Color::Brown);
e.rotate(10 * Board::Degree);
l.
append(e, Direction::Right, Alignment::Center);
g.
append(l, Direction::Right, Alignment::Center);
g.
append(
makeRough(l, 1, SketchyCrossingHachure, 25 * Board::Degree), Direction::Bottom, Alignment::Center);
g.
append(
framed(
boardFontText(
Point(0, 0),
"Hello world!", 10, Color::DarkGreen, 1.5), 5.0, Color::Black, Color::Null, 2.0), Direction::Right, Alignment::Center, 5);
return g;
}
{
Style::setDefaultLineWidth(2);
g << p;
g.
append(square, Direction::Right, Alignment::Center, 3);
g.
append(square, Direction::Right, Alignment::Center, 3);
std::swap(path[1], path[2]);
g.
append(square, Direction::Right, Alignment::Center, 3);
path = {
Point(0, 0),
Point(0, 100),
Point(40, 70),
Point(100, 0),
Point(100, 100),
Point(40, 70)};
return g;
}
{
Path path = {
Point(0, 0),
Point(50, 100),
Point(75, 75),
Point(100, 90),
Point(150, 50),
Point(200, 0),
Point(180, 100)};
g <<
hachures(path, StraightHachure, Color::Red, 0.5, 2, 30 * Board::Degree);
return g;
}
{
Style::setDefaultLineWidth(2.5);
Style::setDefaultFillColor(Color::Cyan);
Style::setDefaultPenColor(
Color(20, 20, 20));
g << p;
std::swap(path[1], path[2]);
path = {
Point(0, 0),
Point(0, 100),
Point(40, 70),
Point(100, 0),
Point(100, 100),
Point(40, 70)};
return g;
}
{
Path path = {
Point(0, 0),
Point(0, 100),
Point(40, 70),
Point(100, 0),
Point(100, 100),
Point(40, 70)};
g <<
hachures(path, StraightHachure, Color::Red, 0.5, 2, 0 * Board::Degree);
return g;
}
{
Style::setDefaultLineWidth(0.5);
Ellipse e(0, 0, 60, 30, Color::Red, Color::Green);
e.rotate(35 * Board::Degree);
e.setPenColor(Color::Black);
e.setFillColor(Color::Brown);
eh << e;
g.
append(eh, Direction::Right);
g.
append(
makeRough(e, 2, SketchyHachure, 10 * Board::Degree, 0.0), Direction::Right);
g.
append(
makeRough(e, 1, SketchyCrossingHachure, 45 * Board::Degree, 3.0));
return g;
}
{
auto t = time(nullptr);
Tools::initBoardRand(static_cast<unsigned long>(t));
Board::disableLineWidthScaling();
std::cout << Style::defaultStyle() << std::endl;
board.
append(
makeRough(
polygons(), 2, SketchyHachure, 20 * Board::Degree, 2), Direction::Bottom, Alignment::Center);
board.
append(
rough(), Direction::Right, Alignment::Center);
board.
saveSVG(
"rough.svg", PageSize::BoundingBox);
}
Declaration of the Board class.
The Exception type. @copyright This source code is part of the Board project, a C++ library whose pur...
int main(int argc, char *argv[])
Definition arithmetic.cpp:16
Structure representing an RGB triple.
Definition Color.h:43
Path mix(const Path &a, const Path &b, double time)
Interpolate two paths according to a time (0 is a, 1 is b)
Definition Path.cpp:390
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
ShapeList makeRough(const Shape &shape, int repeat=1, SketchFilling filling=PlainFilling, double hachureAngle=0.0, double hachureSpacing=0.0)
Definition SketchFilter.cpp:171
Polyline rectangle(double left, double top, double width, double height, Color penColor=Style::defaultPenColor(), Color fillColor=Style::defaultFillColor(), double lineWidth=Style::defaultLineWidth(), const LineStyle lineStyle=Style::defaultLineStyle(), const LineCap cap=Style::defaultLineCap(), const LineJoin join=Style::defaultLineJoin())
Definition Polyline.cpp:569
Group framed(const Shape &shape, double margin=0.0, const Color &penColor=Style::defaultPenColor(), const Color &fillColor=Style::defaultFillColor(), double lineWidth=Style::defaultLineWidth(), LineStyle lineStyle=Style::defaultLineStyle(), int sketchyCount=0)
Surround a shape with a rectangular frame.
Definition Board.cpp:1081
Group boardFontText(Point baselineStart, const std::string &text, double size, Color penColor=Style::defaultPenColor(), double lineWidth=0.0)
Create a text with board's font.
Definition BoardFontText.cpp:320
Group rough()
Definition rough.cpp:52
Group hachures()
Definition rough.cpp:71
Group diamond()
Definition rough.cpp:41
Group hachuresBis()
Definition rough.cpp:108
Group slide()
Definition rough.cpp:16
Group ell()
Definition rough.cpp:150
Group polygons()
Definition rough.cpp:117
Group hachuresTer()
Definition rough.cpp:141
A line between two points with an arrow at one extremity.
Definition Arrow.h:38
A Bezier curve described by two series of 2D points (curve points and control points).
Definition Bezier.h:42
Bezier rotated(double angle, const Point ¢er) const
Rotated copy of the curve.
Definition Bezier.cpp:119
Class for EPS, FIG or SVG drawings.
Definition Board.h:61
Board & setPenColor(const Color &color)
Definition Board.cpp:244
Board & setFillColor(const Color &color)
Definition Board.cpp:268
Board & setLineWidth(double width)
Definition Board.cpp:274
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
virtual void accept(ShapeVisitor &visitor) override
Accepts a visitor object.
Definition Line.cpp:200
A path, according to Postscript and SVG definition.
Definition Path.h:45
void close()
Close the path.
Definition Path.h:453
Struct representing a 2D point.
Definition Point.h:42
A polygonal line described by a series of 2D points.
Definition Polyline.h:38
const Path & path() const
Definition Polyline.h:461
Polyline & rotate(double angle, const Point ¢er) override
Definition Polyline.cpp:61
Definition RoughVisitor.h:46
void setRepeat(int n)
Definition RoughVisitor.cpp:47
A group of shapes.
Definition ShapeList.h:47
ShapeList & append(const Shape &shape, Direction direction=Direction::Right, Alignment alignment=Alignment::Center, double margin=0.0, LineWidthFlag lineWidthFlag=UseLineWidth)
Definition ShapeList.cpp:232
Abstract structure for a 2D shape.
Definition Shape.h:64
Color penColor
Definition Style.h:70