# LibBoard::Board Class Reference

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

`#include <Board.h>`

Inheritance diagram for LibBoard::Board:

List of all members.

## Classes

struct | State

## Public Types

enum | PageSize { BoundingBox, A4, Letter }
enum | Unit { UPoint, UInche, UCentimeter, UMillimeter }

## Public Member Functions

| Board (const Color &backgroundColor=Color::None)
| Board (const Board &other)
Board & | operator= (const Board &other)
Board & | operator<< (const Shape &shape)
Board & | operator<< (Unit unit)
void | clear (const Color &color=Color::None)
void | clear (unsigned char red, unsigned char green, unsigned char blue)
Board & | rotate (double angle, const Point &center)
Board & | rotate (double angle)
Board & | translate (double dx, double dy)
Board & | scale (double sx, double sy)
Board & | scale (double s)
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 | setUnit (Unit unit)
void | setUnit (double factor, Unit unit)
void | drawDot (double x, double y, int depth=-1)
void | drawLine (double x1, double y1, double x2, double y2, int depth=-1)
void | drawArrow (double x1, double y1, double x2, double y2, bool filled=true, int depth=-1)
void | drawTriangle (double x1, double y1, double x2, double y2, double x3, double y3, int depth=-1)
void | drawTriangle (const Point &p1, const Point &p2, const Point &p3, int depth=-1)
void | fillTriangle (double x1, double y1, double x2, double y2, double x3, double y3, int depth=-1)
void | fillGouraudTriangle (const Point &p1, const Color &color1, const Point &p2, const Color &color2, const Point &p3, const Color &color3, unsigned char divisions=3, int depth=-1)
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, int depth=-1)
void | fillGouraudTriangle (const Point &p1, const float brightness1, const Point &p2, const float brightness2, const Point &p3, const float brightness3, unsigned char divisions=3, int depth=-1)
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, int depth=-1)
void | fillTriangle (const Point &p1, const Point &p2, const Point &p3, int depth=-1)
void | drawRectangle (double x, double y, double width, double height, int depth=-1)
void | fillRectangle (double x, double y, double width, double height, int depth=-1)
void | drawCircle (double x, double y, double radius, int depth=-1)
void | fillCircle (double x, double y, double radius, int depth=-1)
void | drawEllipse (double x, double y, double xRadius, double yRadius, int depth=-1)
void | fillEllipse (double x, double y, double xRadius, double yRadius, int depth=-1)
void | drawPolyline (const std::vector< Point > &points, int depth=-1)
void | drawClosedPolyline (const std::vector< Point > &points, int depth=-1)
void | fillPolyline (const std::vector< Point > &points, int depth=-1)
void | drawText (double x, double y, const char *text, int depth=-1)
void | drawText (double x, double y, const std::string &str, int depth=-1)
Board & | setFont (const Fonts::Font font, double fontSize)
Board & | setFontSize (double fontSize)
Board & | setPenColorRGBi (unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha=255)
Board & | setPenColorRGBf (float red, float green, float blue, float alpha=1.0f)
Board & | setPenColor (const Color &color)
Board & | setFillColorRGBi (unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha=255)
Board & | setFillColorRGBf (float red, float green, float blue, float alpha=1.0f)
Board & | setFillColor (const Color &color)
Board & | setLineWidth (double width)
Board & | setLineStyle (Shape::LineStyle style)
Board & | setLineCap (Shape::LineCap cap)
Board & | setLineJoin (Shape::LineJoin join)
void | backgroundColor (const Color &color)
void | drawBoundingBox (int depth=-1)
void | setClippingRectangle (double x, double y, double width, double height)
void | setClippingPath (const std::vector< Point > &points)
void | setClippingPath (const Path &path)
void | addDuplicates (const Shape &shape, unsigned int times, double dx, double dy, double scale=1.0)
void | addDuplicates (const Shape &shape, unsigned int times, double dx, double dy, double scaleX, double scaleY, double angle=0.0)
void | save (const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
void | save (const char *filename, double pageWidth, double pageHeight, double margin=10.0) const
void | saveEPS (const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
void | saveEPS (const char *filename, double pageWidth, double pageHeight, double margin=10.0) const
void | saveFIG (const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
void | saveFIG (const char *filename, double pageWidth, double pageHeight, double margin=10.0) const
void | saveSVG (const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
void | saveSVG (const char *filename, double pageWidth, double pageHeight, double margin=10.0) const

## Static Public Attributes

static const double | Degree = 3.14159265358979323846 / 180.0

## Protected Attributes

State | _state
Color | _backgroundColor
Path | _clippingPath

## Detailed Description

Class for EPS, FIG or SVG drawings.

The Board class.

Version:
  0.5

Examples:

  examples/arithmetic.cpp, examples/arrows.cpp, examples/clipping.cpp, examples/ellipse.cpp, examples/example1.cpp, examples/example2.cpp, examples/example3.cpp, examples/example4.cpp, examples/graph.cpp, examples/koch.cpp, examples/logo.cpp, and examples/ruler.cpp.

## Constructor & Destructor Documentation

LibBoard::Board::Board | ( | const Color & | backgroundColor = `Color::None` | ) |

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

Parameters:

  | backgroundColor | A color for the drawing's background.

LibBoard::Board::Board | ( | const Board & | other | ) |

Copy constructor.

Parameters:

  | other | The object to be copied.

## Member Function Documentation

void LibBoard::Board::addDuplicates | ( | const Shape & | shape,
|  | unsigned int | 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:

  | shape | The shape to be duplicated.
  | times | The number of duplicates.
  | dx | The x shift.
  | dy | The y shift.
  | scaleX | An x scale factor between each copy.
  | scaleY | A y scale factor between each copy.
  | scaleY | A y scale factor between each copy.
  | angle | An angular increment.

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

void LibBoard::Board::addDuplicates | ( | const Shape & | shape,
|  | unsigned int | 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:

  | shape | The shape to be duplicated.
  | times | The number of duplicates.
  | dx | The x shift.
  | dy | The y shift.
  | scale | A scale factor between each copy.

Examples:
  examples/clipping.cpp, examples/logo.cpp, and examples/ruler.cpp.

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

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

Changes the background color of the whole drawing.

Parameters:

  | color | A color (may be Color::None).

References _backgroundColor.

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 clear().

void LibBoard::Board::clear | ( | const Color & | color = `Color::None` | ) |

Clears the board with a given background color.

Parameters:

  | color | The board background color (may be Color::None).

Examples:
  examples/arithmetic.cpp, examples/arrows.cpp, examples/ellipse.cpp, examples/example3.cpp, examples/example4.cpp, examples/graph.cpp, examples/koch.cpp, and examples/ruler.cpp.

References _backgroundColor.

Referenced by clear().

void LibBoard::Board::drawArrow | ( | double | x1,
|  | double | y1,
|  | double | x2,
|  | double | y2,
|  | bool | filled = `true`,
|  | int | depth = `-1` |
| ) |  |  |

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

Parameters:

  | x1 | First coordinate of the first extremity.
  | y1 | Second coordinate of the first extremity.
  | x2 | First coordinate of the second extremity.
  | y2 | Second coordinate of the second extremity.
  | filled | Whether or not the arrow is filled.
  | depth | Depth of the line.

Examples:
  examples/arrows.cpp, and examples/example1.cpp.

References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::lineCap, LibBoard::Board::State::lineJoin, LibBoard::Board::State::lineStyle, LibBoard::Board::State::lineWidth, and LibBoard::Board::State::penColor.

void LibBoard::Board::drawBoundingBox | ( | int | depth = `-1` | ) |

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

Parameters:

  | depth | The depth of the rectangle.

References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Shape::bbox(), LibBoard::ShapeList::boundingBox(), LibBoard::Board::State::fillColor, LibBoard::Rect::height, LibBoard::Rect::left, LibBoard::Board::State::lineCap, LibBoard::Board::State::lineJoin, LibBoard::Board::State::lineStyle, LibBoard::Board::State::lineWidth, LibBoard::Board::State::penColor, LibBoard::Rect::top, and LibBoard::Rect::width.

void LibBoard::Board::drawCircle | ( | double | x,
|  | double | y,
|  | double | radius,
|  | int | depth = `-1` |
| ) |  |  |

Draws a circle.

Parameters:

  | x | First coordinate of the circle's center.
  | y | Second coordinate of the circle's center.
  | radius | Radius of the circle.
  | depth | Depth of the circle.

Examples:
  examples/example2.cpp.

References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::fillColor, LibBoard::Board::State::lineStyle, LibBoard::Board::State::lineWidth, and LibBoard::Board::State::penColor.

void LibBoard::Board::drawClosedPolyline | ( | const std::vector< Point > & | points,
|  | int | depth = `-1` |
| ) |  |  |

Draws a closed polygonal line.

Parameters:

  | points | A vector of points.
  | depth | The depth of the polyline.

References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::fillColor, LibBoard::Board::State::lineCap, LibBoard::Board::State::lineJoin, LibBoard::Board::State::lineStyle, LibBoard::Board::State::lineWidth, and LibBoard::Board::State::penColor.

void LibBoard::Board::drawDot | ( | double | x,
|  | double | y,
|  | int | depth = `-1` |
| ) |  |  |

Draws a dot at coordinates (x,y).

Parameters:

  | x | First coordinate of the dot.
  | y | Second coordinate of the dot.
  | depth | Depth of the line.

Examples:
  examples/arrows.cpp, and examples/example4.cpp.

References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::lineWidth, and LibBoard::Board::State::penColor.

void LibBoard::Board::drawEllipse | ( | double | x,
|  | double | y,
|  | double | xRadius,
|  | double | yRadius,
|  | int | depth = `-1` |
| ) |  |  |

Draws an ellipse.

Parameters:

  | x | First coordinate of the circle's center.
  | y | Second coordinate of the circle's center.
  | radius | Radius of the circle.
  | depth | Depth of the circle.

Examples:
  examples/example2.cpp.

References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::fillColor, LibBoard::Board::State::lineStyle, LibBoard::Board::State::lineWidth, and LibBoard::Board::State::penColor.

void LibBoard::Board::drawLine | ( | double | x1,
|  | double | y1,
|  | double | x2,
|  | double | y2,
|  | int | depth = `-1` |
| ) |  |  |

Draws a line from (x1,y1) to (x2,y2).

Parameters:

  | x1 | First coordinate of the first extremity.
  | y1 | Second coordinate of the first extremity.
  | x2 | First coordinate of the second extremity.
  | y2 | Second coordinate of the second extremity.
  | depth | Depth of the line.

Examples:
  examples/example2.cpp, and examples/logo.cpp.

References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::lineCap, LibBoard::Board::State::lineJoin, LibBoard::Board::State::lineStyle, LibBoard::Board::State::lineWidth, and LibBoard::Board::State::penColor.

void LibBoard::Board::drawPolyline | ( | const std::vector< Point > & | points,
|  | int | depth = `-1` |
| ) |  |  |

Draws a polygonal line.

Parameters:

  | points | A vector of points.
  | depth | The depth of the polyline.

Examples:
  examples/example1.cpp, and examples/example2.cpp.

References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::fillColor, LibBoard::Board::State::lineCap, LibBoard::Board::State::lineJoin, LibBoard::Board::State::lineStyle, LibBoard::Board::State::lineWidth, and LibBoard::Board::State::penColor.

void LibBoard::Board::drawRectangle | ( | double | x,
|  | double | y,
|  | double | width,
|  | double | height,
|  | int | depth = `-1` |
| ) |  |  |

Draws a rectangle.

Parameters:

  | x | First coordinate of the upper left corner.
  | y | Second coordinate of the upper left corner.
  | width | Width of the rectangle.
  | height | Height of the rectangle.
  | depth | Depth of the rectangle.

Examples:
  examples/arithmetic.cpp, examples/example1.cpp, and examples/example2.cpp.

References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::fillColor, LibBoard::Board::State::lineCap, LibBoard::Board::State::lineJoin, LibBoard::Board::State::lineStyle, LibBoard::Board::State::lineWidth, and LibBoard::Board::State::penColor.

void LibBoard::Board::drawText | ( | double | x,
|  | double | y,
|  | const std::string & | str,
|  | int | depth = `-1` |
| ) |  |  |

Draws a string of text.

Parameters:

  | x | The first coordinates of the lower left corner.
  | y | The second coordinates of the lower left corner.
  | text | The text.
  | depth | The depth of the text.

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

void LibBoard::Board::drawText | ( | double | x,
|  | double | y,
|  | const char * | text,
|  | int | depth = `-1` |
| ) |  |  |

Draws a string of text.

Parameters:

  | x | The first coordinates of the lower left corner.
  | y | The second coordinates of the lower left corner.
  | text | The text.
  | depth | The depth of the text.

Examples:
  examples/arithmetic.cpp, examples/arrows.cpp, examples/example2.cpp, and examples/ruler.cpp.

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

void LibBoard::Board::drawTriangle | ( | const Point & | p1,
|  | const Point & | p2,
|  | const Point & | p3,
|  | int | depth = `-1` |
| ) |  |  |

Draws a triangle.

Parameters:

  | p1 | First vertex.
  | p2 | Second vertex.
  | p3 | Third vertex.
  | depth | Depth of the triangle.

References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::fillColor, LibBoard::Board::State::lineCap, LibBoard::Board::State::lineJoin, LibBoard::Board::State::lineStyle, LibBoard::Board::State::lineWidth, LibBoard::Board::State::penColor, LibBoard::Point::x, and LibBoard::Point::y.

void LibBoard::Board::drawTriangle | ( | double | x1,
|  | double | y1,
|  | double | x2,
|  | double | y2,
|  | double | x3,
|  | double | y3,
|  | int | depth = `-1` |
| ) |  |  |

Draws a triangle.

Parameters:

  | x1 | First coordinate of the first vertex.
  | y1 | Second coordinate of the first vertex.
  | x2 | First coordinate of the second vertex.
  | y3 | Second coordinate of the second vertex.
  | x3 | First coordinate of the third vertex.
  | y3 | Second coordinate of the third vertex.
  | depth | Depth of the triangle.

Examples:
  examples/example2.cpp.

References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::fillColor, LibBoard::Board::State::lineCap, LibBoard::Board::State::lineJoin, LibBoard::Board::State::lineStyle, LibBoard::Board::State::lineWidth, and LibBoard::Board::State::penColor.

void LibBoard::Board::fillCircle | ( | double | x,
|  | double | y,
|  | double | radius,
|  | int | depth = `-1` |
| ) |  |  |

Draws a circle filled with the current pen color.

Parameters:

  | x | First coordinate of the circle's center.
  | y | Second coordinate of the circle's center.
  | radius | Radius of the circle.
  | depth | Depth of the circle.

Examples:
  examples/example1.cpp, and examples/example2.cpp.

References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::lineStyle, and LibBoard::Board::State::penColor.

void LibBoard::Board::fillEllipse | ( | double | x,
|  | double | y,
|  | double | xRadius,
|  | double | yRadius,
|  | int | depth = `-1` |
| ) |  |  |

Draws an ellipse filled with the current pen color.

Parameters:

  | x | First coordinate of the circle's center.
  | y | Second coordinate of the circle's center.
  | xRadius | X axis radius of the ellipse.
  | yRadius | Y axis radius of the ellipse.
  | depth | Depth of the circle.

References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::lineStyle, and LibBoard::Board::State::penColor.

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`,
|  | int | depth = `-1` |
| ) |  |  | `[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 |
  | depth |

References fillGouraudTriangle().

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`,
|  | int | depth = `-1` |
| ) |  |  |

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 |
  | divisions | number of triangle subdivisions.
  | depth | The depth of the triangle.

References _state, fillGouraudTriangle(), LibBoard::Board::State::penColor, LibBoard::Point::x, and LibBoard::Point::y.

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`,
|  | int | depth = `-1` |
| ) |  |  | `[inline]`

Draws a triangle with Gouraud-like shaded colors.

Parameters:

  | x1 |
  | y1 |
  | color1 |
  | x2 |
  | y2 |
  | color2 |
  | x3 |
  | y3 |
  | color3 |
  | divisions |
  | depth |

References fillGouraudTriangle().

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`,
|  | int | depth = `-1` |
| ) |  |  |

Draws a triangle with Gouraud-like shaded colors.

Parameters:

  | p1 |
  | color1 |
  | p2 |
  | color2 |
  | p3 |
  | color3 |
  | divisions | number of triangle subdivisions.
  | depth | The depth of the triangle.

Examples:
  examples/example1.cpp, and examples/example3.cpp.

References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Point::x, and LibBoard::Point::y.

Referenced by fillGouraudTriangle().

void LibBoard::Board::fillPolyline | ( | const std::vector< Point > & | points,
|  | int | depth = `-1` |
| ) |  |  |

Draws a filled polygon.

Parameters:

  | points | A vector of points.
  | depth | The depth of the polygon.

References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::lineCap, LibBoard::Board::State::lineJoin, LibBoard::Board::State::lineStyle, and LibBoard::Board::State::penColor.

void LibBoard::Board::fillRectangle | ( | double | x,
|  | double | y,
|  | double | width,
|  | double | height,
|  | int | depth = `-1` |
| ) |  |  |

Draws a rectangle filled with the current pen color.

Parameters:

  | x | First coordinate of the upper left corner.
  | y | Second coordinate of the upper left corner.
  | width | Width of the rectangle.
  | height | Height of the rectangle.
  | depth | Depth of the rectangle.

References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::lineCap, LibBoard::Board::State::lineJoin, LibBoard::Board::State::lineStyle, and LibBoard::Board::State::penColor.

void LibBoard::Board::fillTriangle | ( | const Point & | p1,
|  | const Point & | p2,
|  | const Point & | p3,
|  | int | depth = `-1` |
| ) |  |  |

Draws a filled triangle.

Parameters:

  | p1 | First vertex.
  | p2 | Second vertex.
  | p3 | Third vertex.
  | depth | Depth of the triangle.

References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::lineCap, LibBoard::Board::State::lineJoin, LibBoard::Board::State::lineStyle, LibBoard::Board::State::penColor, LibBoard::Point::x, and LibBoard::Point::y.

void LibBoard::Board::fillTriangle | ( | double | x1,
|  | double | y1,
|  | double | x2,
|  | double | y2,
|  | double | x3,
|  | double | y3,
|  | int | depth = `-1` |
| ) |  |  |

Draws a filled triangle.

Parameters:

  | x1 | First coordinate of the first vertex.
  | y1 | Second coordinate of the first vertex.
  | x2 | First coordinate of the second vertex.
  | y3 | Second coordinate of the second vertex.
  | x3 | First coordinate of the third vertex.
  | y3 | Second coordinate of the third vertex.
  | depth | Depth of the triangle.

References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::lineCap, LibBoard::Board::State::lineJoin, LibBoard::Board::State::lineStyle, and LibBoard::Board::State::penColor.

Board & LibBoard::Board::operator<< | ( | Unit | unit | ) |

Overloaded operator to set the current unit.

Parameters:

  | unit | The unit to be used in next drawing functions and shape insertions.

Returns:
  The board itself, as a ShapeList.

References setUnit().

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

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

Parameters:

  | shape | A shape. (Might be a list of shapes, actually!)

Returns:
  The board itself, as a ShapeList.

Reimplemented from LibBoard::ShapeList.

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

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

The operator =

Parameters:

  | other | The object to be copied.

Returns:
  A reference to the left operand.

References LibBoard::ShapeList::_shapes, and LibBoard::ShapeList::free().

Board & LibBoard::Board::rotate | ( | double | angle | ) | `[virtual]`

Rotate the shape around its center.

Parameters:

  | angle | The rotation angle in radian.

Returns:
  A reference to the shape itself.

Reimplemented from LibBoard::ShapeList.

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

Board & LibBoard::Board::rotate | ( | double | angle,
|  | const Point & | center |
| ) |  |  | `[virtual]`

Rotate the shape around a given center of rotation.

Parameters:

  | angle | The rotation angle in radian.
  | center | The center of rotation.

Returns:
  A reference to the shape itself.

Reimplemented from LibBoard::ShapeList.

References LibBoard::Path::rotate().

Referenced by rotate().

void LibBoard::Board::save | ( | const char * | filename,
|  | double | pageWidth,
|  | double | pageHeight,
|  | double | margin = `10.0` |
| ) |  |  | 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:

  | filename | Path of the file to be created.
  | pageWidth | Width of the page in millimeters.
  | pageHeight | Height of the page in millimeters.
  | margin | Minimal margin around the figure in the page, in millimeters.

References saveEPS(), saveFIG(), and saveSVG().

void LibBoard::Board::save | ( | const char * | filename,
|  | PageSize | size = `Board::BoundingBox`,
|  | double | margin = `10.0` |
| ) |  |  | 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:

  | filename | Path of the file to be created.
  | size | Page size (Either BoundingBox (default), A4 or Letter).
  | margin | Minimal margin around the figure in the page, in millimeters.

Examples:
  examples/arithmetic.cpp.

void LibBoard::Board::saveEPS | ( | const char * | filename,
|  | double | pageWidth,
|  | double | pageHeight,
|  | double | margin = `10.0` |
| ) |  |  | 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:

  | filename | The EPS file name.
  | size | Page size (Either BoundingBox (default), A4 or Letter).
  | pageWidth | Width of the page in millimeters.
  | pageHeight | Height of the page in millimeters.
  | margin | Minimal margin around the figure in the page, in millimeters.

References _backgroundColor, LibBoard::ShapeList::_shapes, LibBoard::Shape::bbox(), LibBoard::ShapeList::boundingBox(), LibBoard::Polyline::flushPostscript(), LibBoard::Rect::height, LibBoard::Rect::left, LibBoard::Rect::top, and LibBoard::Rect::width.

void LibBoard::Board::saveEPS | ( | const char * | filename,
|  | PageSize | size = `Board::BoundingBox`,
|  | double | margin = `10.0` |
| ) |  |  | 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:

  | filename | The EPS file name.
  | size | Page size (Either BoundingBox (default), A4 or Letter).
  | margin | Minimal margin around the figure in the page, in millimeters.

Examples:
  examples/arrows.cpp, examples/clipping.cpp, examples/ellipse.cpp, examples/example1.cpp, examples/example2.cpp, examples/example3.cpp, examples/example4.cpp, examples/graph.cpp, examples/koch.cpp, examples/logo.cpp, and examples/ruler.cpp.

Referenced by save().

void LibBoard::Board::saveFIG | ( | const char * | filename,
|  | double | pageWidth,
|  | double | pageHeight,
|  | double | margin = `10.0` |
| ) |  |  | 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:

  | filename | The XFig file name.
  | size | Page size (Either BoundingBox (default), A4 or Letter).
  | pageWidth | Width of the page in millimeters.
  | pageHeight | Height of the page in millimeters.
  | margin | Minimal margin around the figure in the page, in millimeters.

References _backgroundColor, LibBoard::ShapeList::_shapes, LibBoard::Shape::bbox(), LibBoard::ShapeList::boundingBox(), and LibBoard::Rectangle::flushFIG().

void LibBoard::Board::saveFIG | ( | const char * | filename,
|  | PageSize | size = `Board::BoundingBox`,
|  | double | margin = `10.0` |
| ) |  |  | 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:

  | filename | The name of the FIG file.
  | size | Page size (Either BoundingBox (default), A4 or Letter).
  | margin | Minimal margin around the figure in the page, in millimeters.

Examples:
  examples/arrows.cpp, examples/ellipse.cpp, examples/example1.cpp, examples/example2.cpp, examples/example3.cpp, examples/example4.cpp, examples/graph.cpp, examples/koch.cpp, examples/logo.cpp, and examples/ruler.cpp.

Referenced by save().

void LibBoard::Board::saveSVG | ( | const char * | filename,
|  | double | pageWidth,
|  | double | pageHeight,
|  | double | margin = `10.0` |
| ) |  |  | 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:

  | filename | The SVG file name.
  | size | Page size (Either BoundingBox (default), A4 or Letter).
  | pageWidth | Width of the page in millimeters.
  | pageHeight | Height of the page in millimeters.
  | margin | Minimal margin around the figure in the page, in millimeters.

References _backgroundColor, LibBoard::ShapeList::_shapes, LibBoard::Shape::bbox(), LibBoard::ShapeList::boundingBox(), LibBoard::Rectangle::flushSVG(), LibBoard::Rect::height, and LibBoard::Rect::width.

void LibBoard::Board::saveSVG | ( | const char * | filename,
|  | PageSize | size = `Board::BoundingBox`,
|  | double | margin = `10.0` |
| ) |  |  | 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:

  | filename | The name of the file.
  | size | Page size (Either BoundingBox (default), A4 or Letter).
  | margin | Minimal margin around the figure in the page, in millimeters.

Examples:
  examples/arrows.cpp, examples/clipping.cpp, examples/ellipse.cpp, examples/example1.cpp, examples/example2.cpp, examples/example3.cpp, examples/example4.cpp, examples/graph.cpp, examples/koch.cpp, examples/logo.cpp, and examples/ruler.cpp.

Referenced by save().

Board & LibBoard::Board::scale | ( | double | s | ) | `[virtual]`

Scale the shape along both axis.

Parameters:

  | s | The scale factor along both axis.

Returns:
  The shape itself.

Reimplemented from LibBoard::ShapeList.

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

Board & LibBoard::Board::scale | ( | double | sx,
|  | double | sy |
| ) |  |  | `[virtual]`

Scale the shape along the x an y axis.

Parameters:

  | sx | The scale factor along the x axis.
  | sy | The scale factor along the y axis.

Returns:
  The shape itself.

Reimplemented from LibBoard::ShapeList.

Examples:
  examples/arrows.cpp, examples/clipping.cpp, examples/example1.cpp, examples/example3.cpp, examples/example4.cpp, and examples/logo.cpp.

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

Referenced by scale().

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

Define a clipping path for the whole drawing.

Parameters:

  | points | A path.

References _state, and LibBoard::Path::pop_back().

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

Define a clipping path for the whole drawing.

Parameters:

  | points | A path.

References _state.

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 |

References _state.

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:

  | color | The fill color.

Returns:
  The board itself.

Examples:
  examples/example2.cpp.

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

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

Changes the current fill color.

Parameters:

  | red | Red component.
  | green | Green component.
  | blue | Blue component.
  | alpha | The opacity.

Returns:
  The board itself.

Examples:
  examples/example2.cpp.

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

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

Changes the current fill color.

Parameters:

  | red | Red component.
  | green | Green component.
  | blue | Blue component.
  | alpha | The opacity.

Returns:
  The board itself.

Examples:
  examples/example2.cpp.

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

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

Changes the current font and font size.

Parameters:

  | font | The name of the font.
  | fontSize | The new font size. (The unit is 1pt = 1/72 in).

Returns:
  The board itself.

Examples:
  examples/arrows.cpp, and examples/example2.cpp.

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

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

Changes the font size.

Parameters:

  | fontSize | The new font size. (The unit is 1pt = 1/72 in).

Returns:
  The board itself.

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

Board & LibBoard::Board::setLineCap | ( | Shape::LineCap | cap | ) | `[inline]`

Set the line cap style.

Parameters:

  | cap | The cap-style which can be Shape::ButtCap, Shape::RoundCap or Shape::SquareCap.

Returns:
  The board itself.

Examples:
  examples/logo.cpp.

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

Board & LibBoard::Board::setLineJoin | ( | Shape::LineJoin | join | ) | `[inline]`

Set the line joine style.

Parameters:

  | cap | The join-style which can be Shape::MiterJoin, Shape::RoundJoin or Shape::BevelJoin.

Returns:
  The board itself.

Examples:
  examples/example2.cpp, and examples/logo.cpp.

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

Board & LibBoard::Board::setLineStyle | ( | Shape::LineStyle | style | ) | `[inline]`

Changes the current line style.

Parameters:

  | style | The new line style.

Returns:
  The board itself.

Examples:
  examples/arrows.cpp, and examples/logo.cpp.

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

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

Changes the current line thickness (1/72 inche unit).

Parameters:

  | width | The new line thickness.

Returns:
  The board itself.

Examples:
  examples/arithmetic.cpp, examples/arrows.cpp, examples/example1.cpp, examples/example2.cpp, examples/logo.cpp, and examples/ruler.cpp.

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

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:

  | color | The pen color.

Returns:
  The board itself.

Examples:
  examples/arithmetic.cpp, and examples/example2.cpp.

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

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

Changes the current pen color.

Parameters:

  | red | Red
  | green |
  | blue |
  | alpha |

Returns:
  The board itself.

Examples:
  examples/arrows.cpp, and examples/example4.cpp.

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

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

Changes the current pen color.

Parameters:

  | red | Red component.
  | green | Green component.
  | blue | Blue component.

Returns:
  The board itself.

Examples:
  examples/arithmetic.cpp, examples/arrows.cpp, examples/example1.cpp, examples/example2.cpp, examples/example3.cpp, and examples/logo.cpp.

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

void LibBoard::Board::setUnit | ( | double | factor,
|  | Unit | unit |
| ) |  |  |

Set the unit used by the drawSomething methods.

Parameters:

  | factor | The factor of the unit.
  | unit | The unit to be used in { PT, IN, CM, MM }.

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

void LibBoard::Board::setUnit | ( | Unit | unit | ) |

Set the unit used by the drawSomething methods.

Parameters:

  | unit | The unit to be used in { PT, IN, CM, MM }.

Examples:
  examples/arrows.cpp.

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

Referenced by operator<<().

Board & LibBoard::Board::translate | ( | double | dx,
|  | double | dy |
| ) |  |  | `[virtual]`

Translate the shape by a given offset.

Parameters:

  | dx | The x offset.
  | dy | The y offset.

Returns:
  A reference to the shape itself.

Reimplemented from LibBoard::ShapeList.

References LibBoard::Path::translate().

## Member Data Documentation

Color LibBoard::Board::_backgroundColor `[protected]`

The color of the background.

Referenced by backgroundColor(), clear(), saveEPS(), saveFIG(), and saveSVG().

State LibBoard::Board::_state `[protected]`

The current state.

Referenced by drawArrow(), drawBoundingBox(), drawCircle(), drawClosedPolyline(), drawDot(), drawEllipse(), drawLine(), drawPolyline(), drawRectangle(), drawText(), drawTriangle(), fillCircle(), fillEllipse(), fillGouraudTriangle(), fillPolyline(), fillRectangle(), fillTriangle(), operator<<(), setClippingPath(), setClippingRectangle(), setFillColor(), setFillColorRGBf(), setFillColorRGBi(), setFont(), setFontSize(), setLineCap(), setLineJoin(), setLineStyle(), setLineWidth(), setPenColor(), setPenColorRGBf(), setPenColorRGBi(), and setUnit().

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

- include/Board.h
- src/Board.cpp