BoardLib::Board Class Reference

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

#include <Board.h>

List of all members.

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)
BoardsetFont (std::string font, float fontSize)
BoardsetFontSize (float fontSize)
BoardsetPenColorRGBi (unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha=255)
BoardsetPenColorRGBf (float red, float green, float blue, float alpha=1.0f)
BoardsetPenColor (const Color &color)
BoardsetFillColorRGBi (unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha=255)
BoardsetFillColorRGBf (float red, float green, float blue, float alpha=1.0f)
BoardsetFillColor (const Color &color)
BoardsetLineWidth (float width)
BoardsetLineCap (Shape::LineCap cap)
BoardsetLineJoin (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)
BoardsetFont (std::string font, float fontSize)
BoardsetFontSize (float fontSize)
BoardsetPenColorRGBi (unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha=255)
BoardsetPenColorRGBf (float red, float green, float blue, float alpha=1.0f)
BoardsetPenColor (const Color &color)
BoardsetFillColorRGBi (unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha=255)
BoardsetFillColorRGBf (float red, float green, float blue, float alpha=1.0f)
BoardsetFillColor (const Color &color)
BoardsetLineWidth (float width)
BoardsetLineCap (Shape::LineCap cap)
BoardsetLineJoin (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


Detailed Description

Class for EPS, FIG or SVG drawings.

The Board class.

Version:
0.5
Examples:

examples/arithmetic.cc, examples/example1.cc, and examples/example2.cc.


Constructor & Destructor Documentation

BoardLib::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.

BoardLib::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.


Member Function Documentation

void BoardLib::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.cc, and examples/example2.cc.

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.

Parameters:
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).

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.cc.

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

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/example1.cc.

void BoardLib::Board::drawTriangle ( float  x1,
float  y1,
float  x2,
float  y2,
float  x3,
float  y3,
unsigned int  depth = 0 
)

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.cc.

void BoardLib::Board::drawTriangle ( const Point p1,
const Point p2,
const Point p3,
unsigned int  depth = 0 
)

Draws a triangle.

Parameters:
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.

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.

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.

Parameters:
p1 
color1 
p2 
color2 
p3 
color3 
divisions number of triangle subdivisions.
depth The depth of the triangle.
Examples:
examples/example1.cc.

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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

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.cc, examples/example1.cc, and examples/example2.cc.

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.

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.

void BoardLib::Board::drawCircle ( float  x,
float  y,
float  radius,
unsigned int  depth = 0 
)

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.cc.

void BoardLib::Board::fillCircle ( float  x,
float  y,
float  radius,
unsigned int  depth = 0 
)

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.cc, and examples/example2.cc.

void BoardLib::Board::drawEllipse ( float  x,
float  y,
float  xRadius,
float  yRadius,
unsigned int  depth = 0 
)

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.cc.

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.

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.

void BoardLib::Board::drawPolyline ( const std::vector< Point > &  points,
unsigned int  depth = 0 
)

Draws a polygonal line.

Parameters:
points A vector of points.
depth The depth of the polyline.
Examples:
examples/example1.cc, and examples/example2.cc.

void BoardLib::Board::drawClosedPolyline ( const std::vector< Point > &  points,
unsigned int  depth = 0 
)

Draws a closed polygonal line.

Parameters:
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.

Parameters:
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.

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.cc, and examples/example2.cc.

Board & BoardLib::Board::setFont ( std::string  font,
float  fontSize 
)

Changes the current font and font size.

Parameters:
font The name of the font.
fontSize The new font size.
Returns:
The board itself.
Examples:
examples/example2.cc.

Board & BoardLib::Board::setFontSize ( float  fontSize  ) 

Changes the font size.

Parameters:
fontSize The new font size.
Returns:
The board itself.

Board & BoardLib::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.cc, examples/example1.cc, and examples/example2.cc.

Board & BoardLib::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.

Board & BoardLib::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/example2.cc.

Board & BoardLib::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.cc.

Board & BoardLib::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.cc.

Board & BoardLib::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.cc.

Board & BoardLib::Board::setLineWidth ( float  width  ) 

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

Parameters:
width The new line thickness.
Returns:
The board itself.
Examples:
examples/arithmetic.cc, examples/example1.cc, and examples/example2.cc.

Board & BoardLib::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.

Board & BoardLib::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.cc.

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

Changes the background color of the whole drawing.

Parameters:
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.

Parameters:
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.

Parameters:
filename Path of the file to be created.
Examples:
examples/arithmetic.cc.

void BoardLib::Board::saveEPS ( const char *  filename,
float  scale = 1.0f 
) const

Saves the drawing in an EPS file.

Parameters:
filename The EPS file name.
scale A scale factor to be applied to the while figure before saving.
Examples:
examples/example1.cc, and examples/example2.cc.

void BoardLib::Board::saveFIG ( const char *  filename,
float  scale = 1.0f 
) const

Saves the drawing in an XFig file.

Parameters:
filename The name of the FIG file.
scale A scale factor to be applied to the while figure before saving.
Examples:
examples/example1.cc, and examples/example2.cc.

void BoardLib::Board::saveSVG ( const char *  filename,
float  scale = 1.0f 
) const

Save the drawing in an SVG file.

Parameters:
filename The name of the file.
scale A scale factor to be applied to the while figure before saving.
Examples:
examples/example1.cc, and examples/example2.cc.

Rect BoardLib::Board::computeBoundingBox (  )  const [protected]

Computes the drawing's current bounding box.

Returns:
The current bounding box of the drawing.

void BoardLib::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).

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.

Parameters:
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).

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.

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

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.

void BoardLib::Board::drawTriangle ( float  x1,
float  y1,
float  x2,
float  y2,
float  x3,
float  y3,
unsigned int  depth = 0 
)

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.

void BoardLib::Board::drawTriangle ( const Point p1,
const Point p2,
const Point p3,
unsigned int  depth = 0 
)

Draws a triangle.

Parameters:
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.

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.

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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

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.

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.

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.

void BoardLib::Board::drawCircle ( float  x,
float  y,
float  radius,
unsigned int  depth = 0 
)

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.

void BoardLib::Board::fillCircle ( float  x,
float  y,
float  radius,
unsigned int  depth = 0 
)

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.

void BoardLib::Board::drawEllipse ( float  x,
float  y,
float  xRadius,
float  yRadius,
unsigned int  depth = 0 
)

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.

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.

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.

void BoardLib::Board::drawPolyline ( const std::vector< Point > &  points,
unsigned int  depth = 0 
)

Draws a polygonal line.

Parameters:
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.

Parameters:
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.

Parameters:
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.

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.

Board& BoardLib::Board::setFont ( std::string  font,
float  fontSize 
)

Changes the current font and font size.

Parameters:
font The name of the font.
fontSize The new font size.
Returns:
The board itself.

Board& BoardLib::Board::setFontSize ( float  fontSize  ) 

Changes the font size.

Parameters:
fontSize The new font size.
Returns:
The board itself.

Board& BoardLib::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.

Board& BoardLib::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.

Board& BoardLib::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.

Board& BoardLib::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.

Board& BoardLib::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.

Board& BoardLib::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.

Board& BoardLib::Board::setLineWidth ( float  width  ) 

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

Parameters:
width The new line thickness.
Returns:
The board itself.

Board& BoardLib::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.

Board& BoardLib::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.

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

Changes the background color of the whole drawing.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Returns:
The current bounding box of the drawing.


Member Data Documentation

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.


The documentation for this class was generated from the following files:
Generated on Fri Aug 24 19:07:40 2007 for Board by  doxygen 1.5.1