Board
0.9.5
|
Class for EPS, FIG or SVG drawings. More...
#include <Board.h>
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) | |
Board & | operator= (const Board &other) |
Board & | operator<< (const Shape &shape) |
void | clear (const Color &color=Color::Null) |
void | clear (unsigned char red, unsigned char green, unsigned char blue) |
Board & | rotate (double angle, const Point ¢er) override |
Board & | rotate (double angle) override |
Board & | translate (double dx, double dy) override |
Board & | scale (double sx, double sy) override |
Board & | scale (double s) override |
Board | rotated (double angle, const Point ¢er) |
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) |
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 & | setFillColorHSV (float hue, float saturation, float value, float alpha=1.0f) |
Board & | setFillColor (const Color &color) |
Board & | setLineWidth (double width) |
Board & | setLineStyle (LineStyle style) |
Board & | setLineCap (LineCap cap) |
Board & | setLineJoin (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 Color & | penColor () const |
penColor More... | |
const Color & | fillColor () const |
fillColor More... | |
const Style & | style () const |
Public Member Functions inherited from LibBoard::ShapeList | |
ShapeList (const ShapeList &other) | |
ShapeList & | operator= (const ShapeList &other) |
ShapeList (ShapeList &&other) | |
ShapeList & | operator= (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 |
ShapeList & | clear () |
ShapeList & | rotate (double angle, const Point ¢er) override |
ShapeList | rotated (double angle, const Point ¢er) |
ShapeList & | rotate (double angle) override |
ShapeList | rotated (double angle) |
ShapeList & | translate (double dx, double dy) override |
ShapeList | translated (double dx, double dy) |
ShapeList & | scale (double sx, double sy) override |
ShapeList & | scale (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 |
ShapeList * | clone () const override |
ShapeList & | push_back (Shape *shape) |
ShapeList & | operator<< (const Shape &shape) |
ShapeList & | operator+= (const Shape &shape) |
ShapeList & | append (const Shape &shape, Direction direction=ShapeList::Right, Alignment alignment=ShapeList::AlignCenter, double margin=0.0, LineWidthFlag lineWidthFlag=UseLineWidth) |
Group & | addTiling (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) |
ShapeList & | dup (std::size_t copies=1) |
template<typename T > | |
T & | last (const std::size_t position=0) |
Shape & | last (const std::size_t position=0) |
template<typename T > | |
T & | topLevelFindLast (std::size_t position=0) |
Shape & | top () |
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... | |
Shape * | accept (CompositeShapeTransform &transform) const override |
Accept a composite shape transform. More... | |
Shape * | accept (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 |
Shape & | rotateDeg (double angle, const Point ¢er) |
Shape & | rotateDeg (double angle) |
Shape & | moveCenter (double x, double y, LineWidthFlag lineWidthFlag=IgnoreLineWidth) |
Shape & | moveCenter (Point p, LineWidthFlag lineWidthFlag=IgnoreLineWidth) |
Shape & | resize (double width, double height, LineWidthFlag lineWidthFlag) |
Shape & | scaleToWidth (double w, LineWidthFlag lineWidthFlag) |
Shape & | scaleToHeight (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 () |
Class for EPS, FIG or SVG drawings.
The Board class.
LibBoard::Board::Board | ( | const Color & | backgroundColor = Color::Null | ) |
Constructs a new board and sets the background color, if any.
backgroundColor | A color for the drawing's background. |
Referenced by rotated(), scaled(), and translated().
LibBoard::Board::Board | ( | const Board & | other | ) |
Copy constructor.
other | The object to be copied. |
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.
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. |
References LibBoard::Shape::clone(), scale(), LibBoard::Shape::scale(), and LibBoard::Shape::translate().
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.
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. |
angle | An angular increment. |
References LibBoard::Shape::clone(), LibBoard::Shape::rotate(), LibBoard::Shape::scale(), and LibBoard::Shape::translate().
void LibBoard::Board::backgroundColor | ( | const Color & | color | ) |
Changes the background color of the whole drawing.
color | A color (may be Color::None). |
References _backgroundColor.
void LibBoard::Board::clear | ( | const Color & | color = Color::Null | ) |
Clears the board with a given background color.
color | The board background color (may be Color::None). |
References _backgroundColor, and LibBoard::ShapeList::clear().
|
inline |
Clears the board and set the background color from an RGB triple.
red | |
green | |
blue |
References LibBoard::ShapeList::clear().
|
static |
Globally disable linewidth scaling when using scale functions.
References LibBoard::ShapeWithStyle::setLineWidthScaling().
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.
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. |
type | The arrow extremity type. |
References LibBoard::ShapeList::_shapes, _state, and LibBoard::Board::State::style.
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).
p | First extremity. |
q | Second extremity. |
type | The arrow extremity type. |
References LibBoard::ShapeList::_shapes, _state, and LibBoard::Board::State::style.
void LibBoard::Board::drawBoundingBox | ( | LineWidthFlag | lineWidthFlag | ) |
Draws the current drawing's bounding box as a rectangle.
lineWidthFlag | Should the line width be considered when computing bounding boxes. |
References LibBoard::Shape::bbox(), and LibBoard::ShapeList::boundingBox().
void LibBoard::Board::drawCircle | ( | double | x, |
double | y, | ||
double | radius | ||
) |
Draws a circle.
x | First coordinate of the circle's center. |
y | Second coordinate of the circle's center. |
radius | Radius of the circle. |
References LibBoard::ShapeList::_shapes.
void LibBoard::Board::drawClosedPolyline | ( | const std::vector< Point > & | points | ) |
Draws a closed polygonal line.
points | A vector of points. |
References LibBoard::ShapeList::_shapes, _state, and LibBoard::Board::State::style.
void LibBoard::Board::drawDot | ( | double | x, |
double | y | ||
) |
Draws a dot at coordinates (x,y).
x | First coordinate of the dot. |
y | Second coordinate of the dot. |
References LibBoard::ShapeList::_shapes, _state, and LibBoard::Board::State::style.
void LibBoard::Board::drawEllipse | ( | double | x, |
double | y, | ||
double | xRadius, | ||
double | yRadius | ||
) |
Draws an ellipse.
x | First coordinate of the circle's center. |
y | Second coordinate of the circle's center. |
xRadius | Radius of the circle along the x axis. |
yRadius | Radius of the circle along the y axis. |
References LibBoard::ShapeList::_shapes, _state, and LibBoard::Board::State::style.
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.
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. |
References LibBoard::ShapeList::_shapes, _state, and LibBoard::Board::State::style.
Draws a line from p to q using current style parameters.
p | First extremity. |
q | Second extremity. |
References LibBoard::ShapeList::_shapes, _state, and LibBoard::Board::State::style.
void LibBoard::Board::drawPolyline | ( | const std::vector< Point > & | points | ) |
Draws a polygonal line.
points | A vector of points. |
References LibBoard::ShapeList::_shapes, _state, and LibBoard::Board::State::style.
void LibBoard::Board::drawRectangle | ( | const Rect & | rect | ) |
Draws a rectangle.
rect | Position and size of the rectangle. |
References LibBoard::ShapeList::_shapes.
void LibBoard::Board::drawRectangle | ( | double | left, |
double | top, | ||
double | width, | ||
double | height | ||
) |
Draws a rectangle.
left | First coordinate of the upper left corner. |
top | Second coordinate of the upper left corner. |
width | Width of the rectangle. |
height | Height of the rectangle. |
References LibBoard::ShapeList::_shapes.
void LibBoard::Board::drawText | ( | double | x, |
double | y, | ||
const char * | text | ||
) |
Draws a string of text.
x | The first coordinates of the lower left corner. |
y | The second coordinates of the lower left corner. |
text | The text. |
References LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::font, LibBoard::Board::State::fontSize, and LibBoard::Board::State::style.
void LibBoard::Board::drawText | ( | double | x, |
double | y, | ||
const std::string & | text | ||
) |
Draws a string of text.
x | The first coordinates of the lower left corner. |
y | The second coordinates of the lower left corner. |
text | The text. |
References LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::font, LibBoard::Board::State::fontSize, and LibBoard::Board::State::style.
void LibBoard::Board::drawText | ( | Point | p, |
const char * | text | ||
) |
Draws a string of text.
p | Position of the bottom-left corner. |
text | The text. |
References LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::font, LibBoard::Board::State::fontSize, and LibBoard::Board::State::style.
void LibBoard::Board::drawText | ( | Point | p, |
const std::string & | str | ||
) |
Draws a string of text.
p | Position of the bottom-left corner. |
str | The text. |
References LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::font, LibBoard::Board::State::fontSize, and LibBoard::Board::State::style.
Draws a triangle.
p1 | First vertex. |
p2 | Second vertex. |
p3 | Third vertex. |
References LibBoard::ShapeList::_shapes, _state, and LibBoard::Board::State::style.
void LibBoard::Board::drawTriangle | ( | double | x1, |
double | y1, | ||
double | x2, | ||
double | y2, | ||
double | x3, | ||
double | y3 | ||
) |
Draws a triangle.
x1 | First coordinate of the first vertex. |
y1 | Second coordinate of the first vertex. |
x2 | First coordinate of the second vertex. |
y2 | Second coordinate of the second vertex. |
x3 | First coordinate of the third vertex. |
y3 | Second coordinate of the third vertex. |
References LibBoard::ShapeList::_shapes, _state, and LibBoard::Board::State::style.
|
static |
Globally enable linewidth scaling when using scale functions.
References LibBoard::ShapeWithStyle::setLineWidthScaling().
void LibBoard::Board::fillCircle | ( | double | x, |
double | y, | ||
double | radius | ||
) |
Draws a circle filled with the current pen color.
x | First coordinate of the circle's center. |
y | Second coordinate of the circle's center. |
radius | Radius of the circle. |
References LibBoard::ShapeList::_shapes.
|
inline |
void LibBoard::Board::fillEllipse | ( | double | x, |
double | y, | ||
double | xRadius, | ||
double | yRadius | ||
) |
Draws an ellipse filled with the current pen color.
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. |
References LibBoard::ShapeList::_shapes, _state, and LibBoard::Board::State::style.
|
inline |
Draws a triangle with Gouraud-like shaded colors.
x1 | |
y1 | |
color1 | |
x2 | |
y2 | |
color2 | |
x3 | |
y3 | |
color3 | |
divisions |
References fillGouraudTriangle().
|
inline |
Draws a triangle with a Gouraud-like shaded color according to the current fill color and a brightness value given for each vertex.
x1 | |
y1 | |
brightness1 | |
x2 | |
y2 | |
brightness2 | |
x3 | |
y3 | |
brightness3 | |
divisions |
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 |
||
) |
Draws a triangle with Gouraud-like shaded colors.
p1 | |
color1 | |
p2 | |
color2 | |
p3 | |
color3 | |
divisions | number of triangle subdivisions. |
References LibBoard::ShapeList::_shapes.
Referenced by 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 |
||
) |
Draws a triangle with a Gouraud-like shaded color according to the current fill color and a brightness value given for each vertex.
p1 | |
brightness1 | |
p2 | |
brightness2 | |
p3 | |
brightness3 | |
divisions | number of triangle subdivisions. |
References _state, fillGouraudTriangle(), and LibBoard::Board::State::style.
void LibBoard::Board::fillPolyline | ( | const std::vector< Point > & | points | ) |
Draws a filled polygon.
points | A vector of points. |
References LibBoard::ShapeList::_shapes, _state, and LibBoard::Board::State::style.
void LibBoard::Board::fillRectangle | ( | const Rect & | rect | ) |
Draws a rectangle filled with the current pen color.
rect | Position and size of the rectangle. |
References fillRectangle(), LibBoard::Rect::height, LibBoard::Rect::left, LibBoard::Rect::top, and LibBoard::Rect::width.
void LibBoard::Board::fillRectangle | ( | double | left, |
double | top, | ||
double | width, | ||
double | height | ||
) |
Draws a rectangle filled with the current pen color.
left | First coordinate of the upper left corner. |
top | Second coordinate of the upper left corner. |
width | Width of the rectangle. |
height | Height of the rectangle. |
References LibBoard::ShapeList::_shapes, _state, style(), and LibBoard::Board::State::style.
Referenced by fillRectangle().
Draws a filled triangle.
p1 | First vertex. |
p2 | Second vertex. |
p3 | Third vertex. |
References LibBoard::ShapeList::_shapes, _state, and LibBoard::Board::State::style.
void LibBoard::Board::fillTriangle | ( | double | x1, |
double | y1, | ||
double | x2, | ||
double | y2, | ||
double | x3, | ||
double | y3 | ||
) |
Draws a filled triangle.
x1 | First coordinate of the first vertex. |
y1 | Second coordinate of the first vertex. |
x2 | First coordinate of the second vertex. |
y2 | Second coordinate of the second vertex. |
x3 | First coordinate of the third vertex. |
y3 | Second coordinate of the third vertex. |
References LibBoard::ShapeList::_shapes, _state, and LibBoard::Board::State::style.
Add a shape to the board, using the current unit factor.
shape | A shape. (Might be a list of shapes, actually!) |
The operator =
other | The object to be copied. |
References LibBoard::ShapeList::_shapes, LibBoard::ShapeList::deleteShapes(), and LibBoard::ShapeList::end().
|
inline |
penColor
References _state, and LibBoard::Board::State::style.
|
overridevirtual |
Rotate the shape around its center.
angle | The rotation angle in radian. |
Implements LibBoard::Shape.
References LibBoard::Shape::center(), LibBoard::ShapeList::rotate(), and LibBoard::Path::rotate().
Rotate the shape around a given center of rotation.
angle | The rotation angle in radian. |
center | The center of rotation. |
Implements LibBoard::Shape.
References LibBoard::Shape::center(), LibBoard::ShapeList::rotate(), and LibBoard::Path::rotate().
Board LibBoard::Board::rotated | ( | double | angle | ) |
Get a rotated copy of the Board around a specified rotation center.
angle | Rotation angle in radian |
center | Center of rotation |
References Board(), and LibBoard::Shape::center().
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.
filename | Path of the file to be created. |
pageWidth | Width of the page. |
pageHeight | Height of the page. |
margin | Minimal margin around the figure in the page. |
unit | The unit used to express the previous length parameters (default value is millimeter). |
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.
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. |
unit | The 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 LibBoard::ShapeList::size().
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.
filename | The EPS file name. |
pageWidth | Width of the page. |
pageHeight | Height of the page. |
margin | Minimal margin around the figure in the page. |
unit | The unit used to express the previous length parameters (default value is millimeter). |
title | Document title (Postscript comment). |
References saveEPS().
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.
filename | The EPS file name. |
size | Page size (Either BoundingBox (default), A4 or Letter). |
margin | Minimal margin around the figure in the page. |
unit | The unit used to express the margin (default value is millimeter). If size is "BoundingBox", this unit is used for the bounding box as well. |
title | Document title (Postscript comment). |
References saveEPS(), and LibBoard::ShapeList::size().
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.
out | The output stream. |
pageWidth | Width of the page. |
pageHeight | Height of the page. |
margin | Minimal margin around the figure in the page. |
unit | The unit used to express the previous length parameters (default value is millimeter). |
title | Document title (Postscript comment). |
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.
out | The output stream. |
size | Page size (Either BoundingBox (default), A4 or Letter). |
margin | Minimal margin around the figure in the page. |
unit | The unit used to express the margin (default value is millimeter). If size is "BoundingBox", this unit is used for the bounding box as well. |
title | Document title (Postscript comment). |
References LibBoard::ShapeList::size().
Referenced by saveEPS().
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.
filename | The XFig file name. |
pageWidth | Width of the page. |
pageHeight | Height of the page. |
margin | Minimal margin around the figure in the page. |
unit | The unit used to express the previous length parameters (default value is millimeter). |
References saveFIG().
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.
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. |
unit | The 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 LibBoard::ShapeList::size().
Referenced by saveFIG().
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.
out | The output stream. |
pageWidth | Width of the page. |
pageHeight | Height of the page. |
margin | Minimal margin around the figure in the page. |
unit | The unit used to express the previous length parameters (default value is millimeter). |
References LibBoard::Shape::bbox(), and LibBoard::ShapeList::boundingBox().
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.
out | The output stream. |
size | Page size (Either BoundingBox (default), A4 or Letter). |
margin | Minimal margin around the figure in the page. |
unit | The 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().
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.
filename | The SVG file name. |
pageWidth | Width of the page. |
pageHeight | Height of the page. |
margin | Minimal margin around the figure in the page. |
unit | The unit used to express the previous length parameters (default value is millimeter). |
References saveSVG().
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.
filename | The name of the file. |
size | Page size (Either BoundingBox (default), A4 or Letter). |
margin | Minimal margin around the figure in the page. |
unit | The 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 LibBoard::ShapeList::size().
Referenced by saveSVG().
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.
out | The output stream. |
pageWidth | Width of the page. |
pageHeight | Height of the page. |
margin | Minimal margin around the figure in the page. |
unit | The unit used to express the previous length parameters (default value is millimeter). |
References LibBoard::Shape::bbox(), and LibBoard::ShapeList::boundingBox().
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.
out | The output stream. |
size | Page size (Either BoundingBox (default), A4 or Letter). |
margin | Minimal margin around the figure in the page. |
unit | The 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().
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.
filename | The name of the file. |
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 saveTikZ().
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.
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. |
References LibBoard::ShapeList::size().
Referenced by saveTikZ().
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.
out | The output stream. |
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 LibBoard::ShapeList::boundingBox().
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.
out | The output stream. |
size | Page size (Either BoundingBox (default), A4 or Letter). |
margin | Minimal margin around the figure in the page, in millimeters. |
References saveTikZ(), and LibBoard::ShapeList::size().
|
overridevirtual |
Scale the shape along both axis.
s | The scaling factor along both axis. |
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.
|
overridevirtual |
Scale the shape along the x an y axis.
sx | The scaling factor along the x axis. |
sy | The scaling factor along the y axis. |
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.
Referenced by addDuplicates().
Board LibBoard::Board::scaled | ( | double | s | ) |
Board LibBoard::Board::scaled | ( | double | sx, |
double | sy | ||
) |
Get a scaled copy of the Board.
sx | x scaling factor |
sy | y scaling factor |
References Board().
void LibBoard::Board::setClippingPath | ( | const Path & | path | ) |
Define a clipping path for the whole drawing.
path | A path. |
References LibBoard::Path::pop_back().
void LibBoard::Board::setClippingPath | ( | const std::vector< Point > & | points | ) |
Define a clipping path for the whole drawing.
points | A path. |
References LibBoard::ShapeList::end().
void LibBoard::Board::setClippingRectangle | ( | const Rect & | rect | ) |
Define a clipping rectangle for the whole drawing.
rect | The clipping rectangle. |
References LibBoard::Rect::height, LibBoard::Rect::left, setClippingRectangle(), LibBoard::Rect::top, and LibBoard::Rect::width.
void LibBoard::Board::setClippingRectangle | ( | double | x, |
double | y, | ||
double | width, | ||
double | height | ||
) |
Define a clipping rectangle for the whole drawing.
x | |
y | |
width | |
height |
Referenced by setClippingRectangle().
Changes the current fill color.
In order to use no fill color, one may set this color to Color::None.
color | The fill color. |
References _state, and LibBoard::Board::State::style.
Board & LibBoard::Board::setFillColorHSV | ( | float | hue, |
float | saturation, | ||
float | value, | ||
float | alpha = 1.0f |
||
) |
Changes the current fill color (HSV version)
hue | |
saturation | |
value | |
alpha |
References _state, LibBoard::Color::setHSV(), and LibBoard::Board::State::style.
Board & LibBoard::Board::setFillColorRGBf | ( | float | red, |
float | green, | ||
float | blue, | ||
float | alpha = 1.0f |
||
) |
Changes the current fill color (RGB version).
red | Red component. |
green | Green component. |
blue | Blue component. |
alpha | The opacity. |
References _state, and LibBoard::Board::State::style.
Board & LibBoard::Board::setFillColorRGBi | ( | unsigned char | red, |
unsigned char | green, | ||
unsigned char | blue, | ||
unsigned char | alpha = 255 |
||
) |
Changes the current fill color.
red | Red component. |
green | Green component. |
blue | Blue component. |
alpha | The opacity. |
References _state, LibBoard::Color::setRGBi(), and LibBoard::Board::State::style.
Board & LibBoard::Board::setFont | ( | const Fonts::Font | font, |
double | fontSize | ||
) |
Changes the current font and font size.
font | The name of the font. |
fontSize | The new font size. |
References _state, LibBoard::Board::State::font, and LibBoard::Board::State::fontSize.
Board & LibBoard::Board::setFontSize | ( | double | fontSize | ) |
Changes the font size.
fontSize | The new font size. |
References _state, and LibBoard::Board::State::fontSize.
|
inline |
Set the line cap style.
cap | The cap-style. |
References _state, and LibBoard::Board::State::style.
|
inline |
Set the line join style.
join | The join-style |
References _state, and LibBoard::Board::State::style.
|
inline |
Changes the current line style.
style | The new line style. |
References _state, style(), and LibBoard::Board::State::style.
Board & LibBoard::Board::setLineWidth | ( | double | width | ) |
Changes the current line thickness.
width | The new line thickness. |
References _state, and LibBoard::Board::State::style.
|
static |
Globally enable/disable linewidth scaling when using scale functions.
References LibBoard::ShapeWithStyle::setLineWidthScaling().
Changes the current pen color.
In order to use no pen, one may set the pen color to Color::None.
color | The pen color. |
References _state, and LibBoard::Board::State::style.
Board & LibBoard::Board::setPenColorRGBf | ( | float | red, |
float | green, | ||
float | blue, | ||
float | alpha = 1.0f |
||
) |
Changes the current pen color.
red | Red component [0..1]. |
green | Green component [0..1]. |
blue | Blue component [0..1]. |
alpha | Transparency [0..1]. |
References _state, and LibBoard::Board::State::style.
Board & LibBoard::Board::setPenColorRGBi | ( | unsigned char | red, |
unsigned char | green, | ||
unsigned char | blue, | ||
unsigned char | alpha = 255 |
||
) |
Changes the current pen color.
red | Red component [0..255]. |
green | Green component [0..255]. |
blue | Blue component [0..255]. |
alpha | Transparency channel [0..255]. |
References _state, LibBoard::Color::setRGBi(), and LibBoard::Board::State::style.
|
inline |
Return the current style used when drawing shapes with board methods.
References _state, and LibBoard::Board::State::style.
Referenced by fillRectangle(), and setLineStyle().
|
overridevirtual |
Translate the shape by a given offset.
dx | The x offset. |
dy | The y offset. |
Implements LibBoard::Shape.
References LibBoard::ShapeList::translate(), and LibBoard::Path::translate().
Board LibBoard::Board::translated | ( | double | dx, |
double | dy | ||
) |
|
protected |
The color of the background.
Referenced by backgroundColor(), and clear().
|
protected |
The current state.
Referenced by drawArrow(), drawClosedPolyline(), drawDot(), drawEllipse(), drawLine(), drawPolyline(), drawText(), drawTriangle(), fillColor(), fillEllipse(), fillGouraudTriangle(), fillPolyline(), fillRectangle(), fillTriangle(), penColor(), setFillColor(), setFillColorHSV(), setFillColorRGBf(), setFillColorRGBi(), setFont(), setFontSize(), setLineCap(), setLineJoin(), setLineStyle(), setLineWidth(), setPenColor(), setPenColorRGBf(), setPenColorRGBi(), and style().