Board  0.9.5
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Static Protected Member Functions | Protected Attributes | List of all members
LibBoard::Board Struct Reference

Class for EPS, FIG or SVG drawings. More...

#include <Board.h>

Inheritance diagram for LibBoard::Board:
LibBoard::ShapeList LibBoard::Shape

Classes

struct  State
 

Public Types

enum  PageSize {
  BoundingBox = 0, A0, A1, A2,
  A3, A4, A5, A6,
  A7, A8, A9, A10,
  Letter, Legal, Executive
}
 
enum  Unit { UPoint, UInche, UCentimeter, UMillimeter }
 
enum  AspectRatioFlag { IgnoreAspectRatio, KeepAspectRatio }
 
- Public Types inherited from LibBoard::ShapeList
enum  Direction { Top, Right, Bottom, Left }
 
enum  Alignment {
  AlignTop, AlignBottom, AlignCenter, AlignLeft,
  AlignRight
}
 
typedef std::vector< Shape * >::size_type size_type
 

Public Member Functions

 Board (const Color &backgroundColor=Color::Null)
 
 Board (const Board &other)
 
Boardoperator= (const Board &other)
 
Boardoperator<< (const Shape &shape)
 
void clear (const Color &color=Color::Null)
 
void clear (unsigned char red, unsigned char green, unsigned char blue)
 
Boardrotate (double angle, const Point &center) override
 
Boardrotate (double angle) override
 
Boardtranslate (double dx, double dy) override
 
Boardscale (double sx, double sy) override
 
Boardscale (double s) override
 
Board rotated (double angle, const Point &center)
 
Board rotated (double angle)
 
Board translated (double dx, double dy)
 
Board scaled (double sx, double sy)
 
Board scaled (double s)
 
void drawDot (double x, double y)
 
void drawLine (double x1, double y1, double x2, double y2)
 
void drawLine (Point p, Point q)
 
void drawArrow (double x1, double y1, double x2, double y2, Arrow::ExtremityType type=Arrow::Plain)
 
void drawArrow (Point p, Point q, Arrow::ExtremityType type=Arrow::Plain)
 
void drawTriangle (double x1, double y1, double x2, double y2, double x3, double y3)
 
void drawTriangle (const Point &p1, const Point &p2, const Point &p3)
 
void fillTriangle (double x1, double y1, double x2, double y2, double x3, double y3)
 
void fillGouraudTriangle (const Point &p1, const Color &color1, const Point &p2, const Color &color2, const Point &p3, const Color &color3, unsigned char divisions=3)
 
void fillGouraudTriangle (const double x1, const double y1, const Color &color1, const double x2, const double y2, const Color &color2, const double x3, const double y3, const Color &color3, unsigned char divisions=3)
 
void fillGouraudTriangle (const Point &p1, const float brightness1, const Point &p2, const float brightness2, const Point &p3, const float brightness3, unsigned char divisions=3)
 
void fillGouraudTriangle (const double x1, const double y1, const float brightness1, const double x2, const double y2, const float brightness2, const double x3, const double y3, const float brightness3, unsigned char divisions=3)
 
void fillTriangle (const Point &p1, const Point &p2, const Point &p3)
 
void drawRectangle (double left, double top, double width, double height)
 
void drawRectangle (const Rect &rect)
 
void fillRectangle (double left, double top, double width, double height)
 
void fillRectangle (const Rect &rect)
 
void drawCircle (double x, double y, double radius)
 
void fillCircle (double x, double y, double radius)
 
void drawEllipse (double x, double y, double xRadius, double yRadius)
 
void fillEllipse (double x, double y, double xRadius, double yRadius)
 
void drawPolyline (const std::vector< Point > &points)
 
void drawClosedPolyline (const std::vector< Point > &points)
 
void fillPolyline (const std::vector< Point > &points)
 
void drawText (double x, double y, const char *text)
 
void drawText (Point p, const char *text)
 
void drawText (double x, double y, const std::string &text)
 
void drawText (Point p, const std::string &str)
 
BoardsetFont (const Fonts::Font font, double fontSize)
 
BoardsetFontSize (double fontSize)
 
BoardsetPenColorRGBi (unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha=255)
 
BoardsetPenColorRGBf (float red, float green, float blue, float alpha=1.0f)
 
BoardsetPenColor (const Color &color)
 
BoardsetFillColorRGBi (unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha=255)
 
BoardsetFillColorRGBf (float red, float green, float blue, float alpha=1.0f)
 
BoardsetFillColorHSV (float hue, float saturation, float value, float alpha=1.0f)
 
BoardsetFillColor (const Color &color)
 
BoardsetLineWidth (double width)
 
BoardsetLineStyle (LineStyle style)
 
BoardsetLineCap (LineCap cap)
 
BoardsetLineJoin (LineJoin join)
 
void backgroundColor (const Color &color)
 
void drawBoundingBox (LineWidthFlag lineWidthFlag)
 
void setClippingRectangle (double x, double y, double width, double height)
 
void setClippingRectangle (const Rect &rect)
 
void setClippingPath (const std::vector< Point > &points)
 
void setClippingPath (const Path &path)
 
void addDuplicates (const Shape &shape, std::size_t times, double dx, double dy, double scale=1.0)
 
void addDuplicates (const Shape &shape, std::size_t times, double dx, double dy, double scaleX, double scaleY, double angle=0.0)
 
void save (const char *filename, PageSize size=Board::BoundingBox, double margin=0.0, Unit unit=UMillimeter) const
 
void save (const char *filename, double pageWidth, double pageHeight, double margin=0.0, Unit unit=UMillimeter) const
 
void saveEPS (std::ostream &out, PageSize size=Board::BoundingBox, double margin=0.0, Unit unit=UMillimeter, const std::string &title=std::string()) const
 
void saveEPS (const char *filename, PageSize size=Board::BoundingBox, double margin=0.0, Unit unit=UMillimeter, const std::string &title=std::string()) const
 
void saveEPS (std::ostream &out, double pageWidth, double pageHeight, double margin=0.0, Unit unit=UMillimeter, const std::string &title=std::string()) const
 
void saveEPS (const char *filename, double pageWidth, double pageHeight, double margin=0.0, Unit unit=UMillimeter, const std::string &title=std::string()) const
 
void saveFIG (const char *filename, PageSize size=Board::BoundingBox, double margin=0.0, Unit unit=UMillimeter) const
 
void saveFIG (std::ostream &out, PageSize size=Board::BoundingBox, double margin=0.0, Unit unit=UMillimeter) const
 
void saveFIG (const char *filename, double pageWidth, double pageHeight, double margin=0.0, Unit unit=UMillimeter) const
 
void saveFIG (std::ostream &out, double pageWidth, double pageHeight, double margin=0.0, Unit unit=UMillimeter) const
 
void saveSVG (const char *filename, PageSize size=Board::BoundingBox, double margin=0.0, Unit unit=UMillimeter) const
 
void saveSVG (std::ostream &out, PageSize size=Board::BoundingBox, double margin=0.0, Unit unit=UMillimeter) const
 
void saveSVG (const char *filename, double pageWidth, double pageHeight, double margin=0.0, Unit unit=UMillimeter) const
 
void saveSVG (std::ostream &out, double pageWidth, double pageHeight, double margin=0.0, Unit unit=UMillimeter) const
 
void saveTikZ (const char *filename, PageSize size=Board::BoundingBox, double margin=0.0) const
 
void saveTikZ (std::ostream &out, PageSize size=Board::BoundingBox, double margin=0.0) const
 
void saveTikZ (const char *filename, double pageWidth, double pageHeight, double margin=0.0) const
 
void saveTikZ (std::ostream &out, double pageWidth, double pageHeight, double margin=0.0) const
 
const ColorpenColor () const
 penColor More...
 
const ColorfillColor () const
 fillColor More...
 
const Stylestyle () const
 
- Public Member Functions inherited from LibBoard::ShapeList
 ShapeList (const ShapeList &other)
 
ShapeListoperator= (const ShapeList &other)
 
 ShapeList (ShapeList &&other)
 
ShapeListoperator= (ShapeList &&other)
 
 ShapeList (const Shape &shape, unsigned int times, double dx, double dy, double scale)
 
 ShapeList (const Shape &shape, unsigned int times, double dx, double dy, double scaleX, double scaleY, double angle)
 
const std::string & name () const override
 
ShapeListclear ()
 
ShapeListrotate (double angle, const Point &center) override
 
ShapeList rotated (double angle, const Point &center)
 
ShapeListrotate (double angle) override
 
ShapeList rotated (double angle)
 
ShapeListtranslate (double dx, double dy) override
 
ShapeList translated (double dx, double dy)
 
ShapeListscale (double sx, double sy) override
 
ShapeListscale (double s) override
 
ShapeList scaled (double sx, double sy) const
 
ShapeList scaled (double s) const
 
void scaleAll (double s) override
 
void flushPostscript (std::ostream &stream, const TransformEPS &transform) const override
 
void flushFIG (std::ostream &stream, const TransformFIG &transform, std::map< Color, int > &colormap) const override
 
void flushSVG (std::ostream &stream, const TransformSVG &transform) const override
 
void flushTikZ (std::ostream &stream, const TransformTikZ &transform) const override
 
Rect boundingBox (LineWidthFlag) const override
 
ShapeListclone () const override
 
ShapeListpush_back (Shape *shape)
 
ShapeListoperator<< (const Shape &shape)
 
ShapeListoperator+= (const Shape &shape)
 
ShapeListappend (const Shape &shape, Direction direction=ShapeList::Right, Alignment alignment=ShapeList::AlignCenter, double margin=0.0, LineWidthFlag lineWidthFlag=UseLineWidth)
 
GroupaddTiling (const Shape &shape, Point topLeftCorner, std::size_t columns, std::size_t rows, double spacing=0.0, LineWidthFlag lineWidthFlag=UseLineWidth)
 
void repeat (const Shape &shape, unsigned int times, double dx, double dy, double scaleX=1.0, double scaleY=1.0, double angle=0.0)
 
ShapeListdup (std::size_t copies=1)
 
template<typename T >
T & last (const std::size_t position=0)
 
Shapelast (const std::size_t position=0)
 
template<typename T >
T & topLevelFindLast (std::size_t position=0)
 
Shapetop ()
 
void accept (ShapeVisitor &visitor) override
 Accepts a visitor object. More...
 
void accept (const ShapeVisitor &visitor) override
 Accepts a visitor object. More...
 
void accept (ConstShapeVisitor &visitor) const override
 Accepts a const-shape visitor object. More...
 
void accept (const ConstShapeVisitor &visitor) const override
 Accepts a const-shape visitor object. More...
 
Shapeaccept (CompositeShapeTransform &transform) const override
 Accept a composite shape transform. More...
 
Shapeaccept (const CompositeShapeTransform &transform) const override
 Accept a constant composite shape transform. More...
 
TopLevelIterator begin ()
 begin More...
 
TopLevelIterator end ()
 end More...
 
TopLevelConstIterator begin () const
 begin More...
 
TopLevelConstIterator cbegin () const
 cbegin More...
 
TopLevelConstIterator end () const
 end More...
 
TopLevelConstIterator cend () const
 cend More...
 
DepthFirstIterator depthFirstBegin ()
 depthFirstBegin More...
 
DepthFirstIterator depthFirstEnd ()
 depthFirstEnd More...
 
BreadthFirstIterator breadthFirstBegin ()
 breadthFirstBegin More...
 
BreadthFirstIterator breadthFirstEnd ()
 breadthFirstEnd More...
 
std::size_t deepSize () const
 Recursively counts the number of shapes in the list. More...
 
std::size_t size () const
 The number of shapes in the list (at top level). More...
 
- Public Member Functions inherited from LibBoard::Shape
 Shape ()
 
virtual ~Shape ()
 
virtual Point center (LineWidthFlag lineWidthFlag=IgnoreLineWidth) const
 
ShaperotateDeg (double angle, const Point &center)
 
ShaperotateDeg (double angle)
 
ShapemoveCenter (double x, double y, LineWidthFlag lineWidthFlag=IgnoreLineWidth)
 
ShapemoveCenter (Point p, LineWidthFlag lineWidthFlag=IgnoreLineWidth)
 
Shaperesize (double width, double height, LineWidthFlag lineWidthFlag)
 
ShapescaleToWidth (double w, LineWidthFlag lineWidthFlag)
 
ShapescaleToHeight (double h, LineWidthFlag lineWidthFlag)
 
Rect bbox (LineWidthFlag) const
 
 Shape (const Shape &other)
 

Static Public Member Functions

static void enableLineWidthScaling ()
 
static void disableLineWidthScaling ()
 
static void setLineWidthScaling (bool)
 

Static Public Attributes

static const double Degree = 3.14159265358979323846 / 180.0
 

Static Protected Member Functions

static double toMillimeter (double x, Unit unit)
 

Protected Attributes

State _state
 
Color _backgroundColor
 
Path _clippingPath
 
- Protected Attributes inherited from LibBoard::ShapeList
std::vector< Shape * > _shapes
 

Additional Inherited Members

- Protected Member Functions inherited from LibBoard::ShapeList
void addShape (const Shape &shape, double scaleFactor)
 
void deleteShapes ()
 

Detailed Description

Class for EPS, FIG or SVG drawings.

The Board class.

Version
0.5
Examples
examples/arithmetic.cpp, examples/arrows.cpp, examples/bezier.cpp, examples/clipping.cpp, examples/ellipse.cpp, examples/example1.cpp, examples/example2.cpp, examples/example3.cpp, examples/example4.cpp, examples/fern.cpp, examples/flag.cpp, examples/graph.cpp, examples/holes.cpp, examples/hull.cpp, examples/images.cpp, examples/koch.cpp, examples/line_segment.cpp, examples/line_style.cpp, examples/logo.cpp, examples/ruler.cpp, examples/scale_ellipse.cpp, examples/stroke_path.cpp, examples/tilings.cpp, and examples/traversal.cpp.

Constructor & Destructor Documentation

◆ Board() [1/2]

LibBoard::Board::Board ( const Color backgroundColor = Color::Null)

Constructs a new board and sets the background color, if any.

Parameters
backgroundColorA color for the drawing's background.

Referenced by rotated(), scaled(), and translated().

◆ Board() [2/2]

LibBoard::Board::Board ( const Board other)

Copy constructor.

Parameters
otherThe object to be copied.

Member Function Documentation

◆ addDuplicates() [1/2]

void LibBoard::Board::addDuplicates ( const Shape shape,
std::size_t  times,
double  dx,
double  dy,
double  scale = 1.0 
)

Insert duplicates of a shape, n times, starting at its current position and iterating given translations and scalings.

Parameters
shapeThe shape to be duplicated.
timesThe number of duplicates.
dxThe x shift.
dyThe y shift.
scaleA scale factor between each copy.
Examples
examples/clipping.cpp, examples/logo.cpp, examples/ruler.cpp, and examples/scale_ellipse.cpp.

References LibBoard::Shape::clone(), scale(), LibBoard::Shape::scale(), and LibBoard::Shape::translate().

◆ addDuplicates() [2/2]

void LibBoard::Board::addDuplicates ( const Shape shape,
std::size_t  times,
double  dx,
double  dy,
double  scaleX,
double  scaleY,
double  angle = 0.0 
)

Insert duplicates of a shape, n times, starting at its current position and iterating a given translation.

Parameters
shapeThe shape to be duplicated.
timesThe number of duplicates.
dxThe x shift.
dyThe y shift.
scaleXAn x scale factor between each copy.
scaleYA y scale factor between each copy.
angleAn angular increment.

References LibBoard::Shape::clone(), LibBoard::Shape::rotate(), LibBoard::Shape::scale(), and LibBoard::Shape::translate().

◆ backgroundColor()

void LibBoard::Board::backgroundColor ( const Color color)

Changes the background color of the whole drawing.

Parameters
colorA color (may be Color::None).

References _backgroundColor.

◆ clear() [1/2]

void LibBoard::Board::clear ( const Color color = Color::Null)

◆ clear() [2/2]

void LibBoard::Board::clear ( unsigned char  red,
unsigned char  green,
unsigned char  blue 
)
inline

Clears the board and set the background color from an RGB triple.

Parameters
red
green
blue

References LibBoard::ShapeList::clear().

◆ disableLineWidthScaling()

void LibBoard::Board::disableLineWidthScaling ( )
static

◆ drawArrow() [1/2]

void LibBoard::Board::drawArrow ( double  x1,
double  y1,
double  x2,
double  y2,
Arrow::ExtremityType  type = Arrow::Plain 
)

Draws a line from (x1,y1) to (x2,y2) with an arrow at (x2,y2) using current style parameters.

Parameters
x1First coordinate of the first extremity.
y1Second coordinate of the first extremity.
x2First coordinate of the second extremity.
y2Second coordinate of the second extremity.
typeThe arrow extremity type.
Examples
examples/arrows.cpp, examples/example1.cpp, and examples/line_segment.cpp.

References LibBoard::ShapeList::_shapes, _state, and LibBoard::Board::State::style.

◆ drawArrow() [2/2]

void LibBoard::Board::drawArrow ( Point  p,
Point  q,
Arrow::ExtremityType  type = Arrow::Plain 
)

Draws a line from p to q with an arrow at (x2,y2).

Parameters
pFirst extremity.
qSecond extremity.
typeThe arrow extremity type.

References LibBoard::ShapeList::_shapes, _state, and LibBoard::Board::State::style.

◆ drawBoundingBox()

void LibBoard::Board::drawBoundingBox ( LineWidthFlag  lineWidthFlag)

Draws the current drawing's bounding box as a rectangle.

Parameters
lineWidthFlagShould the line width be considered when computing bounding boxes.

References LibBoard::Shape::bbox(), and LibBoard::ShapeList::boundingBox().

◆ drawCircle()

void LibBoard::Board::drawCircle ( double  x,
double  y,
double  radius 
)

Draws a circle.

Parameters
xFirst coordinate of the circle's center.
ySecond coordinate of the circle's center.
radiusRadius of the circle.
Examples
examples/example2.cpp, and examples/fern.cpp.

References LibBoard::ShapeList::_shapes.

◆ drawClosedPolyline()

void LibBoard::Board::drawClosedPolyline ( const std::vector< Point > &  points)

Draws a closed polygonal line.

Parameters
pointsA vector of points.

References LibBoard::ShapeList::_shapes, _state, and LibBoard::Board::State::style.

◆ drawDot()

void LibBoard::Board::drawDot ( double  x,
double  y 
)

Draws a dot at coordinates (x,y).

Parameters
xFirst coordinate of the dot.
ySecond coordinate of the dot.
Examples
examples/arrows.cpp, and examples/example4.cpp.

References LibBoard::ShapeList::_shapes, _state, and LibBoard::Board::State::style.

◆ drawEllipse()

void LibBoard::Board::drawEllipse ( double  x,
double  y,
double  xRadius,
double  yRadius 
)

Draws an ellipse.

Parameters
xFirst coordinate of the circle's center.
ySecond coordinate of the circle's center.
xRadiusRadius of the circle along the x axis.
yRadiusRadius of the circle along the y axis.
Examples
examples/example2.cpp.

References LibBoard::ShapeList::_shapes, _state, and LibBoard::Board::State::style.

◆ drawLine() [1/2]

void LibBoard::Board::drawLine ( double  x1,
double  y1,
double  x2,
double  y2 
)

Draws a line from (x1,y1) to (x2,y2) using current style parameters.

Parameters
x1First coordinate of the first extremity.
y1Second coordinate of the first extremity.
x2First coordinate of the second extremity.
y2Second coordinate of the second extremity.
Examples
examples/line_segment.cpp, and examples/logo.cpp.

References LibBoard::ShapeList::_shapes, _state, and LibBoard::Board::State::style.

◆ drawLine() [2/2]

void LibBoard::Board::drawLine ( Point  p,
Point  q 
)

Draws a line from p to q using current style parameters.

Parameters
pFirst extremity.
qSecond extremity.

References LibBoard::ShapeList::_shapes, _state, and LibBoard::Board::State::style.

◆ drawPolyline()

void LibBoard::Board::drawPolyline ( const std::vector< Point > &  points)

Draws a polygonal line.

Parameters
pointsA vector of points.
Examples
examples/example1.cpp, and examples/example2.cpp.

References LibBoard::ShapeList::_shapes, _state, and LibBoard::Board::State::style.

◆ drawRectangle() [1/2]

void LibBoard::Board::drawRectangle ( const Rect rect)

Draws a rectangle.

Parameters
rectPosition and size of the rectangle.

References LibBoard::ShapeList::_shapes.

◆ drawRectangle() [2/2]

void LibBoard::Board::drawRectangle ( double  left,
double  top,
double  width,
double  height 
)

Draws a rectangle.

Parameters
leftFirst coordinate of the upper left corner.
topSecond coordinate of the upper left corner.
widthWidth of the rectangle.
heightHeight of the rectangle.
Examples
examples/arithmetic.cpp, examples/example2.cpp, examples/line_segment.cpp, and examples/line_style.cpp.

References LibBoard::ShapeList::_shapes.

◆ drawText() [1/4]

void LibBoard::Board::drawText ( double  x,
double  y,
const char *  text 
)

Draws a string of text.

Parameters
xThe first coordinates of the lower left corner.
yThe second coordinates of the lower left corner.
textThe text.
Examples
examples/arithmetic.cpp, examples/arrows.cpp, examples/example2.cpp, and examples/ruler.cpp.

References LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::font, LibBoard::Board::State::fontSize, and LibBoard::Board::State::style.

◆ drawText() [2/4]

void LibBoard::Board::drawText ( double  x,
double  y,
const std::string &  text 
)

Draws a string of text.

Parameters
xThe first coordinates of the lower left corner.
yThe second coordinates of the lower left corner.
textThe text.

References LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::font, LibBoard::Board::State::fontSize, and LibBoard::Board::State::style.

◆ drawText() [3/4]

void LibBoard::Board::drawText ( Point  p,
const char *  text 
)

Draws a string of text.

Parameters
pPosition of the bottom-left corner.
textThe text.

References LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::font, LibBoard::Board::State::fontSize, and LibBoard::Board::State::style.

◆ drawText() [4/4]

void LibBoard::Board::drawText ( Point  p,
const std::string &  str 
)

Draws a string of text.

Parameters
pPosition of the bottom-left corner.
strThe text.

References LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::font, LibBoard::Board::State::fontSize, and LibBoard::Board::State::style.

◆ drawTriangle() [1/2]

void LibBoard::Board::drawTriangle ( const Point p1,
const Point p2,
const Point p3 
)

Draws a triangle.

Parameters
p1First vertex.
p2Second vertex.
p3Third vertex.

References LibBoard::ShapeList::_shapes, _state, and LibBoard::Board::State::style.

◆ drawTriangle() [2/2]

void LibBoard::Board::drawTriangle ( double  x1,
double  y1,
double  x2,
double  y2,
double  x3,
double  y3 
)

Draws a triangle.

Parameters
x1First coordinate of the first vertex.
y1Second coordinate of the first vertex.
x2First coordinate of the second vertex.
y2Second coordinate of the second vertex.
x3First coordinate of the third vertex.
y3Second coordinate of the third vertex.
Examples
examples/example2.cpp.

References LibBoard::ShapeList::_shapes, _state, and LibBoard::Board::State::style.

◆ enableLineWidthScaling()

void LibBoard::Board::enableLineWidthScaling ( )
static

Globally enable linewidth scaling when using scale functions.

Examples
examples/holes.cpp, examples/logo.cpp, and examples/stroke_path.cpp.

References LibBoard::ShapeWithStyle::setLineWidthScaling().

◆ fillCircle()

void LibBoard::Board::fillCircle ( double  x,
double  y,
double  radius 
)

Draws a circle filled with the current pen color.

Parameters
xFirst coordinate of the circle's center.
ySecond coordinate of the circle's center.
radiusRadius of the circle.
Examples
examples/example2.cpp, and examples/line_segment.cpp.

References LibBoard::ShapeList::_shapes.

◆ fillColor()

const Color & LibBoard::Board::fillColor ( ) const
inline

fillColor

Returns
The current fill color.

References _state, and LibBoard::Board::State::style.

◆ fillEllipse()

void LibBoard::Board::fillEllipse ( double  x,
double  y,
double  xRadius,
double  yRadius 
)

Draws an ellipse filled with the current pen color.

Parameters
xFirst coordinate of the circle's center.
ySecond coordinate of the circle's center.
xRadiusX axis radius of the ellipse.
yRadiusY axis radius of the ellipse.

References LibBoard::ShapeList::_shapes, _state, and LibBoard::Board::State::style.

◆ fillGouraudTriangle() [1/4]

void LibBoard::Board::fillGouraudTriangle ( const double  x1,
const double  y1,
const Color color1,
const double  x2,
const double  y2,
const Color color2,
const double  x3,
const double  y3,
const Color color3,
unsigned char  divisions = 3 
)
inline

Draws a triangle with Gouraud-like shaded colors.

Parameters
x1
y1
color1
x2
y2
color2
x3
y3
color3
divisions

References fillGouraudTriangle().

◆ fillGouraudTriangle() [2/4]

void LibBoard::Board::fillGouraudTriangle ( const double  x1,
const double  y1,
const float  brightness1,
const double  x2,
const double  y2,
const float  brightness2,
const double  x3,
const double  y3,
const float  brightness3,
unsigned char  divisions = 3 
)
inline

Draws a triangle with a Gouraud-like shaded color according to the current fill color and a brightness value given for each vertex.

Parameters
x1
y1
brightness1
x2
y2
brightness2
x3
y3
brightness3
divisions

References fillGouraudTriangle().

◆ fillGouraudTriangle() [3/4]

void LibBoard::Board::fillGouraudTriangle ( const Point p1,
const Color color1,
const Point p2,
const Color color2,
const Point p3,
const Color color3,
unsigned char  divisions = 3 
)

Draws a triangle with Gouraud-like shaded colors.

Parameters
p1
color1
p2
color2
p3
color3
divisionsnumber of triangle subdivisions.
Examples
examples/example1.cpp, and examples/example3.cpp.

References LibBoard::ShapeList::_shapes.

Referenced by fillGouraudTriangle().

◆ fillGouraudTriangle() [4/4]

void LibBoard::Board::fillGouraudTriangle ( const Point p1,
const float  brightness1,
const Point p2,
const float  brightness2,
const Point p3,
const float  brightness3,
unsigned char  divisions = 3 
)

Draws a triangle with a Gouraud-like shaded color according to the current fill color and a brightness value given for each vertex.

Parameters
p1
brightness1
p2
brightness2
p3
brightness3
divisionsnumber of triangle subdivisions.

References _state, fillGouraudTriangle(), and LibBoard::Board::State::style.

◆ fillPolyline()

void LibBoard::Board::fillPolyline ( const std::vector< Point > &  points)

Draws a filled polygon.

Parameters
pointsA vector of points.

References LibBoard::ShapeList::_shapes, _state, and LibBoard::Board::State::style.

◆ fillRectangle() [1/2]

void LibBoard::Board::fillRectangle ( const Rect rect)

Draws a rectangle filled with the current pen color.

Parameters
rectPosition and size of the rectangle.

References fillRectangle(), LibBoard::Rect::height, LibBoard::Rect::left, LibBoard::Rect::top, and LibBoard::Rect::width.

◆ fillRectangle() [2/2]

void LibBoard::Board::fillRectangle ( double  left,
double  top,
double  width,
double  height 
)

Draws a rectangle filled with the current pen color.

Parameters
leftFirst coordinate of the upper left corner.
topSecond coordinate of the upper left corner.
widthWidth of the rectangle.
heightHeight of the rectangle.

References LibBoard::ShapeList::_shapes, _state, style(), and LibBoard::Board::State::style.

Referenced by fillRectangle().

◆ fillTriangle() [1/2]

void LibBoard::Board::fillTriangle ( const Point p1,
const Point p2,
const Point p3 
)

Draws a filled triangle.

Parameters
p1First vertex.
p2Second vertex.
p3Third vertex.

References LibBoard::ShapeList::_shapes, _state, and LibBoard::Board::State::style.

◆ fillTriangle() [2/2]

void LibBoard::Board::fillTriangle ( double  x1,
double  y1,
double  x2,
double  y2,
double  x3,
double  y3 
)

Draws a filled triangle.

Parameters
x1First coordinate of the first vertex.
y1Second coordinate of the first vertex.
x2First coordinate of the second vertex.
y2Second coordinate of the second vertex.
x3First coordinate of the third vertex.
y3Second coordinate of the third vertex.

References LibBoard::ShapeList::_shapes, _state, and LibBoard::Board::State::style.

◆ operator<<()

Board & LibBoard::Board::operator<< ( const Shape shape)

Add a shape to the board, using the current unit factor.

Parameters
shapeA shape. (Might be a list of shapes, actually!)
Returns
The board itself, as a ShapeList.

◆ operator=()

Board & LibBoard::Board::operator= ( const Board other)

The operator =

Parameters
otherThe object to be copied.
Returns
A reference to the left operand.

References LibBoard::ShapeList::_shapes, LibBoard::ShapeList::deleteShapes(), and LibBoard::ShapeList::end().

◆ penColor()

const Color & LibBoard::Board::penColor ( ) const
inline

penColor

Returns
The current pen color.
Examples
examples/arrows.cpp.

References _state, and LibBoard::Board::State::style.

◆ rotate() [1/2]

Board & LibBoard::Board::rotate ( double  angle)
overridevirtual

Rotate the shape around its center.

Parameters
angleThe rotation angle in radian.
Returns
A reference to the shape itself.

Implements LibBoard::Shape.

References LibBoard::Shape::center(), LibBoard::ShapeList::rotate(), and LibBoard::Path::rotate().

◆ rotate() [2/2]

Board & LibBoard::Board::rotate ( double  angle,
const Point center 
)
overridevirtual

Rotate the shape around a given center of rotation.

Parameters
angleThe rotation angle in radian.
centerThe center of rotation.
Returns
A reference to the shape itself.

Implements LibBoard::Shape.

Examples
examples/holes.cpp.

References LibBoard::Shape::center(), LibBoard::ShapeList::rotate(), and LibBoard::Path::rotate().

◆ rotated() [1/2]

Board LibBoard::Board::rotated ( double  angle)

Get a rotated copy of the Board around its bounding box's center.

Parameters
angleRotation angle in radian
Returns
Rotated copy of the Board object.

References Board().

◆ rotated() [2/2]

Board LibBoard::Board::rotated ( double  angle,
const Point center 
)

Get a rotated copy of the Board around a specified rotation center.

Parameters
angleRotation angle in radian
centerCenter of rotation
Returns
Rotated copy of the Board object.

References Board(), and LibBoard::Shape::center().

◆ save() [1/2]

void LibBoard::Board::save ( const char *  filename,
double  pageWidth,
double  pageHeight,
double  margin = 0.0,
Unit  unit = UMillimeter 
) const

Save the drawing in an EPS, XFIG of SVG file depending on the filename extension. When a size is given (not BoundingBox), the drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.

Parameters
filenamePath of the file to be created.
pageWidthWidth of the page.
pageHeightHeight of the page.
marginMinimal margin around the figure in the page.
unitThe unit used to express the previous length parameters (default value is millimeter).

◆ save() [2/2]

void LibBoard::Board::save ( const char *  filename,
PageSize  size = Board::BoundingBox,
double  margin = 0.0,
Unit  unit = UMillimeter 
) const

Save the drawing in an EPS, XFIG of SVG file depending on the filename extension. When a size is given (not BoundingBox), the drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.

Parameters
filenamePath of the file to be created.
sizePage size (Either BoundingBox (default), A4 or Letter).
marginMinimal margin around the figure in the page.
unitThe unit used to express the margin (default value is millimeter). If size is "BoundingBox", this unit is used for the bounding box as well.
Examples
examples/arithmetic.cpp.

References LibBoard::ShapeList::size().

◆ saveEPS() [1/4]

void LibBoard::Board::saveEPS ( const char *  filename,
double  pageWidth,
double  pageHeight,
double  margin = 0.0,
Unit  unit = UMillimeter,
const std::string &  title = std::string() 
) const

Saves the drawing in an EPS file. The drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.

Parameters
filenameThe EPS file name.
pageWidthWidth of the page.
pageHeightHeight of the page.
marginMinimal margin around the figure in the page.
unitThe unit used to express the previous length parameters (default value is millimeter).
titleDocument title (Postscript comment).

References saveEPS().

◆ saveEPS() [2/4]

void LibBoard::Board::saveEPS ( const char *  filename,
PageSize  size = Board::BoundingBox,
double  margin = 0.0,
Unit  unit = UMillimeter,
const std::string &  title = std::string() 
) const

Saves the drawing in an EPS file. When a size is given (not BoundingBox), the drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.

Parameters
filenameThe EPS file name.
sizePage size (Either BoundingBox (default), A4 or Letter).
marginMinimal margin around the figure in the page.
unitThe unit used to express the margin (default value is millimeter). If size is "BoundingBox", this unit is used for the bounding box as well.
titleDocument title (Postscript comment).

References saveEPS(), and LibBoard::ShapeList::size().

◆ saveEPS() [3/4]

void LibBoard::Board::saveEPS ( std::ostream &  out,
double  pageWidth,
double  pageHeight,
double  margin = 0.0,
Unit  unit = UMillimeter,
const std::string &  title = std::string() 
) const

Writes the drawing in a stream as an EPS file. The drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.

Parameters
outThe output stream.
pageWidthWidth of the page.
pageHeightHeight of the page.
marginMinimal margin around the figure in the page.
unitThe unit used to express the previous length parameters (default value is millimeter).
titleDocument title (Postscript comment).

◆ saveEPS() [4/4]

void LibBoard::Board::saveEPS ( std::ostream &  out,
PageSize  size = Board::BoundingBox,
double  margin = 0.0,
Unit  unit = UMillimeter,
const std::string &  title = std::string() 
) const

Writes the drawing in a stream as an EPS file. When a size is given (not BoundingBox), the drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.

Parameters
outThe output stream.
sizePage size (Either BoundingBox (default), A4 or Letter).
marginMinimal margin around the figure in the page.
unitThe unit used to express the margin (default value is millimeter). If size is "BoundingBox", this unit is used for the bounding box as well.
titleDocument title (Postscript comment).
Examples
examples/arrows.cpp, examples/bezier.cpp, examples/clipping.cpp, examples/ellipse.cpp, examples/example1.cpp, examples/example2.cpp, examples/example3.cpp, examples/example4.cpp, examples/fern.cpp, examples/flag.cpp, examples/graph.cpp, examples/holes.cpp, examples/images.cpp, examples/koch.cpp, examples/line_segment.cpp, examples/line_style.cpp, examples/logo.cpp, examples/ruler.cpp, examples/scale_ellipse.cpp, examples/stroke_path.cpp, and examples/tilings.cpp.

References LibBoard::ShapeList::size().

Referenced by saveEPS().

◆ saveFIG() [1/4]

void LibBoard::Board::saveFIG ( const char *  filename,
double  pageWidth,
double  pageHeight,
double  margin = 0.0,
Unit  unit = UMillimeter 
) const

Saves the drawing in an XFig file. When a size is given (not BoundingBox), the drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.

Parameters
filenameThe XFig file name.
pageWidthWidth of the page.
pageHeightHeight of the page.
marginMinimal margin around the figure in the page.
unitThe unit used to express the previous length parameters (default value is millimeter).

References saveFIG().

◆ saveFIG() [2/4]

void LibBoard::Board::saveFIG ( const char *  filename,
PageSize  size = Board::BoundingBox,
double  margin = 0.0,
Unit  unit = UMillimeter 
) const

Saves the drawing in an XFig file. When a size is given (not BoundingBox), the drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.

Parameters
filenameThe name of the FIG file.
sizePage size (Either BoundingBox (default), A4 or Letter).
marginMinimal margin around the figure in the page.
unitThe unit used to express the margin (default value is millimeter). If size is "BoundingBox", this unit is used for the bounding box as well.
Examples
examples/arrows.cpp, examples/ellipse.cpp, examples/example1.cpp, examples/example2.cpp, examples/example3.cpp, examples/example4.cpp, examples/graph.cpp, examples/images.cpp, examples/koch.cpp, examples/line_style.cpp, examples/logo.cpp, examples/ruler.cpp, and examples/scale_ellipse.cpp.

References LibBoard::ShapeList::size().

Referenced by saveFIG().

◆ saveFIG() [3/4]

void LibBoard::Board::saveFIG ( std::ostream &  out,
double  pageWidth,
double  pageHeight,
double  margin = 0.0,
Unit  unit = UMillimeter 
) const

Saves the drawing in a stream as an XFig file. The drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.

Parameters
outThe output stream.
pageWidthWidth of the page.
pageHeightHeight of the page.
marginMinimal margin around the figure in the page.
unitThe unit used to express the previous length parameters (default value is millimeter).

References LibBoard::Shape::bbox(), and LibBoard::ShapeList::boundingBox().

◆ saveFIG() [4/4]

void LibBoard::Board::saveFIG ( std::ostream &  out,
PageSize  size = Board::BoundingBox,
double  margin = 0.0,
Unit  unit = UMillimeter 
) const

Saves the drawing in a stream as an XFig file. When a size is given (not BoundingBox), the drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.

Parameters
outThe output stream.
sizePage size (Either BoundingBox (default), A4 or Letter).
marginMinimal margin around the figure in the page.
unitThe unit used to express the margin (default value is millimeter). If size is "BoundingBox", this unit is used for the bounding box as well.

References saveFIG(), and LibBoard::ShapeList::size().

◆ saveSVG() [1/4]

void LibBoard::Board::saveSVG ( const char *  filename,
double  pageWidth,
double  pageHeight,
double  margin = 0.0,
Unit  unit = UMillimeter 
) const

Saves the drawing in an SVG file. When a size is given (not BoundingBox), the drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.

Parameters
filenameThe SVG file name.
pageWidthWidth of the page.
pageHeightHeight of the page.
marginMinimal margin around the figure in the page.
unitThe unit used to express the previous length parameters (default value is millimeter).

References saveSVG().

◆ saveSVG() [2/4]

void LibBoard::Board::saveSVG ( const char *  filename,
PageSize  size = Board::BoundingBox,
double  margin = 0.0,
Unit  unit = UMillimeter 
) const

Save the drawing in an SVG file. When a size is given (not BoundingBox), the drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.

Parameters
filenameThe name of the file.
sizePage size (Either BoundingBox (default), A4 or Letter).
marginMinimal margin around the figure in the page.
unitThe unit used to express the margin (default value is millimeter). If size is "BoundingBox", this unit is used for the bounding box as well.
Examples
examples/arrows.cpp, examples/bezier.cpp, examples/clipping.cpp, examples/ellipse.cpp, examples/example1.cpp, examples/example2.cpp, examples/example3.cpp, examples/example4.cpp, examples/fern.cpp, examples/flag.cpp, examples/graph.cpp, examples/holes.cpp, examples/hull.cpp, examples/images.cpp, examples/koch.cpp, examples/line_segment.cpp, examples/line_style.cpp, examples/logo.cpp, examples/ruler.cpp, examples/scale_ellipse.cpp, examples/stroke_path.cpp, and examples/tilings.cpp.

References LibBoard::ShapeList::size().

Referenced by saveSVG().

◆ saveSVG() [3/4]

void LibBoard::Board::saveSVG ( std::ostream &  out,
double  pageWidth,
double  pageHeight,
double  margin = 0.0,
Unit  unit = UMillimeter 
) const

Saves the drawing in a stream as an SVG file. The drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.

Parameters
outThe output stream.
pageWidthWidth of the page.
pageHeightHeight of the page.
marginMinimal margin around the figure in the page.
unitThe unit used to express the previous length parameters (default value is millimeter).

References LibBoard::Shape::bbox(), and LibBoard::ShapeList::boundingBox().

◆ saveSVG() [4/4]

void LibBoard::Board::saveSVG ( std::ostream &  out,
PageSize  size = Board::BoundingBox,
double  margin = 0.0,
Unit  unit = UMillimeter 
) const

Saves the drawing in a stream as an SVG file. When a size is given (not BoundingBox), the drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.

Parameters
outThe output stream.
sizePage size (Either BoundingBox (default), A4 or Letter).
marginMinimal margin around the figure in the page.
unitThe unit used to express the margin (default value is millimeter). If size is "BoundingBox", this unit is used for the bounding box as well.

References saveSVG(), and LibBoard::ShapeList::size().

◆ saveTikZ() [1/4]

void LibBoard::Board::saveTikZ ( const char *  filename,
double  pageWidth,
double  pageHeight,
double  margin = 0.0 
) const

Save the drawing in an TikZ file. When a size is given (not BoundingBox), the drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.

Parameters
filenameThe name of the file.
pageWidthWidth of the page in millimeters.
pageHeightHeight of the page in millimeters.
marginMinimal margin around the figure in the page, in millimeters.

References saveTikZ().

◆ saveTikZ() [2/4]

void LibBoard::Board::saveTikZ ( const char *  filename,
PageSize  size = Board::BoundingBox,
double  margin = 0.0 
) const

Save the drawing in an TikZ file. When a size is given (not BoundingBox), the drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.

Parameters
filenameThe name of the file.
sizePage size (Either BoundingBox (default), A4 or Letter).
marginMinimal margin around the figure in the page, in millimeters.
Examples
examples/flag.cpp.

References LibBoard::ShapeList::size().

Referenced by saveTikZ().

◆ saveTikZ() [3/4]

void LibBoard::Board::saveTikZ ( std::ostream &  out,
double  pageWidth,
double  pageHeight,
double  margin = 0.0 
) const

Save the drawing in a stream as a TikZ file. The drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.

Parameters
outThe output stream.
pageWidthWidth of the page in millimeters.
pageHeightHeight of the page in millimeters.
marginMinimal margin around the figure in the page, in millimeters.

References LibBoard::ShapeList::boundingBox().

◆ saveTikZ() [4/4]

void LibBoard::Board::saveTikZ ( std::ostream &  out,
PageSize  size = Board::BoundingBox,
double  margin = 0.0 
) const

Save the drawing in a stream as TikZ file. When a size is given (not BoundingBox), the drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.

Parameters
outThe output stream.
sizePage size (Either BoundingBox (default), A4 or Letter).
marginMinimal margin around the figure in the page, in millimeters.

References saveTikZ(), and LibBoard::ShapeList::size().

◆ scale() [1/2]

Board & LibBoard::Board::scale ( double  s)
overridevirtual

Scale the shape along both axis.

Parameters
sThe scaling factor along both axis.
Returns
The shape itself.

Implements LibBoard::Shape.

References LibBoard::Path::center(), LibBoard::Shape::center(), LibBoard::ShapeList::scale(), LibBoard::Path::scale(), LibBoard::Path::translate(), LibBoard::Point::x, and LibBoard::Point::y.

◆ scale() [2/2]

Board & LibBoard::Board::scale ( double  sx,
double  sy 
)
overridevirtual

Scale the shape along the x an y axis.

Parameters
sxThe scaling factor along the x axis.
syThe scaling factor along the y axis.
Returns
The shape itself.

Implements LibBoard::Shape.

Examples
examples/example3.cpp.

References LibBoard::Path::center(), LibBoard::Shape::center(), LibBoard::ShapeList::scale(), LibBoard::Path::scale(), LibBoard::Path::translate(), LibBoard::Point::x, and LibBoard::Point::y.

Referenced by addDuplicates().

◆ scaled() [1/2]

Board LibBoard::Board::scaled ( double  s)

Get a scaled copy of the Board.

Parameters
sscaling factor
Returns
Scaled copy of the Board object.

References Board().

◆ scaled() [2/2]

Board LibBoard::Board::scaled ( double  sx,
double  sy 
)

Get a scaled copy of the Board.

Parameters
sxx scaling factor
syy scaling factor
Returns
Scaled copy of the Board object.
Examples
examples/scale_ellipse.cpp.

References Board().

◆ setClippingPath() [1/2]

void LibBoard::Board::setClippingPath ( const Path path)

Define a clipping path for the whole drawing.

Parameters
pathA path.

References LibBoard::Path::pop_back().

◆ setClippingPath() [2/2]

void LibBoard::Board::setClippingPath ( const std::vector< Point > &  points)

Define a clipping path for the whole drawing.

Parameters
pointsA path.

References LibBoard::ShapeList::end().

◆ setClippingRectangle() [1/2]

void LibBoard::Board::setClippingRectangle ( const Rect rect)

Define a clipping rectangle for the whole drawing.

Parameters
rectThe clipping rectangle.

References LibBoard::Rect::height, LibBoard::Rect::left, setClippingRectangle(), LibBoard::Rect::top, and LibBoard::Rect::width.

◆ setClippingRectangle() [2/2]

void LibBoard::Board::setClippingRectangle ( double  x,
double  y,
double  width,
double  height 
)

Define a clipping rectangle for the whole drawing.

Parameters
x
y
width
height
Examples
examples/flag.cpp.

Referenced by setClippingRectangle().

◆ setFillColor()

Board & LibBoard::Board::setFillColor ( const Color color)

Changes the current fill color.

In order to use no fill color, one may set this color to Color::None.

Parameters
colorThe fill color.
Returns
The board itself.
Examples
examples/arrows.cpp, examples/bezier.cpp, examples/fern.cpp, and examples/line_style.cpp.

References _state, and LibBoard::Board::State::style.

◆ setFillColorHSV()

Board & LibBoard::Board::setFillColorHSV ( float  hue,
float  saturation,
float  value,
float  alpha = 1.0f 
)

Changes the current fill color (HSV version)

Parameters
hue
saturation
value
alpha
Returns

References _state, LibBoard::Color::setHSV(), and LibBoard::Board::State::style.

◆ setFillColorRGBf()

Board & LibBoard::Board::setFillColorRGBf ( float  red,
float  green,
float  blue,
float  alpha = 1.0f 
)

Changes the current fill color (RGB version).

Parameters
redRed component.
greenGreen component.
blueBlue component.
alphaThe opacity.
Returns
The board itself.
Examples
examples/example2.cpp.

References _state, and LibBoard::Board::State::style.

◆ setFillColorRGBi()

Board & LibBoard::Board::setFillColorRGBi ( unsigned char  red,
unsigned char  green,
unsigned char  blue,
unsigned char  alpha = 255 
)

Changes the current fill color.

Parameters
redRed component.
greenGreen component.
blueBlue component.
alphaThe opacity.
Returns
The board itself.
Examples
examples/example2.cpp.

References _state, LibBoard::Color::setRGBi(), and LibBoard::Board::State::style.

◆ setFont()

Board & LibBoard::Board::setFont ( const Fonts::Font  font,
double  fontSize 
)

Changes the current font and font size.

Parameters
fontThe name of the font.
fontSizeThe new font size.
Returns
The board itself.
Examples
examples/arrows.cpp, and examples/example2.cpp.

References _state, LibBoard::Board::State::font, and LibBoard::Board::State::fontSize.

◆ setFontSize()

Board & LibBoard::Board::setFontSize ( double  fontSize)

Changes the font size.

Parameters
fontSizeThe new font size.
Returns
The board itself.
Examples
examples/arithmetic.cpp, and examples/ruler.cpp.

References _state, and LibBoard::Board::State::fontSize.

◆ setLineCap()

Board & LibBoard::Board::setLineCap ( LineCap  cap)
inline

Set the line cap style.

Parameters
capThe cap-style.
Returns
The board itself.
Examples
examples/line_segment.cpp, and examples/logo.cpp.

References _state, and LibBoard::Board::State::style.

◆ setLineJoin()

Board & LibBoard::Board::setLineJoin ( LineJoin  join)
inline

Set the line join style.

Parameters
joinThe join-style
Returns
The board itself.
Examples
examples/example2.cpp, and examples/logo.cpp.

References _state, and LibBoard::Board::State::style.

◆ setLineStyle()

Board & LibBoard::Board::setLineStyle ( LineStyle  style)
inline

Changes the current line style.

Parameters
styleThe new line style.
Returns
The board itself.
Examples
examples/line_style.cpp, and examples/logo.cpp.

References _state, style(), and LibBoard::Board::State::style.

◆ setLineWidth()

Board & LibBoard::Board::setLineWidth ( double  width)

◆ setLineWidthScaling()

void LibBoard::Board::setLineWidthScaling ( bool  on)
static

Globally enable/disable linewidth scaling when using scale functions.

References LibBoard::ShapeWithStyle::setLineWidthScaling().

◆ setPenColor()

Board & LibBoard::Board::setPenColor ( const Color color)

Changes the current pen color.

In order to use no pen, one may set the pen color to Color::None.

Parameters
colorThe pen color.
Returns
The board itself.
Examples
examples/arithmetic.cpp, examples/arrows.cpp, examples/bezier.cpp, examples/example1.cpp, examples/example2.cpp, examples/fern.cpp, and examples/koch.cpp.

References _state, and LibBoard::Board::State::style.

◆ setPenColorRGBf()

Board & LibBoard::Board::setPenColorRGBf ( float  red,
float  green,
float  blue,
float  alpha = 1.0f 
)

Changes the current pen color.

Parameters
redRed component [0..1].
greenGreen component [0..1].
blueBlue component [0..1].
alphaTransparency [0..1].
Returns
The board itself.
Examples
examples/arrows.cpp, and examples/example4.cpp.

References _state, and LibBoard::Board::State::style.

◆ setPenColorRGBi()

Board & LibBoard::Board::setPenColorRGBi ( unsigned char  red,
unsigned char  green,
unsigned char  blue,
unsigned char  alpha = 255 
)

Changes the current pen color.

Parameters
redRed component [0..255].
greenGreen component [0..255].
blueBlue component [0..255].
alphaTransparency channel [0..255].
Returns
The board itself.
Examples
examples/arithmetic.cpp, examples/arrows.cpp, examples/example1.cpp, examples/example2.cpp, examples/example3.cpp, examples/line_segment.cpp, and examples/logo.cpp.

References _state, LibBoard::Color::setRGBi(), and LibBoard::Board::State::style.

◆ style()

const Style & LibBoard::Board::style ( ) const
inline

Return the current style used when drawing shapes with board methods.

Returns
Current style.
Examples
examples/line_style.cpp.

References _state, and LibBoard::Board::State::style.

Referenced by fillRectangle(), and setLineStyle().

◆ translate()

Board & LibBoard::Board::translate ( double  dx,
double  dy 
)
overridevirtual

Translate the shape by a given offset.

Parameters
dxThe x offset.
dyThe y offset.
Returns
A reference to the shape itself.

Implements LibBoard::Shape.

References LibBoard::ShapeList::translate(), and LibBoard::Path::translate().

◆ translated()

Board LibBoard::Board::translated ( double  dx,
double  dy 
)

Get a translated copy of the Board.

Parameters
dxx shift value
dyy shift value
Returns
Translated copy of the Board object.

References Board().

Member Data Documentation

◆ _backgroundColor

Color LibBoard::Board::_backgroundColor
protected

The color of the background.

Referenced by backgroundColor(), and clear().

◆ _state

State LibBoard::Board::_state
protected

The documentation for this struct was generated from the following files: