LibBoard::Text Struct Reference

A piece of text. More...

#include <Shapes.h>

Inheritance diagram for LibBoard::Text:

LibBoard::Shape

List of all members.

Public Member Functions

 Text (double x, double y, const std::string &text, const Fonts::Font font, float size, Color color=Color::Black, int depth=-1)
 Text (double x, double y, const std::string &text, const Fonts::Font font, const std::string &svgFont, float size, Color color=Color::Black, int depth=-1)
const std::string & name () const
Point center () const
Shaperotate (double angle, const Point &center)
Text rotated (double angle, const Point &center) const
Shaperotate (double angle)
Text rotated (double angle) const
Shapetranslate (double dx, double dy)
Text translated (double dx, double dy) const
Shapescale (double sx, double sy)
Shapescale (double s)
Text scaled (double sx, double sy) const
Text scaled (double s) const
void scaleAll (double s)
void flushPostscript (std::ostream &stream, const TransformEPS &transform) const
void flushFIG (std::ostream &stream, const TransformFIG &transform, std::map< Color, int > &colormap) const
void flushSVG (std::ostream &stream, const TransformSVG &transform) const
Rect boundingBox () const
Shapeclone () const

Protected Attributes

Point _position
std::string _text
Fonts::Font _font
std::string _svgFont
double _angle
float _size
double _xScale
double _yScale


Detailed Description

A piece of text.

The text structure.

Examples:

examples/example2.cpp, examples/koch.cpp, examples/logo.cpp, and examples/ruler.cpp.


Constructor & Destructor Documentation

LibBoard::Text::Text ( double  x,
double  y,
const std::string &  text,
const Fonts::Font  font,
float  size,
Color  color = Color::Black,
int  depth = -1 
) [inline]

Create a Text sctucture.

Parameters:
x 
y 
text 
font 
size The font size expressed in 1/72 inches.
color 
depth 
Returns:

Referenced by clone().

LibBoard::Text::Text ( double  x,
double  y,
const std::string &  text,
const Fonts::Font  font,
const std::string &  svgFont,
float  size,
Color  color = Color::Black,
int  depth = -1 
) [inline]

Create a Text sctucture.

Parameters:
x 
y 
text 
font 
svgFont The font family for an SVG file. (E.g. "Verdana, Arial" or "'Time New Roman', Serif" )
size The font size expressed in 1/72 inches.
color 
depth 
Returns:


Member Function Documentation

const std::string & LibBoard::Text::name (  )  const [virtual]

Returns the generic name of the shape (e.g., Circle, Rectangle, etc.)

Returns:

Reimplemented from LibBoard::Shape.

Point LibBoard::Text::center (  )  const [virtual]

Returns the gravity center of the shape.

Returns:
The center of the shape.

Implements LibBoard::Shape.

Shape & LibBoard::Text::rotate ( double  angle,
const Point center 
) [virtual]

Rotate the shape around a given center of rotation.

Parameters:
angle The rotation angle in radian.
center The center of rotation.
Returns:
A reference to the shape itself.

Implements LibBoard::Shape.

References LibBoard::Point::norm(), LibBoard::Point::rotate(), LibBoard::Point::x, and LibBoard::Point::y.

Shape & LibBoard::Text::rotate ( double  angle  )  [virtual]

Rotate the shape around its center.

Parameters:
angle The rotation angle in radian.
Returns:
A reference to the shape itself.

Implements LibBoard::Shape.

Shape & LibBoard::Text::translate ( double  dx,
double  dy 
) [virtual]

Translate the shape by a given offset.

Parameters:
dx The x offset.
dy The y offset.
Returns:
A reference to the shape itself.

Implements LibBoard::Shape.

Shape & LibBoard::Text::scale ( double  sx,
double  sy 
) [virtual]

Scale the shape along the x an y axis.

Parameters:
sx The scale factor along the x axis.
sy The scale factor along the y axis.
Returns:
The shape itself.

Implements LibBoard::Shape.

Shape & LibBoard::Text::scale ( double  s  )  [virtual]

Scale the shape along both axis.

Parameters:
s The scale factor along both axis.
Returns:
The shape itself.

Implements LibBoard::Shape.

void LibBoard::Text::scaleAll ( double  s  )  [virtual]

Scales all the values (positions, dimensions, etc.) associated with the shape.

Parameters:
s The scaling factor.

Implements LibBoard::Shape.

void LibBoard::Text::flushPostscript ( std::ostream &  stream,
const TransformEPS transform 
) const [virtual]

Writes the EPS code of the shape in a stream according to a transform.

Parameters:
stream The output stream.
transform A 2D transform to be applied.

Implements LibBoard::Shape.

References LibBoard::Shape::_penColor, LibBoard::Transform::mapX(), LibBoard::TransformEPS::mapY(), LibBoard::Color::postscript(), LibBoard::Point::x, and LibBoard::Point::y.

void LibBoard::Text::flushFIG ( std::ostream &  stream,
const TransformFIG transform,
std::map< Color, int > &  colormap 
) const [virtual]

Writes the FIG code of the shape in a stream according to a transform.

Parameters:
stream The output stream.
transform A 2D transform to be applied.

Implements LibBoard::Shape.

References LibBoard::Shape::_depth, LibBoard::Shape::_penColor, LibBoard::TransformFIG::mapDepth(), LibBoard::Transform::mapX(), LibBoard::TransformFIG::mapY(), LibBoard::Point::x, and LibBoard::Point::y.

void LibBoard::Text::flushSVG ( std::ostream &  stream,
const TransformSVG transform 
) const [virtual]

Writes the SVG code of the shape in a stream according to a transform.

Parameters:
stream The output stream.
transform A 2D transform to be applied.

Implements LibBoard::Shape.

References LibBoard::Shape::_penColor, LibBoard::Transform::mapX(), LibBoard::TransformSVG::mapY(), LibBoard::Color::svg(), LibBoard::Color::svgAlpha(), LibBoard::Point::x, and LibBoard::Point::y.

Rect LibBoard::Text::boundingBox (  )  const [virtual]

Returns the bounding box of the figure.

Returns:
The rectangle of the bounding box.

Implements LibBoard::Shape.

References LibBoard::Point::x, and LibBoard::Point::y.

Shape * LibBoard::Text::clone (  )  const [virtual]

Return a copy of the shape.

Returns:

Implements LibBoard::Shape.

References Text().


The documentation for this struct was generated from the following files:

Generated on Mon Jan 19 09:48:19 2009 for Board by  doxygen 1.5.6