#include <Board.h>
Public Member Functions | |
Board (const Color &backgroundColor=Color::none) | |
void | clear (const Color &color=Color::none) |
void | clear (unsigned char red, unsigned char green, unsigned char blue) |
void | drawLine (float x1, float y1, float x2, float y2, unsigned int depth=0) |
void | drawArrow (float x1, float y1, float x2, float y2, bool filled=false, unsigned int depth=0) |
void | drawTriangle (float x1, float y1, float x2, float y2, float x3, float y3, unsigned int depth=0) |
void | drawTriangle (const Point &p1, const Point &p2, const Point &p3, unsigned int depth=0) |
void | fillTriangle (float x1, float y1, float x2, float y2, float x3, float y3, unsigned int depth=0) |
void | fillGouraudTriangle (const Point &p1, const Color &color1, const Point &p2, const Color &color2, const Point &p3, const Color &color3, unsigned char divisions=3, unsigned int depth=0) |
void | fillGouraudTriangle (const float x1, const float y1, const Color &color1, const float x2, const float y2, const Color &color2, const float x3, const float y3, const Color &color3, unsigned char divisions=3, unsigned int depth=0) |
void | fillGouraudTriangle (const Point &p1, const float brightness1, const Point &p2, const float brightness2, const Point &p3, const float brightness3, unsigned char divisions=3, unsigned int depth=0) |
void | fillGouraudTriangle (const float x1, const float y1, const float brightness1, const float x2, const float y2, const float brightness1, const float x3, const float y3, const float brightness1, unsigned char divisions=3, unsigned int depth=0) |
void | fillTriangle (const Point &p1, const Point &p2, const Point &p3, unsigned int depth=0) |
void | drawRectangle (float x, float y, float width, float height, unsigned int depth=0) |
void | fillRectangle (float x, float y, float width, float height, unsigned int depth=0) |
void | drawCircle (float x, float y, float radius, unsigned int depth=0) |
void | fillCircle (float x, float y, float radius, unsigned int depth=0) |
void | drawEllipse (float x, float y, float xRadius, float yRadius, unsigned int depth=0) |
void | fillEllipse (float x, float y, float xRadius, float yRadius, unsigned int depth=0) |
void | drawPolyline (const std::vector< Point > &points, unsigned int depth=0) |
void | drawClosedPolyline (const std::vector< Point > &points, unsigned int depth=0) |
void | fillPolyline (const std::vector< Point > &points, unsigned int depth=0) |
void | drawText (float x, float y, const char *text, unsigned int depth=0) |
Board & | setFont (std::string font, float fontSize) |
Board & | setFontSize (float 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 (float width) |
Board & | setLineCap (Shape::LineCap cap) |
Board & | setLineJoin (Shape::LineJoin join) |
void | backgroundColor (const Color &color) |
void | drawBoundingBox (unsigned int depth=0) |
void | save (const char *filename) const |
void | saveEPS (const char *filename, float scale=1.0f) const |
void | saveFIG (const char *filename, float scale=1.0f) const |
void | saveSVG (const char *filename, float scale=1.0f) const |
Board (const Color &backgroundColor=Color::none) | |
void | clear (const Color &color=Color::none) |
void | clear (unsigned char red, unsigned char green, unsigned char blue) |
void | drawLine (float x1, float y1, float x2, float y2, unsigned int depth=0) |
void | drawArrow (float x1, float y1, float x2, float y2, bool filled=false, unsigned int depth=0) |
void | drawTriangle (float x1, float y1, float x2, float y2, float x3, float y3, unsigned int depth=0) |
void | drawTriangle (const Point &p1, const Point &p2, const Point &p3, unsigned int depth=0) |
void | fillTriangle (float x1, float y1, float x2, float y2, float x3, float y3, unsigned int depth=0) |
void | fillGouraudTriangle (const Point &p1, const Color &color1, const Point &p2, const Color &color2, const Point &p3, const Color &color3, unsigned char divisions=3, unsigned int depth=0) |
void | fillGouraudTriangle (const float x1, const float y1, const Color &color1, const float x2, const float y2, const Color &color2, const float x3, const float y3, const Color &color3, unsigned char divisions=3, unsigned int depth=0) |
void | fillGouraudTriangle (const Point &p1, const float brightness1, const Point &p2, const float brightness2, const Point &p3, const float brightness3, unsigned char divisions=3, unsigned int depth=0) |
void | fillGouraudTriangle (const float x1, const float y1, const float brightness1, const float x2, const float y2, const float brightness1, const float x3, const float y3, const float brightness1, unsigned char divisions=3, unsigned int depth=0) |
void | fillTriangle (const Point &p1, const Point &p2, const Point &p3, unsigned int depth=0) |
void | drawRectangle (float x, float y, float width, float height, unsigned int depth=0) |
void | fillRectangle (float x, float y, float width, float height, unsigned int depth=0) |
void | drawCircle (float x, float y, float radius, unsigned int depth=0) |
void | fillCircle (float x, float y, float radius, unsigned int depth=0) |
void | drawEllipse (float x, float y, float xRadius, float yRadius, unsigned int depth=0) |
void | fillEllipse (float x, float y, float xRadius, float yRadius, unsigned int depth=0) |
void | drawPolyline (const std::vector< Point > &points, unsigned int depth=0) |
void | drawClosedPolyline (const std::vector< Point > &points, unsigned int depth=0) |
void | fillPolyline (const std::vector< Point > &points, unsigned int depth=0) |
void | drawText (float x, float y, const char *text, unsigned int depth=0) |
Board & | setFont (std::string font, float fontSize) |
Board & | setFontSize (float 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 (float width) |
Board & | setLineCap (Shape::LineCap cap) |
Board & | setLineJoin (Shape::LineJoin join) |
void | backgroundColor (const Color &color) |
void | drawBoundingBox (unsigned int depth=0) |
void | save (const char *filename) const |
void | saveEPS (const char *filename, float scale=1.0f) const |
void | saveFIG (const char *filename, float scale=1.0f) const |
void | saveSVG (const char *filename, float scale=1.0f) const |
Protected Member Functions | |
Rect | computeBoundingBox () const |
Rect | computeBoundingBox () const |
Protected Attributes | |
Color | _penColor |
Color | _fillColor |
float | _lineWidth |
Shape::LineCap | _lineCap |
Shape::LineJoin | _lineJoin |
std::string | _font |
float | _fontSize |
unsigned int | _depth |
std::vector< Shape * > | _shapes |
Color | _backgroundColor |
std::vector< Shape * > | _shapes |
The Board class.
examples/arithmetic.cc, examples/example1.cc, and examples/example2.cc.
BoardLib::Board::Board | ( | const Color & | backgroundColor = Color::none |
) |
Constructs a new board and sets the background color, if any.
backgroundColor | A color for the drawing's background. |
BoardLib::Board::Board | ( | const Color & | backgroundColor = Color::none |
) |
Constructs a new board and sets the background color, if any.
backgroundColor | A color for the drawing's background. |
void BoardLib::Board::clear | ( | const Color & | color = Color::none |
) |
Clears the board with a given background color.
color | The board background color (may be Color::none). |
void BoardLib::Board::clear | ( | unsigned char | red, | |
unsigned char | green, | |||
unsigned char | blue | |||
) | [inline] |
Clears the board and set the background color from an RGB triple.
red | ||
green | ||
blue |
void BoardLib::Board::drawLine | ( | float | x1, | |
float | y1, | |||
float | x2, | |||
float | y2, | |||
unsigned int | depth = 0 | |||
) |
Draws a line from (x1,y1) to (x2,y2).
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. |
void BoardLib::Board::drawArrow | ( | float | x1, | |
float | y1, | |||
float | x2, | |||
float | y2, | |||
bool | filled = false , |
|||
unsigned int | depth = 0 | |||
) |
Draws a line from (x1,y1) to (x2,y2) with an arrow at (x2,y2).
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. |
void BoardLib::Board::drawTriangle | ( | float | x1, | |
float | y1, | |||
float | x2, | |||
float | y2, | |||
float | x3, | |||
float | y3, | |||
unsigned int | depth = 0 | |||
) |
Draws a triangle.
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. |
void BoardLib::Board::drawTriangle | ( | const Point & | p1, | |
const Point & | p2, | |||
const Point & | p3, | |||
unsigned int | depth = 0 | |||
) |
Draws a triangle.
p1 | First vertex. | |
p2 | Second vertex. | |
p3 | Third vertex. | |
depth | Depth of the triangle. |
void BoardLib::Board::fillTriangle | ( | float | x1, | |
float | y1, | |||
float | x2, | |||
float | y2, | |||
float | x3, | |||
float | y3, | |||
unsigned int | depth = 0 | |||
) |
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. | |
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. |
void BoardLib::Board::fillGouraudTriangle | ( | const Point & | p1, | |
const Color & | color1, | |||
const Point & | p2, | |||
const Color & | color2, | |||
const Point & | p3, | |||
const Color & | color3, | |||
unsigned char | divisions = 3 , |
|||
unsigned int | depth = 0 | |||
) |
Draws a triangle with Gouraud-like shaded colors.
p1 | ||
color1 | ||
p2 | ||
color2 | ||
p3 | ||
color3 | ||
divisions | number of triangle subdivisions. | |
depth | The depth of the triangle. |
void BoardLib::Board::fillGouraudTriangle | ( | const float | x1, | |
const float | y1, | |||
const Color & | color1, | |||
const float | x2, | |||
const float | y2, | |||
const Color & | color2, | |||
const float | x3, | |||
const float | y3, | |||
const Color & | color3, | |||
unsigned char | divisions = 3 , |
|||
unsigned int | depth = 0 | |||
) | [inline] |
Draws a triangle with Gouraud-like shaded colors.
x1 | ||
y1 | ||
color1 | ||
x2 | ||
y2 | ||
color2 | ||
x3 | ||
y3 | ||
color3 | ||
divisions | ||
depth |
void BoardLib::Board::fillGouraudTriangle | ( | const Point & | p1, | |
const float | brightness1, | |||
const Point & | p2, | |||
const float | brightness2, | |||
const Point & | p3, | |||
const float | brightness3, | |||
unsigned char | divisions = 3 , |
|||
unsigned int | depth = 0 | |||
) |
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. | |
depth | The depth of the triangle. |
void BoardLib::Board::fillGouraudTriangle | ( | const float | x1, | |
const float | y1, | |||
const float | brightness1, | |||
const float | x2, | |||
const float | y2, | |||
const float | brightness1, | |||
const float | x3, | |||
const float | y3, | |||
const float | brightness1, | |||
unsigned char | divisions = 3 , |
|||
unsigned int | depth = 0 | |||
) | [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 | ||
depth |
void BoardLib::Board::fillTriangle | ( | const Point & | p1, | |
const Point & | p2, | |||
const Point & | p3, | |||
unsigned int | depth = 0 | |||
) |
Draws a filled triangle.
p1 | First vertex. | |
p2 | Second vertex. | |
p3 | Third vertex. | |
depth | Depth of the triangle. |
void BoardLib::Board::drawRectangle | ( | float | x, | |
float | y, | |||
float | width, | |||
float | height, | |||
unsigned int | depth = 0 | |||
) |
Draws a rectangle.
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. |
void BoardLib::Board::fillRectangle | ( | float | x, | |
float | y, | |||
float | width, | |||
float | height, | |||
unsigned int | depth = 0 | |||
) |
Draws a rectangle filled with the current pen color.
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. |
void BoardLib::Board::drawCircle | ( | float | x, | |
float | y, | |||
float | radius, | |||
unsigned int | depth = 0 | |||
) |
Draws a circle.
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. |
void BoardLib::Board::fillCircle | ( | float | x, | |
float | y, | |||
float | radius, | |||
unsigned int | depth = 0 | |||
) |
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. | |
depth | Depth of the circle. |
void BoardLib::Board::drawEllipse | ( | float | x, | |
float | y, | |||
float | xRadius, | |||
float | yRadius, | |||
unsigned int | depth = 0 | |||
) |
Draws an ellipse.
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. |
void BoardLib::Board::fillEllipse | ( | float | x, | |
float | y, | |||
float | xRadius, | |||
float | yRadius, | |||
unsigned int | depth = 0 | |||
) |
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. | |
depth | Depth of the circle. |
void BoardLib::Board::drawPolyline | ( | const std::vector< Point > & | points, | |
unsigned int | depth = 0 | |||
) |
Draws a polygonal line.
points | A vector of points. | |
depth | The depth of the polyline. |
void BoardLib::Board::drawClosedPolyline | ( | const std::vector< Point > & | points, | |
unsigned int | depth = 0 | |||
) |
Draws a closed polygonal line.
points | A vector of points. | |
depth | The depth of the polyline. |
void BoardLib::Board::fillPolyline | ( | const std::vector< Point > & | points, | |
unsigned int | depth = 0 | |||
) |
Draws a filled polygon.
points | A vector of points. | |
depth | The depth of the polygon. |
void BoardLib::Board::drawText | ( | float | x, | |
float | y, | |||
const char * | text, | |||
unsigned int | depth = 0 | |||
) |
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. | |
depth | The depth of the text. |
Board & BoardLib::Board::setFont | ( | std::string | font, | |
float | fontSize | |||
) |
Changes the current font and font size.
font | The name of the font. | |
fontSize | The new font size. |
Board & BoardLib::Board::setFontSize | ( | float | fontSize | ) |
Changes the font size.
fontSize | The new font size. |
Board & BoardLib::Board::setPenColorRGBi | ( | unsigned char | red, | |
unsigned char | green, | |||
unsigned char | blue, | |||
unsigned char | alpha = 255 | |||
) |
Changes the current pen color.
red | Red component. | |
green | Green component. | |
blue | Blue component. |
Board & BoardLib::Board::setPenColorRGBf | ( | float | red, | |
float | green, | |||
float | blue, | |||
float | alpha = 1.0f | |||
) |
Changes the current pen color.
red | Red | |
green | ||
blue | ||
alpha |
Changes the current pen color.
In order to use no pen, one may set the pen color to Color::none.
color | The pen color. |
Board & BoardLib::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. |
Board & BoardLib::Board::setFillColorRGBf | ( | float | red, | |
float | green, | |||
float | blue, | |||
float | alpha = 1.0f | |||
) |
Changes the current fill color.
red | Red component. | |
green | Green component. | |
blue | Blue component. | |
alpha | The opacity. |
Changes the current fill color.
In order to use no fill color, one may set this color to Color::none.
color | The fill color. |
Board & BoardLib::Board::setLineWidth | ( | float | width | ) |
Changes the current line thickness (1/72 inche unit).
width | The new line thickness. |
Board & BoardLib::Board::setLineCap | ( | Shape::LineCap | cap | ) | [inline] |
Set the line cap style.
cap | The cap-style which can be Shape::ButtCap, Shape::RoundCap or Shape::SquareCap. |
Board & BoardLib::Board::setLineJoin | ( | Shape::LineJoin | join | ) | [inline] |
Set the line joine style.
cap | The join-style which can be Shape::MiterJoin, Shape::RoundJoin or Shape::BevelJoin. |
void BoardLib::Board::backgroundColor | ( | const Color & | color | ) |
Changes the background color of the whole drawing.
color | A color (may be Color::none). |
void BoardLib::Board::drawBoundingBox | ( | unsigned int | depth = 0 |
) |
Draws the current drawing's bounding box as a rectangle.
depth | The depth of the rectangle. |
void BoardLib::Board::save | ( | const char * | filename | ) | const |
Save the drawing in an EPS, XFIG of SVG file depending on the filename extension.
filename | Path of the file to be created. |
void BoardLib::Board::saveEPS | ( | const char * | filename, | |
float | scale = 1.0f | |||
) | const |
Saves the drawing in an EPS file.
filename | The EPS file name. | |
scale | A scale factor to be applied to the while figure before saving. |
void BoardLib::Board::saveFIG | ( | const char * | filename, | |
float | scale = 1.0f | |||
) | const |
Saves the drawing in an XFig file.
filename | The name of the FIG file. | |
scale | A scale factor to be applied to the while figure before saving. |
void BoardLib::Board::saveSVG | ( | const char * | filename, | |
float | scale = 1.0f | |||
) | const |
Save the drawing in an SVG file.
filename | The name of the file. | |
scale | A scale factor to be applied to the while figure before saving. |
Rect BoardLib::Board::computeBoundingBox | ( | ) | const [protected] |
Computes the drawing's current bounding box.
void BoardLib::Board::clear | ( | const Color & | color = Color::none |
) |
Clears the board with a given background color.
color | The board background color (may be Color::none). |
void BoardLib::Board::clear | ( | unsigned char | red, | |
unsigned char | green, | |||
unsigned char | blue | |||
) | [inline] |
Clears the board and set the background color from an RGB triple.
red | ||
green | ||
blue |
void BoardLib::Board::drawLine | ( | float | x1, | |
float | y1, | |||
float | x2, | |||
float | y2, | |||
unsigned int | depth = 0 | |||
) |
Draws a line from (x1,y1) to (x2,y2).
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. |
void BoardLib::Board::drawArrow | ( | float | x1, | |
float | y1, | |||
float | x2, | |||
float | y2, | |||
bool | filled = false , |
|||
unsigned int | depth = 0 | |||
) |
Draws a line from (x1,y1) to (x2,y2) with an arrow at (x2,y2).
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. |
void BoardLib::Board::drawTriangle | ( | float | x1, | |
float | y1, | |||
float | x2, | |||
float | y2, | |||
float | x3, | |||
float | y3, | |||
unsigned int | depth = 0 | |||
) |
Draws a triangle.
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. |
void BoardLib::Board::drawTriangle | ( | const Point & | p1, | |
const Point & | p2, | |||
const Point & | p3, | |||
unsigned int | depth = 0 | |||
) |
Draws a triangle.
p1 | First vertex. | |
p2 | Second vertex. | |
p3 | Third vertex. | |
depth | Depth of the triangle. |
void BoardLib::Board::fillTriangle | ( | float | x1, | |
float | y1, | |||
float | x2, | |||
float | y2, | |||
float | x3, | |||
float | y3, | |||
unsigned int | depth = 0 | |||
) |
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. | |
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. |
void BoardLib::Board::fillGouraudTriangle | ( | const Point & | p1, | |
const Color & | color1, | |||
const Point & | p2, | |||
const Color & | color2, | |||
const Point & | p3, | |||
const Color & | color3, | |||
unsigned char | divisions = 3 , |
|||
unsigned int | depth = 0 | |||
) |
Draws a triangle with Gouraud-like shaded colors.
p1 | ||
color1 | ||
p2 | ||
color2 | ||
p3 | ||
color3 | ||
divisions | number of triangle subdivisions. | |
depth | The depth of the triangle. |
void BoardLib::Board::fillGouraudTriangle | ( | const float | x1, | |
const float | y1, | |||
const Color & | color1, | |||
const float | x2, | |||
const float | y2, | |||
const Color & | color2, | |||
const float | x3, | |||
const float | y3, | |||
const Color & | color3, | |||
unsigned char | divisions = 3 , |
|||
unsigned int | depth = 0 | |||
) | [inline] |
Draws a triangle with Gouraud-like shaded colors.
x1 | ||
y1 | ||
color1 | ||
x2 | ||
y2 | ||
color2 | ||
x3 | ||
y3 | ||
color3 | ||
divisions | ||
depth |
void BoardLib::Board::fillGouraudTriangle | ( | const Point & | p1, | |
const float | brightness1, | |||
const Point & | p2, | |||
const float | brightness2, | |||
const Point & | p3, | |||
const float | brightness3, | |||
unsigned char | divisions = 3 , |
|||
unsigned int | depth = 0 | |||
) |
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. | |
depth | The depth of the triangle. |
void BoardLib::Board::fillGouraudTriangle | ( | const float | x1, | |
const float | y1, | |||
const float | brightness1, | |||
const float | x2, | |||
const float | y2, | |||
const float | brightness1, | |||
const float | x3, | |||
const float | y3, | |||
const float | brightness1, | |||
unsigned char | divisions = 3 , |
|||
unsigned int | depth = 0 | |||
) | [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 | ||
depth |
void BoardLib::Board::fillTriangle | ( | const Point & | p1, | |
const Point & | p2, | |||
const Point & | p3, | |||
unsigned int | depth = 0 | |||
) |
Draws a filled triangle.
p1 | First vertex. | |
p2 | Second vertex. | |
p3 | Third vertex. | |
depth | Depth of the triangle. |
void BoardLib::Board::drawRectangle | ( | float | x, | |
float | y, | |||
float | width, | |||
float | height, | |||
unsigned int | depth = 0 | |||
) |
Draws a rectangle.
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. |
void BoardLib::Board::fillRectangle | ( | float | x, | |
float | y, | |||
float | width, | |||
float | height, | |||
unsigned int | depth = 0 | |||
) |
Draws a rectangle filled with the current pen color.
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. |
void BoardLib::Board::drawCircle | ( | float | x, | |
float | y, | |||
float | radius, | |||
unsigned int | depth = 0 | |||
) |
Draws a circle.
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. |
void BoardLib::Board::fillCircle | ( | float | x, | |
float | y, | |||
float | radius, | |||
unsigned int | depth = 0 | |||
) |
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. | |
depth | Depth of the circle. |
void BoardLib::Board::drawEllipse | ( | float | x, | |
float | y, | |||
float | xRadius, | |||
float | yRadius, | |||
unsigned int | depth = 0 | |||
) |
Draws an ellipse.
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. |
void BoardLib::Board::fillEllipse | ( | float | x, | |
float | y, | |||
float | xRadius, | |||
float | yRadius, | |||
unsigned int | depth = 0 | |||
) |
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. | |
depth | Depth of the circle. |
void BoardLib::Board::drawPolyline | ( | const std::vector< Point > & | points, | |
unsigned int | depth = 0 | |||
) |
Draws a polygonal line.
points | A vector of points. | |
depth | The depth of the polyline. |
void BoardLib::Board::drawClosedPolyline | ( | const std::vector< Point > & | points, | |
unsigned int | depth = 0 | |||
) |
Draws a closed polygonal line.
points | A vector of points. | |
depth | The depth of the polyline. |
void BoardLib::Board::fillPolyline | ( | const std::vector< Point > & | points, | |
unsigned int | depth = 0 | |||
) |
Draws a filled polygon.
points | A vector of points. | |
depth | The depth of the polygon. |
void BoardLib::Board::drawText | ( | float | x, | |
float | y, | |||
const char * | text, | |||
unsigned int | depth = 0 | |||
) |
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. | |
depth | The depth of the text. |
Board& BoardLib::Board::setFont | ( | std::string | font, | |
float | fontSize | |||
) |
Changes the current font and font size.
font | The name of the font. | |
fontSize | The new font size. |
Board& BoardLib::Board::setFontSize | ( | float | fontSize | ) |
Changes the font size.
fontSize | The new font size. |
Board& BoardLib::Board::setPenColorRGBi | ( | unsigned char | red, | |
unsigned char | green, | |||
unsigned char | blue, | |||
unsigned char | alpha = 255 | |||
) |
Changes the current pen color.
red | Red component. | |
green | Green component. | |
blue | Blue component. |
Board& BoardLib::Board::setPenColorRGBf | ( | float | red, | |
float | green, | |||
float | blue, | |||
float | alpha = 1.0f | |||
) |
Changes the current pen color.
red | Red | |
green | ||
blue | ||
alpha |
Changes the current pen color.
In order to use no pen, one may set the pen color to Color::none.
color | The pen color. |
Board& BoardLib::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. |
Board& BoardLib::Board::setFillColorRGBf | ( | float | red, | |
float | green, | |||
float | blue, | |||
float | alpha = 1.0f | |||
) |
Changes the current fill color.
red | Red component. | |
green | Green component. | |
blue | Blue component. | |
alpha | The opacity. |
Changes the current fill color.
In order to use no fill color, one may set this color to Color::none.
color | The fill color. |
Board& BoardLib::Board::setLineWidth | ( | float | width | ) |
Changes the current line thickness (1/72 inche unit).
width | The new line thickness. |
Board& BoardLib::Board::setLineCap | ( | Shape::LineCap | cap | ) | [inline] |
Set the line cap style.
cap | The cap-style which can be Shape::ButtCap, Shape::RoundCap or Shape::SquareCap. |
Board& BoardLib::Board::setLineJoin | ( | Shape::LineJoin | join | ) | [inline] |
Set the line joine style.
cap | The join-style which can be Shape::MiterJoin, Shape::RoundJoin or Shape::BevelJoin. |
void BoardLib::Board::backgroundColor | ( | const Color & | color | ) |
Changes the background color of the whole drawing.
color | A color (may be Color::none). |
void BoardLib::Board::drawBoundingBox | ( | unsigned int | depth = 0 |
) |
Draws the current drawing's bounding box as a rectangle.
depth | The depth of the rectangle. |
void BoardLib::Board::save | ( | const char * | filename | ) | const |
Save the drawing in an EPS, XFIG of SVG file depending on the filename extension.
filename | Path of the file to be created. |
void BoardLib::Board::saveEPS | ( | const char * | filename, | |
float | scale = 1.0f | |||
) | const |
Saves the drawing in an EPS file.
filename | The EPS file name. | |
scale | A scale factor to be applied to the while figure before saving. |
void BoardLib::Board::saveFIG | ( | const char * | filename, | |
float | scale = 1.0f | |||
) | const |
Saves the drawing in an XFig file.
filename | The name of the FIG file. | |
scale | A scale factor to be applied to the while figure before saving. |
void BoardLib::Board::saveSVG | ( | const char * | filename, | |
float | scale = 1.0f | |||
) | const |
Save the drawing in an SVG file.
filename | The name of the file. | |
scale | A scale factor to be applied to the while figure before saving. |
Rect BoardLib::Board::computeBoundingBox | ( | ) | const [protected] |
Computes the drawing's current bounding box.
Color BoardLib::Board::_penColor [protected] |
The current pen color.
Color BoardLib::Board::_fillColor [protected] |
The current fill color.
float BoardLib::Board::_lineWidth [protected] |
The current line thickness.
std::string BoardLib::Board::_font [protected] |
The current font.
float BoardLib::Board::_fontSize [protected] |
The current font size.
unsigned int BoardLib::Board::_depth [protected] |
The current drawing depth.
std::vector< Shape* > BoardLib::Board::_shapes [protected] |
Vector of the shapes.
Color BoardLib::Board::_backgroundColor [protected] |
The color of the background.
std::vector< Shape* > BoardLib::Board::_shapes [protected] |
Vector of the shapes.