Board
0.6.devel
|
#include <Board.h>
Data Structures | |
struct | State |
Public Types | |
enum | CairoType { CairoPDF, CairoPNG, CairoPS, CairoEPS, CairoSVG } |
enum | PageSize { BoundingBox, A4, Letter } |
enum | Unit { UPoint, UInche, UCentimeter, UMillimeter } |
Public Member Functions | |
Board (const DGtal::Color &backgroundColor=DGtal::Color::None) | |
Board (const Board &other) | |
~Board () | |
Board & | operator= (const Board &other) |
Board & | operator<< (const Shape &shape) |
Board & | operator<< (Unit unit) |
void | clear (const DGtal::Color &color=DGtal::Color::None) |
void | clear (unsigned char red, unsigned char green, unsigned char blue) |
Shape & | rotate (double angle, const Point ¢er) |
Shape & | rotate (double angle) |
Shape & | translate (double dx, double dy) |
Shape & | scale (double sx, double sy) |
Shape & | scale (double s) |
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 | setUnit (Unit unit) |
void | setUnit (double factor, Unit unit) |
void | drawDot (double x, double y, int depthValue=-1) |
void | drawLine (double x1, double y1, double x2, double y2, int depthValue=-1) |
void | drawArrow (double x1, double y1, double x2, double y2, bool filled=true, int depthValue=-1) |
void | drawTriangle (double x1, double y1, double x2, double y2, double x3, double y3, int depthValue=-1) |
void | drawTriangle (const Point &p1, const Point &p2, const Point &p3, int depthValue=-1) |
void | drawArc (double x, double y, double radius, double angle1, double angle2, bool neg, int depthValue=-1) |
void | fillTriangle (double x1, double y1, double x2, double y2, double x3, double y3, int depthValue=-1) |
void | fillGouraudTriangle (const Point &p1, const DGtal::Color &color1, const Point &p2, const DGtal::Color &color2, const Point &p3, const DGtal::Color &color3, unsigned char divisions=3, int depthValue=-1) |
void | fillGouraudTriangle (const double x1, const double y1, const DGtal::Color &color1, const double x2, const double y2, const DGtal::Color &color2, const double x3, const double y3, const DGtal::Color &color3, unsigned char divisions=3, int depthValue=-1) |
void | fillGouraudTriangle (const Point &p1, const float brightness1, const Point &p2, const float brightness2, const Point &p3, const float brightness3, unsigned char divisions=3, int depthValue=-1) |
void | fillGouraudTriangle (const double x1, const double y1, const float brightness1, const double x2, const double y2, const float brightness2, const double x3, const double y3, const float brightness3, unsigned char divisions=3, int depthValue=-1) |
void | fillTriangle (const Point &p1, const Point &p2, const Point &p3, int depthValue=-1) |
void | drawRectangle (double x, double y, double width, double height, int depthValue=-1) |
void | drawImage (std::string filename, double x, double y, double width, double height, int depthValue=-1, double alpha=1.0) |
void | fillRectangle (double x, double y, double width, double height, int depthValue=-1) |
void | drawCircle (double x, double y, double radius, int depthValue=-1) |
void | fillCircle (double x, double y, double radius, int depthValue=-1) |
void | drawEllipse (double x, double y, double xRadius, double yRadius, int depthValue=-1) |
void | fillEllipse (double x, double y, double xRadius, double yRadius, int depthValue=-1) |
void | drawPolyline (const std::vector< Point > &points, int depthValue=-1) |
void | drawClosedPolyline (const std::vector< Point > &points, int depthValue=-1) |
void | fillPolyline (const std::vector< Point > &points, int depthValue=-1) |
void | drawText (double x, double y, const char *text, int depthValue=-1) |
void | drawText (double x, double y, const std::string &str, int depthValue=-1) |
Board & | setFont (const Fonts::Font font, double fontSize) |
Board & | setFontSize (double fontSize) |
Board & | setPenColorRGBi (unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha=255) |
Board & | setPenColorRGBf (float red, float green, float blue, float alpha=1.0f) |
Board & | setPenColor (const DGtal::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 DGtal::Color &color) |
Board & | setLineWidth (double width) |
Board & | setLineStyle (Shape::LineStyle style) |
Board & | setLineCap (Shape::LineCap cap) |
Board & | setLineJoin (Shape::LineJoin join) |
void | backgroundColor (const DGtal::Color &color) |
void | drawBoundingBox (int depthValue=-1) |
void | setClippingRectangle (double x, double y, double width, double height) |
void | setClippingPath (const std::vector< Point > &points) |
void | setClippingPath (const Path &path) |
void | addDuplicates (const Shape &shape, unsigned int times, double dx, double dy, double scale=1.0) |
void | addDuplicates (const Shape &shape, unsigned int times, double dx, double dy, double scaleX, double scaleY, double angle=0.0) |
void | save (const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const |
void | save (const char *filename, double pageWidth, double pageHeight, double margin=10.0) const |
void | saveEPS (const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const |
void | saveEPS (std::ostream &out, PageSize size=Board::BoundingBox, double margin=10.0) const |
void | saveEPS (const char *filename, double pageWidth, double pageHeight, double margin=10.0) const |
void | saveEPS (std::ostream &out, double pageWidth, double pageHeight, double margin=10.0) const |
void | saveFIG (const char *filename, PageSize size=Board::BoundingBox, double margin=10.0, bool includeFIGHeader=true) const |
void | saveFIG (std::ostream &out, PageSize size=Board::BoundingBox, double margin=10.0, bool includeFIGHeader=true) const |
void | saveFIG (const char *filename, double pageWidth, double pageHeight, double margin=10.0, bool includeFIGHeader=true) const |
void | saveFIG (std::ostream &out, double pageWidth, double pageHeight, double margin=10.0, bool includeFIGHeader=true) const |
void | saveSVG (const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const |
void | saveSVG (std::ostream &out, PageSize size=Board::BoundingBox, double margin=10.0) const |
void | saveSVG (const char *filename, double pageWidth, double pageHeight, double margin=10.0) const |
void | saveSVG (std::ostream &out, double pageWidth, double pageHeight, double margin=10.0, string filename="output.svg") const |
void | saveTikZ (const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const |
void | saveTikZ (std::ostream &out, PageSize size=Board::BoundingBox, double margin=10.0) const |
void | saveTikZ (const char *filename, double pageWidth, double pageHeight, double margin=10.0) const |
void | saveTikZ (std::ostream &out, double pageWidth, double pageHeight, double margin=10.0) const |
![]() | |
ShapeList (int depth=-1) | |
ShapeList (const ShapeList &other) | |
~ShapeList () | |
const std::string & | name () const |
ShapeList & | clear () |
Point | center () const |
void | scaleAll (double s) |
void | flushPostscript (std::ostream &stream, const TransformEPS &transform) const |
void | flushFIG (std::ostream &stream, const TransformFIG &transform, std::map< DGtal::Color, int > &colormap) const |
void | flushSVG (std::ostream &stream, const TransformSVG &transform) const |
void | flushTikZ (std::ostream &stream, const TransformTikZ &transform) const |
Rect | boundingBox () const |
virtual int | minDepth () const |
virtual int | maxDepth () const |
void | shiftDepth (int shift) |
Shape * | clone () const |
ShapeList & | operator= (const ShapeList &other) |
ShapeList & | operator+= (const Shape &shape) |
ShapeList & | insert (const Shape &shape, int depth) |
ShapeList & | dup (unsigned int copies=1) |
template<typename T > | |
T & | last (const unsigned int position=0) |
Shape & | last (const unsigned int position=0) |
Shape & | top () |
![]() | |
Shape (DGtal::Color penColor, DGtal::Color fillColor, double lineWidth, LineStyle style, const LineCap cap, const LineJoin join, int depth) | |
virtual | ~Shape () |
bool | filled () const |
Shape & | rotateDeg (double angle, const Point ¢er) |
Shape & | rotateDeg (double angle) |
Rect | bbox () |
Shape & | operator-- () |
Shape & | operator++ () |
int | depth () const |
virtual void | depth (int) |
const DGtal::Color & | penColor () const |
const DGtal::Color & | fillColor () const |
Static Public Attributes | |
static const double | Degree = 3.14159265358979323846 / 180.0 |
Protected Attributes | |
State | _state |
DGtal::Color | _backgroundColor |
Path | _clippingPath |
![]() | |
std::vector< Shape * > | _shapes |
int | _nextDepth |
![]() | |
int | _depth |
DGtal::Color | _penColor |
DGtal::Color | _fillColor |
double | _lineWidth |
LineStyle | _lineStyle |
LineCap | _lineCap |
LineJoin | _lineJoin |
Additional Inherited Members | |
![]() | |
void | addShape (const Shape &shape, double scaleFactor) |
void | free () |
![]() | |
std::string | svgProperties (const TransformSVG &transform) const |
std::string | postscriptProperties () const |
std::string | tikzProperties (const TransformTikZ &transform) const |
LibBoard::Board::Board | ( | const DGtal::Color & | backgroundColor = DGtal::Color::None | ) |
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. |
LibBoard::Board::~Board | ( | ) |
void LibBoard::Board::addDuplicates | ( | const Shape & | shape, |
unsigned int | times, | ||
double | dx, | ||
double | dy, | ||
double | scale = 1.0 |
||
) |
Insert duplicates of a shape, n times, starting at its current position and iterating given translations and scalings.
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(), LibBoard::Shape::scale(), and LibBoard::Shape::translate().
void LibBoard::Board::addDuplicates | ( | const Shape & | shape, |
unsigned int | times, | ||
double | dx, | ||
double | dy, | ||
double | scaleX, | ||
double | scaleY, | ||
double | angle = 0.0 |
||
) |
Insert duplicates of a shape, n times, starting at its current position and iterating a given translation.
shape | The shape to be duplicated. |
times | The number of duplicates. |
dx | The x shift. |
dy | The y shift. |
scaleX | An x scale factor between each copy. |
scaleY | A y scale factor between each copy. |
scaleY | A y scale factor between each copy. |
angle | An angular increment. |
References LibBoard::Shape::clone(), LibBoard::Shape::rotate(), LibBoard::Shape::scale(), and LibBoard::Shape::translate().
void LibBoard::Board::backgroundColor | ( | const DGtal::Color & | color | ) |
Changes the background color of the whole drawing.
color | A color (may be Color::None). |
References _backgroundColor.
void LibBoard::Board::clear | ( | const DGtal::Color & | color = DGtal::Color::None | ) |
Clears the board with a given background color.
color | The board background color (may be Color::None). |
References _backgroundColor, and LibBoard::ShapeList::clear().
void LibBoard::Board::clear | ( | unsigned char | red, |
unsigned char | green, | ||
unsigned char | blue | ||
) |
Clears the board and set the background color from an RGB triple.
red | |
green | |
blue |
void LibBoard::Board::drawArc | ( | double | x, |
double | y, | ||
double | radius, | ||
double | angle1, | ||
double | angle2, | ||
bool | neg, | ||
int | depthValue = -1 |
||
) |
Draws an arc.
x | First coordinate of the arc center. |
y | Second coordinate of the arc center. |
radius | arc radius. |
angle1 | first angle. |
angle2 | second angle. |
neg | |
depthValue | Depth of the arc. |
References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::lineStyle, LibBoard::Board::State::lineWidth, LibBoard::Board::State::penColor, and LibBoard::Board::State::unit().
void LibBoard::Board::drawArrow | ( | double | x1, |
double | y1, | ||
double | x2, | ||
double | y2, | ||
bool | filled = true , |
||
int | depthValue = -1 |
||
) |
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. |
depthValue | Depth of the line. |
References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::lineCap, LibBoard::Board::State::lineJoin, LibBoard::Board::State::lineStyle, LibBoard::Board::State::lineWidth, LibBoard::Board::State::penColor, and LibBoard::Board::State::unit().
void LibBoard::Board::drawBoundingBox | ( | int | depthValue = -1 | ) |
Draws the current drawing's bounding box as a rectangle.
depthValue | The depth of the rectangle. |
References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::ShapeList::boundingBox(), LibBoard::Board::State::fillColor, LibBoard::Rect::height, LibBoard::Rect::left, LibBoard::Board::State::lineCap, LibBoard::Board::State::lineJoin, LibBoard::Board::State::lineStyle, LibBoard::Board::State::lineWidth, LibBoard::Board::State::penColor, LibBoard::Rect::top, LibBoard::Board::State::unit(), and LibBoard::Rect::width.
void LibBoard::Board::drawCircle | ( | double | x, |
double | y, | ||
double | radius, | ||
int | depthValue = -1 |
||
) |
Draws a circle.
x | First coordinate of the circle's center. |
y | Second coordinate of the circle's center. |
radius | Radius of the circle. |
depthValue | Depth of the circle. |
References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::fillColor, LibBoard::Board::State::lineStyle, LibBoard::Board::State::lineWidth, LibBoard::Board::State::penColor, and LibBoard::Board::State::unit().
void LibBoard::Board::drawClosedPolyline | ( | const std::vector< Point > & | points, |
int | depthValue = -1 |
||
) |
Draws a closed polygonal line.
points | A vector of points. |
depthValue | The depth of the polyline. |
References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::fillColor, LibBoard::Board::State::lineCap, LibBoard::Board::State::lineJoin, LibBoard::Board::State::lineStyle, LibBoard::Board::State::lineWidth, LibBoard::Board::State::penColor, and LibBoard::Board::State::unit().
void LibBoard::Board::drawDot | ( | double | x, |
double | y, | ||
int | depthValue = -1 |
||
) |
Draws a dot at coordinates (x,y).
x | First coordinate of the dot. |
y | Second coordinate of the dot. |
depthValue | Depth of the line. |
References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::lineWidth, LibBoard::Board::State::penColor, and LibBoard::Board::State::unit().
void LibBoard::Board::drawEllipse | ( | double | x, |
double | y, | ||
double | xRadius, | ||
double | yRadius, | ||
int | depthValue = -1 |
||
) |
Draws an ellipse.
x | First coordinate of the circle's center. |
y | Second coordinate of the circle's center. |
radius | Radius of the circle. |
depthValue | Depth of the circle. |
References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::fillColor, LibBoard::Board::State::lineStyle, LibBoard::Board::State::lineWidth, LibBoard::Board::State::penColor, and LibBoard::Board::State::unit().
void LibBoard::Board::drawImage | ( | std::string | filename, |
double | x, | ||
double | y, | ||
double | width, | ||
double | height, | ||
int | depthValue = -1 , |
||
double | alpha = 1.0 |
||
) |
Draws an image.
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. |
depthValue | Depth of the rectangle. |
alpha | Transparency used in the image display. |
References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, and LibBoard::Board::State::unit().
void LibBoard::Board::drawLine | ( | double | x1, |
double | y1, | ||
double | x2, | ||
double | y2, | ||
int | depthValue = -1 |
||
) |
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. |
depthValue | Depth of the line. |
References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::lineCap, LibBoard::Board::State::lineJoin, LibBoard::Board::State::lineStyle, LibBoard::Board::State::lineWidth, LibBoard::Board::State::penColor, and LibBoard::Board::State::unit().
void LibBoard::Board::drawPolyline | ( | const std::vector< Point > & | points, |
int | depthValue = -1 |
||
) |
Draws a polygonal line.
points | A vector of points. |
depthValue | The depth of the polyline. |
References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::fillColor, LibBoard::Board::State::lineCap, LibBoard::Board::State::lineJoin, LibBoard::Board::State::lineStyle, LibBoard::Board::State::lineWidth, LibBoard::Board::State::penColor, and LibBoard::Board::State::unit().
void LibBoard::Board::drawRectangle | ( | double | x, |
double | y, | ||
double | width, | ||
double | height, | ||
int | depthValue = -1 |
||
) |
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. |
depthValue | Depth of the rectangle. |
References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::fillColor, LibBoard::Board::State::lineCap, LibBoard::Board::State::lineJoin, LibBoard::Board::State::lineStyle, LibBoard::Board::State::lineWidth, LibBoard::Board::State::penColor, and LibBoard::Board::State::unit().
void LibBoard::Board::drawText | ( | double | x, |
double | y, | ||
const char * | text, | ||
int | depthValue = -1 |
||
) |
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. |
depthValue | The depth of the text. |
References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::font, LibBoard::Board::State::fontSize, LibBoard::Board::State::penColor, and LibBoard::Board::State::unit().
void LibBoard::Board::drawText | ( | double | x, |
double | y, | ||
const std::string & | str, | ||
int | depthValue = -1 |
||
) |
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. |
depthValue | The depth of the text. |
References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::font, LibBoard::Board::State::fontSize, LibBoard::Board::State::penColor, and LibBoard::Board::State::unit().
void LibBoard::Board::drawTriangle | ( | double | x1, |
double | y1, | ||
double | x2, | ||
double | y2, | ||
double | x3, | ||
double | y3, | ||
int | depthValue = -1 |
||
) |
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. |
depthValue | Depth of the triangle. |
References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::fillColor, LibBoard::Board::State::lineCap, LibBoard::Board::State::lineJoin, LibBoard::Board::State::lineStyle, LibBoard::Board::State::lineWidth, LibBoard::Board::State::penColor, and LibBoard::Board::State::unit().
void LibBoard::Board::drawTriangle | ( | const Point & | p1, |
const Point & | p2, | ||
const Point & | p3, | ||
int | depthValue = -1 |
||
) |
Draws a triangle.
p1 | First vertex. |
p2 | Second vertex. |
p3 | Third vertex. |
depthValue | Depth of the triangle. |
References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::fillColor, LibBoard::Board::State::lineCap, LibBoard::Board::State::lineJoin, LibBoard::Board::State::lineStyle, LibBoard::Board::State::lineWidth, LibBoard::Board::State::penColor, LibBoard::Board::State::unit(), LibBoard::Point::x, and LibBoard::Point::y.
void LibBoard::Board::fillCircle | ( | double | x, |
double | y, | ||
double | radius, | ||
int | depthValue = -1 |
||
) |
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. |
depthValue | Depth of the circle. |
References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::lineStyle, LibBoard::Board::State::penColor, and LibBoard::Board::State::unit().
void LibBoard::Board::fillEllipse | ( | double | x, |
double | y, | ||
double | xRadius, | ||
double | yRadius, | ||
int | depthValue = -1 |
||
) |
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. |
depthValue | Depth of the circle. |
References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::lineStyle, LibBoard::Board::State::penColor, and LibBoard::Board::State::unit().
void LibBoard::Board::fillGouraudTriangle | ( | const Point & | p1, |
const DGtal::Color & | color1, | ||
const Point & | p2, | ||
const DGtal::Color & | color2, | ||
const Point & | p3, | ||
const DGtal::Color & | color3, | ||
unsigned char | divisions = 3 , |
||
int | depthValue = -1 |
||
) |
Draws a triangle with Gouraud-like shaded colors.
p1 | |
color1 | |
p2 | |
color2 | |
p3 | |
color3 | |
divisions | number of triangle subdivisions. |
depthValue | The depth of the triangle. |
References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::unit(), LibBoard::Point::x, and LibBoard::Point::y.
Referenced by fillGouraudTriangle().
void LibBoard::Board::fillGouraudTriangle | ( | const double | x1, |
const double | y1, | ||
const DGtal::Color & | color1, | ||
const double | x2, | ||
const double | y2, | ||
const DGtal::Color & | color2, | ||
const double | x3, | ||
const double | y3, | ||
const DGtal::Color & | color3, | ||
unsigned char | divisions = 3 , |
||
int | depthValue = -1 |
||
) |
Draws a triangle with Gouraud-like shaded colors.
x1 | |
y1 | |
color1 | |
x2 | |
y2 | |
color2 | |
x3 | |
y3 | |
color3 | |
divisions | |
depthValue |
void LibBoard::Board::fillGouraudTriangle | ( | const Point & | p1, |
const float | brightness1, | ||
const Point & | p2, | ||
const float | brightness2, | ||
const Point & | p3, | ||
const float | brightness3, | ||
unsigned char | divisions = 3 , |
||
int | depthValue = -1 |
||
) |
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. |
depthValue | The depth of the triangle. |
References _state, fillGouraudTriangle(), LibBoard::Board::State::penColor, LibBoard::Board::State::unit(), LibBoard::Point::x, and LibBoard::Point::y.
void LibBoard::Board::fillGouraudTriangle | ( | const double | x1, |
const double | y1, | ||
const float | brightness1, | ||
const double | x2, | ||
const double | y2, | ||
const float | brightness2, | ||
const double | x3, | ||
const double | y3, | ||
const float | brightness3, | ||
unsigned char | divisions = 3 , |
||
int | depthValue = -1 |
||
) |
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 | |
depthValue |
void LibBoard::Board::fillPolyline | ( | const std::vector< Point > & | points, |
int | depthValue = -1 |
||
) |
Draws a filled polygon.
points | A vector of points. |
depthValue | The depth of the polygon. |
References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::lineCap, LibBoard::Board::State::lineJoin, LibBoard::Board::State::lineStyle, LibBoard::Board::State::penColor, and LibBoard::Board::State::unit().
void LibBoard::Board::fillRectangle | ( | double | x, |
double | y, | ||
double | width, | ||
double | height, | ||
int | depthValue = -1 |
||
) |
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. |
depthValue | Depth of the rectangle. |
References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::lineCap, LibBoard::Board::State::lineJoin, LibBoard::Board::State::lineStyle, LibBoard::Board::State::penColor, and LibBoard::Board::State::unit().
void LibBoard::Board::fillTriangle | ( | double | x1, |
double | y1, | ||
double | x2, | ||
double | y2, | ||
double | x3, | ||
double | y3, | ||
int | depthValue = -1 |
||
) |
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. |
depthValue | Depth of the triangle. |
References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::lineCap, LibBoard::Board::State::lineJoin, LibBoard::Board::State::lineStyle, LibBoard::Board::State::penColor, and LibBoard::Board::State::unit().
void LibBoard::Board::fillTriangle | ( | const Point & | p1, |
const Point & | p2, | ||
const Point & | p3, | ||
int | depthValue = -1 |
||
) |
Draws a filled triangle.
p1 | First vertex. |
p2 | Second vertex. |
p3 | Third vertex. |
depthValue | Depth of the triangle. |
References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::lineCap, LibBoard::Board::State::lineJoin, LibBoard::Board::State::lineStyle, LibBoard::Board::State::penColor, LibBoard::Board::State::unit(), LibBoard::Point::x, and LibBoard::Point::y.
Add a shape to the board, using the current unit factor.
shape | A shape. (Might be a list of shapes, actually!) |
Reimplemented from LibBoard::ShapeList.
References _state, LibBoard::ShapeList::addShape(), and LibBoard::Board::State::unitFactor.
The operator =
other | The object to be copied. |
References LibBoard::ShapeList::_shapes, and LibBoard::ShapeList::free().
Rotate the shape around a given center of rotation.
angle | The rotation angle in radian. |
center | The center of rotation. |
Reimplemented from LibBoard::ShapeList.
References _clippingPath, and LibBoard::Path::rotate().
Referenced by rotate().
|
virtual |
Rotate the shape around its center.
angle | The rotation angle in radian. |
Reimplemented from LibBoard::ShapeList.
References _clippingPath, LibBoard::ShapeList::center(), rotate(), and LibBoard::Path::rotate().
Reimplemented from LibBoard::ShapeList.
References Board().
Board LibBoard::Board::rotated | ( | double | angle | ) |
Reimplemented from LibBoard::ShapeList.
References Board().
void LibBoard::Board::save | ( | const char * | filename, |
PageSize | size = Board::BoundingBox , |
||
double | margin = 10.0 |
||
) | const |
Save the drawing in an EPS, XFIG of SVG file depending on the filename extension. When a size is given (not BoundingBox), the drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.
filename | Path of the file to be created. |
size | Page size (Either BoundingBox (default), A4 or Letter). |
margin | Minimal margin around the figure in the page, in millimeters. |
void LibBoard::Board::save | ( | const char * | filename, |
double | pageWidth, | ||
double | pageHeight, | ||
double | margin = 10.0 |
||
) | const |
Save the drawing in an EPS, XFIG of SVG file depending on the filename extension. When a size is given (not BoundingBox), the drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.
filename | Path of the file to be created. |
pageWidth | Width of the page in millimeters. |
pageHeight | Height of the page in millimeters. |
margin | Minimal margin around the figure in the page, in millimeters. |
References saveEPS(), saveFIG(), saveSVG(), and saveTikZ().
void LibBoard::Board::saveEPS | ( | const char * | filename, |
PageSize | size = Board::BoundingBox , |
||
double | margin = 10.0 |
||
) | const |
Saves the drawing in an EPS file. When a size is given (not BoundingBox), the drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.
filename | The EPS file name. |
size | Page size (Either BoundingBox (default), A4 or Letter). |
margin | Minimal margin around the figure in the page, in millimeters. |
void LibBoard::Board::saveEPS | ( | std::ostream & | out, |
PageSize | size = Board::BoundingBox , |
||
double | margin = 10.0 |
||
) | const |
Saves the drawing in EPS format through an output stream. 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 saveEPS().
void LibBoard::Board::saveEPS | ( | const char * | filename, |
double | pageWidth, | ||
double | pageHeight, | ||
double | margin = 10.0 |
||
) | const |
Saves the drawing in an EPS file. When a size is given (not BoundingBox), the drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.
filename | The EPS file name. |
size | Page size (Either BoundingBox (default), A4 or Letter). |
pageWidth | Width of the page in millimeters. |
pageHeight | Height of the page in millimeters. |
margin | Minimal margin around the figure in the page, in millimeters. |
References saveEPS().
void LibBoard::Board::saveEPS | ( | std::ostream & | out, |
double | pageWidth, | ||
double | pageHeight, | ||
double | margin = 10.0 |
||
) | const |
Saves the drawing in an EPS format through an output stream. 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). |
pageWidth | Width of the page in millimeters. |
pageHeight | Height of the page in millimeters. |
margin | Minimal margin around the figure in the page, in millimeters. |
References _backgroundColor, _clippingPath, LibBoard::ShapeList::_shapes, LibBoard::ShapeList::boundingBox(), LibBoard::Path::boundingBox(), LibBoard::Path::flushPostscript(), LibBoard::Polyline::flushPostscript(), LibBoard::Rect::height, LibBoard::Rect::left, LibBoard::Transform::mapX(), LibBoard::TransformEPS::mapY(), LibBoard::secured_ctime(), LibBoard::TransformEPS::setBoundingBox(), LibBoard::shapeGreaterDepth(), LibBoard::Path::size(), LibBoard::Rect::top, and LibBoard::Rect::width.
void LibBoard::Board::saveFIG | ( | const char * | filename, |
PageSize | size = Board::BoundingBox , |
||
double | margin = 10.0 , |
||
bool | includeFIGHeader = true |
||
) | 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, in millimeters. |
includeFIGHeader | Indicates if the header is included in the exported file. Useful to merge several XFIG figures (default true) |
void LibBoard::Board::saveFIG | ( | std::ostream & | out, |
PageSize | size = Board::BoundingBox , |
||
double | margin = 10.0 , |
||
bool | includeFIGHeader = true |
||
) | const |
Saves the drawing in XFig format through an output stream. 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. |
includeFIGHeader | Indicates if the header is included in the output stream. Useful to merge several XFIG figures (default true) |
References saveFIG().
void LibBoard::Board::saveFIG | ( | const char * | filename, |
double | pageWidth, | ||
double | pageHeight, | ||
double | margin = 10.0 , |
||
bool | includeFIGHeader = true |
||
) | 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. |
size | Page size (Either BoundingBox (default), A4 or Letter). |
pageWidth | Width of the page in millimeters. |
pageHeight | Height of the page in millimeters. |
margin | Minimal margin around the figure in the page, in millimeters. |
includeFIGHeader | Indicates if the header is included in the output stream. Useful to merge several XFIG figures (default true) |
References saveFIG().
void LibBoard::Board::saveFIG | ( | std::ostream & | out, |
double | pageWidth, | ||
double | pageHeight, | ||
double | margin = 10.0 , |
||
bool | includeFIGHeader = true |
||
) | const |
Saves the drawing in an XFig format through an output stream. 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 | out The output stream. |
size | Page size (Either BoundingBox (default), A4 or Letter). |
pageWidth | Width of the page in millimeters. |
pageHeight | Height of the page in millimeters. |
margin | Minimal margin around the figure in the page, in millimeters. |
includeFIGHeader | Indicates if the header is included in the output stream. Useful to merge several XFIG figures (default true) |
References _backgroundColor, LibBoard::ShapeList::_shapes, LibBoard::ShapeList::boundingBox(), LibBoard::Shape::depth(), LibBoard::Rectangle::flushFIG(), secured_sprintf, LibBoard::TransformFIG::setBoundingBox(), LibBoard::TransformFIG::setDepthRange(), and LibBoard::shapeGreaterDepth().
void LibBoard::Board::saveSVG | ( | const char * | filename, |
PageSize | size = Board::BoundingBox , |
||
double | margin = 10.0 |
||
) | const |
Save the drawing in an SVG file. When a size is given (not BoundingBox), the drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.
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. |
void LibBoard::Board::saveSVG | ( | std::ostream & | out, |
PageSize | size = Board::BoundingBox , |
||
double | margin = 10.0 |
||
) | const |
Save the drawing in an SVG format through an output stream. 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 saveSVG().
void LibBoard::Board::saveSVG | ( | const char * | filename, |
double | pageWidth, | ||
double | pageHeight, | ||
double | margin = 10.0 |
||
) | const |
Saves the drawing in an SVG file. When a size is given (not BoundingBox), the drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.
filename | The SVG file name. |
size | Page size (Either BoundingBox (default), A4 or Letter). |
pageWidth | Width of the page in millimeters. |
pageHeight | Height of the page in millimeters. |
margin | Minimal margin around the figure in the page, in millimeters. |
References saveSVG().
void LibBoard::Board::saveSVG | ( | std::ostream & | out, |
double | pageWidth, | ||
double | pageHeight, | ||
double | margin = 10.0 , |
||
string | filename = "output.svg" |
||
) | const |
Saves the drawing in an SVG format through an output stream. 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). |
pageWidth | Width of the page in millimeters. |
pageHeight | Height of the page in millimeters. |
margin | Minimal margin around the figure in the page, in millimeters. |
References _backgroundColor, _clippingPath, LibBoard::ShapeList::_shapes, LibBoard::ShapeList::boundingBox(), LibBoard::Path::boundingBox(), LibBoard::Rectangle::flushSVG(), LibBoard::Path::flushSVGCommands(), LibBoard::Rect::height, LibBoard::TransformSVG::setBoundingBox(), LibBoard::shapeGreaterDepth(), LibBoard::Path::size(), and LibBoard::Rect::width.
void LibBoard::Board::saveTikZ | ( | const char * | filename, |
PageSize | size = Board::BoundingBox , |
||
double | margin = 10.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. |
Referenced by save(), and saveTikZ().
void LibBoard::Board::saveTikZ | ( | std::ostream & | out, |
PageSize | size = Board::BoundingBox , |
||
double | margin = 10.0 |
||
) | const |
Save the drawing in an TikZ file format through an output stream. 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().
void LibBoard::Board::saveTikZ | ( | const char * | filename, |
double | pageWidth, | ||
double | pageHeight, | ||
double | margin = 10.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). |
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 | ( | std::ostream & | out, |
double | pageWidth, | ||
double | pageHeight, | ||
double | margin = 10.0 |
||
) | const |
Save the drawing in an TikZ format through an output stream. 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). |
pageWidth | Width of the page in millimeters. |
pageHeight | Height of the page in millimeters. |
margin | Minimal margin around the figure in the page, in millimeters. |
References _backgroundColor, _clippingPath, LibBoard::ShapeList::_shapes, LibBoard::ShapeList::boundingBox(), LibBoard::Path::boundingBox(), LibBoard::Path::flushSVGCommands(), LibBoard::Rectangle::flushTikZ(), LibBoard::TransformSVG::setBoundingBox(), LibBoard::shapeGreaterDepth(), and LibBoard::Path::size().
|
virtual |
Scale the shape along the x an y axis.
sx | The scale factor along the x axis. |
sy | The scale factor along the y axis. |
Reimplemented from LibBoard::ShapeList.
References _clippingPath, LibBoard::ShapeList::center(), LibBoard::Path::center(), LibBoard::Path::scale(), LibBoard::Path::translate(), LibBoard::Point::x, and LibBoard::Point::y.
Referenced by scale().
|
virtual |
Scale the shape along both axis.
s | The scale factor along both axis. |
Reimplemented from LibBoard::ShapeList.
References _clippingPath, LibBoard::ShapeList::center(), LibBoard::Path::center(), scale(), LibBoard::Path::scale(), LibBoard::Path::translate(), LibBoard::Point::x, and LibBoard::Point::y.
Board LibBoard::Board::scaled | ( | double | sx, |
double | sy | ||
) |
Reimplemented from LibBoard::ShapeList.
References Board().
Board LibBoard::Board::scaled | ( | double | s | ) |
Reimplemented from LibBoard::ShapeList.
References Board().
void LibBoard::Board::setClippingPath | ( | const std::vector< Point > & | points | ) |
Define a clipping path for the whole drawing.
points | A path. |
References _clippingPath, _state, LibBoard::Path::clear(), and LibBoard::Board::State::unit().
void LibBoard::Board::setClippingPath | ( | const Path & | path | ) |
Define a clipping path for the whole drawing.
points | A path. |
References _clippingPath, _state, LibBoard::Path::pop_back(), LibBoard::Path::setClosed(), LibBoard::Path::size(), and LibBoard::Board::State::unit().
void LibBoard::Board::setClippingRectangle | ( | double | x, |
double | y, | ||
double | width, | ||
double | height | ||
) |
Define a clipping rectangle for the whole drawing.
x | |
y | |
width | |
height |
References _clippingPath, _state, LibBoard::Path::clear(), and LibBoard::Board::State::unit().
Board & LibBoard::Board::setFillColor | ( | const DGtal::Color & | color | ) |
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::fillColor.
Board & LibBoard::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. |
References _state, and LibBoard::Board::State::fillColor.
Board & LibBoard::Board::setFillColorRGBi | ( | unsigned char | red, |
unsigned char | green, | ||
unsigned char | blue, | ||
unsigned char | alpha = 255 |
||
) |
Changes the current fill color.
red | Red component. |
green | Green component. |
blue | Blue component. |
alpha | The opacity. |
References _state, and LibBoard::Board::State::fillColor.
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. (The unit is 1pt = 1/72 in). |
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. (The unit is 1pt = 1/72 in). |
References _state, and LibBoard::Board::State::fontSize.
Board& LibBoard::Board::setLineCap | ( | Shape::LineCap | cap | ) |
Set the line cap style.
cap | The cap-style which can be Shape::ButtCap, Shape::RoundCap or Shape::SquareCap. |
Board& LibBoard::Board::setLineJoin | ( | Shape::LineJoin | join | ) |
Set the line joine style.
cap | The join-style which can be Shape::MiterJoin, Shape::RoundJoin or Shape::BevelJoin. |
Board& LibBoard::Board::setLineStyle | ( | Shape::LineStyle | style | ) |
Changes the current line style.
style | The new line style. |
Board & LibBoard::Board::setLineWidth | ( | double | width | ) |
Changes the current line thickness (1/72 inche unit).
width | The new line thickness. |
References _state, and LibBoard::Board::State::lineWidth.
Board & LibBoard::Board::setPenColor | ( | const DGtal::Color & | color | ) |
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::penColor.
Board & LibBoard::Board::setPenColorRGBf | ( | float | red, |
float | green, | ||
float | blue, | ||
float | alpha = 1.0f |
||
) |
Changes the current pen color.
red | Red |
green | |
blue | |
alpha |
References _state, and LibBoard::Board::State::penColor.
Board & LibBoard::Board::setPenColorRGBi | ( | unsigned char | red, |
unsigned char | green, | ||
unsigned char | blue, | ||
unsigned char | alpha = 255 |
||
) |
Changes the current pen color.
red | Red component. |
green | Green component. |
blue | Blue component. |
References _state, and LibBoard::Board::State::penColor.
void LibBoard::Board::setUnit | ( | Unit | unit | ) |
Set the unit used by the drawSomething methods.
unit | The unit to be used in { PT, IN, CM, MM }. |
References _state, UCentimeter, UInche, UMillimeter, LibBoard::Board::State::unitFactor, and UPoint.
Referenced by operator<<().
void LibBoard::Board::setUnit | ( | double | factor, |
Unit | unit | ||
) |
Set the unit used by the drawSomething methods.
factor | The factor of the unit. |
unit | The unit to be used in { PT, IN, CM, MM }. |
References _state, UCentimeter, UInche, UMillimeter, LibBoard::Board::State::unitFactor, and UPoint.
|
virtual |
Translate the shape by a given offset.
dx | The x offset. |
dy | The y offset. |
Reimplemented from LibBoard::ShapeList.
References _clippingPath, and LibBoard::Path::translate().
Board LibBoard::Board::translated | ( | double | dx, |
double | dy | ||
) |
Reimplemented from LibBoard::ShapeList.
References Board().
|
protected |
The color of the background.
Referenced by backgroundColor(), clear(), saveEPS(), saveFIG(), saveSVG(), and saveTikZ().
|
protected |
Referenced by rotate(), saveEPS(), saveSVG(), saveTikZ(), scale(), setClippingPath(), setClippingRectangle(), and translate().
|
protected |
The current state.
Referenced by drawArc(), drawArrow(), drawBoundingBox(), drawCircle(), drawClosedPolyline(), drawDot(), drawEllipse(), drawImage(), drawLine(), drawPolyline(), drawRectangle(), drawText(), drawTriangle(), fillCircle(), fillEllipse(), fillGouraudTriangle(), fillPolyline(), fillRectangle(), fillTriangle(), operator<<(), setClippingPath(), setClippingRectangle(), setFillColor(), setFillColorRGBf(), setFillColorRGBi(), setFont(), setFontSize(), setLineWidth(), setPenColor(), setPenColorRGBf(), setPenColorRGBi(), and setUnit().
|
static |