#include <Shapes.h>
Public Types | |
enum | LineCap { ButtCap = 0, RoundCap, SquareCap } |
enum | LineJoin { MiterJoin = 0, RoundJoin, BevelJoin } |
Public Member Functions | |
Shape (Color penColor, Color fillColor, float lineWidth, const LineCap cap, const LineJoin join, int depth) | |
virtual | ~Shape () |
virtual Shape * | clone () const =0 |
bool | filled () const |
virtual Point | center () const =0 |
virtual Shape & | rotate (double angle, const Point ¢er)=0 |
virtual Shape & | rotate (double angle)=0 |
Shape & | rotateDeg (double angle, const Point ¢er) |
Shape & | rotateDeg (double angle) |
virtual Shape & | translate (double dx, double dy)=0 |
virtual Shape & | scale (double sx, double sy)=0 |
virtual void | flushPostscript (std::ostream &stream, const TransformEPS &transform) const =0 |
virtual void | flushFIG (std::ostream &stream, const TransformFIG &transform, std::map< Color, int > &colormap) const =0 |
virtual void | flushSVG (std::ostream &stream, const TransformSVG &transform) const =0 |
virtual Rect | boundingBox () const =0 |
int | depth () const |
virtual void | depth (int) |
const Color & | penColor () const |
const Color & | fillColor () const |
Protected Member Functions | |
std::string | svgProperties (const TransformSVG &transform) const |
std::string | postscriptProperties () const |
Protected Attributes | |
int | _depth |
Color | _penColor |
Color | _fillColor |
float | _lineWidth |
LineCap | _lineCap |
LineJoin | _lineJoin |
Shape structure.
BoardLib::Shape::Shape | ( | Color | penColor, | |
Color | fillColor, | |||
float | lineWidth, | |||
const LineCap | cap, | |||
const LineJoin | join, | |||
int | depth | |||
) | [inline] |
Shape constructor.
penColor | The pen color of the shape. | |
fillColor | The fill color of the shape. | |
lineWidth | The line thickness. | |
depth | The depth of the shape. |
virtual BoardLib::Shape::~Shape | ( | ) | [inline, virtual] |
Shape destructor.
virtual Shape* BoardLib::Shape::clone | ( | ) | const [pure virtual] |
Return a copy of the shape.
Implemented in BoardLib::ShapeList, BoardLib::Group, BoardLib::Line, BoardLib::Arrow, BoardLib::Polyline, BoardLib::Rectangle, BoardLib::GouraudTriangle, BoardLib::Ellipse, BoardLib::Circle, and BoardLib::Text.
bool BoardLib::Shape::filled | ( | ) | const [inline] |
Checks whether a shape is filled with a color or not.
virtual Point BoardLib::Shape::center | ( | ) | const [pure virtual] |
Returns the gravity center of the shape.
Implemented in BoardLib::ShapeList, BoardLib::Line, BoardLib::Polyline, BoardLib::GouraudTriangle, BoardLib::Ellipse, BoardLib::Circle, and BoardLib::Text.
Rotate the shape around a given center of rotation.
angle | The rotation angle in radian. | |
center | The center of rotation. |
Implemented in BoardLib::ShapeList, BoardLib::Line, BoardLib::Polyline, BoardLib::GouraudTriangle, BoardLib::Ellipse, BoardLib::Circle, and BoardLib::Text.
virtual Shape& BoardLib::Shape::rotate | ( | double | angle | ) | [pure virtual] |
Rotate the shape around its center.
angle | The rotation angle in radian. |
Implemented in BoardLib::ShapeList, BoardLib::Line, BoardLib::Polyline, BoardLib::GouraudTriangle, BoardLib::Ellipse, BoardLib::Circle, and BoardLib::Text.
Rotate the shape around a given center of rotation.
angle | The rotation angle in degree. | |
center | The center of rotation. |
Shape & BoardLib::Shape::rotateDeg | ( | double | angle | ) | [inline] |
Rotate the shape around its center.
angle | The rotation angle in degree. | |
center | The center of rotation. |
virtual Shape& BoardLib::Shape::translate | ( | double | dx, | |
double | dy | |||
) | [pure virtual] |
Translate the shape by a given offset.
dx | The x offset. | |
dy | The y offset. |
Implemented in BoardLib::ShapeList, BoardLib::Line, BoardLib::Polyline, BoardLib::Ellipse, BoardLib::Circle, and BoardLib::Text.
virtual Shape& BoardLib::Shape::scale | ( | double | sx, | |
double | sy | |||
) | [pure 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. |
Implemented in BoardLib::ShapeList, BoardLib::Line, BoardLib::Polyline, BoardLib::Ellipse, BoardLib::Circle, and BoardLib::Text.
virtual void BoardLib::Shape::flushPostscript | ( | std::ostream & | stream, | |
const TransformEPS & | transform | |||
) | const [pure virtual] |
Writes the EPS code of the shape in a stream according to a transform.
stream | The output stream. | |
transform | A 2D transform to be applied. |
Implemented in BoardLib::ShapeList, BoardLib::Group, BoardLib::Line, BoardLib::Arrow, BoardLib::Polyline, BoardLib::GouraudTriangle, BoardLib::Ellipse, and BoardLib::Text.
virtual void BoardLib::Shape::flushFIG | ( | std::ostream & | stream, | |
const TransformFIG & | transform, | |||
std::map< Color, int > & | colormap | |||
) | const [pure virtual] |
Writes the FIG code of the shape in a stream according to a transform.
stream | The output stream. | |
transform | A 2D transform to be applied. |
Implemented in BoardLib::ShapeList, BoardLib::Group, BoardLib::Line, BoardLib::Arrow, BoardLib::Polyline, BoardLib::Rectangle, BoardLib::GouraudTriangle, BoardLib::Ellipse, and BoardLib::Text.
virtual void BoardLib::Shape::flushSVG | ( | std::ostream & | stream, | |
const TransformSVG & | transform | |||
) | const [pure virtual] |
Writes the SVG code of the shape in a stream according to a transform.
stream | The output stream. | |
transform | A 2D transform to be applied. |
Implemented in BoardLib::ShapeList, BoardLib::Group, BoardLib::Line, BoardLib::Arrow, BoardLib::Polyline, BoardLib::Rectangle, BoardLib::GouraudTriangle, BoardLib::Ellipse, BoardLib::Circle, and BoardLib::Text.
virtual Rect BoardLib::Shape::boundingBox | ( | ) | const [pure virtual] |
Returns the bounding box of the figure.
Implemented in BoardLib::ShapeList, BoardLib::Line, BoardLib::Polyline, BoardLib::Ellipse, and BoardLib::Text.
std::string BoardLib::Shape::svgProperties | ( | const TransformSVG & | transform | ) | const [protected] |
Return a string of the svg properties lineWidth, opacity, penColor, fillColor, lineCap, and lineJoin.
std::string BoardLib::Shape::postscriptProperties | ( | ) | const [protected] |
Return a string of the properties lineWidth, penColor, lineCap, and lineJoin as Postscript commands.
int BoardLib::Shape::_depth [protected] |
The depth of the shape.
Color BoardLib::Shape::_penColor [protected] |
The color of the shape.
Color BoardLib::Shape::_fillColor [protected] |
The color of the shape.
float BoardLib::Shape::_lineWidth [protected] |
The line thickness.
LineCap BoardLib::Shape::_lineCap [protected] |
The linecap attribute. (The way line terminates.)
LineJoin BoardLib::Shape::_lineJoin [protected] |
The linejoin attribute. (The shape of line junctions.)