Fawkes API  Fawkes Development Version
VisualDisplay2D::Text Class Reference

Class representing a text object. More...

#include "visdisplay.h"

Inheritance diagram for VisualDisplay2D::Text:

Public Member Functions

 Text (float x, float y, std::string text, fawkes::VisualDisplay2DInterface::Anchor anchor, float size, unsigned int id, unsigned int owner, unsigned char r=0, unsigned char g=0, unsigned char b=0, unsigned char a=0)
 Constructor. More...
 
void draw (Cairo::RefPtr< Cairo::Context > &cr)
 Draw shape to Cairo context. More...
 
- Public Member Functions inherited from VisualDisplay2D::Shape
 Shape (unsigned int id, unsigned int owner, fawkes::VisualDisplay2DInterface::LineStyle line_style=fawkes::VisualDisplay2DInterface::LS_SOLID, unsigned char r=0, unsigned char g=0, unsigned char b=0, unsigned char a=0)
 Constructor. More...
 
virtual ~Shape ()
 Virtual empty destructor. More...
 
void apply_style (Cairo::RefPtr< Cairo::Context > &cr)
 Set style on context. More...
 
unsigned int id ()
 Get shape ID. More...
 
unsigned int owner ()
 Get owner ID. More...
 
void color (float &r, float &g, float &b, float &a)
 Get shape color. More...
 

Additional Inherited Members

- Protected Attributes inherited from VisualDisplay2D::Shape
fawkes::VisualDisplay2DInterface::LineStyle _line_style
 Line style. More...
 
float _color_r
 red part of RGBA object color More...
 
float _color_g
 green part of RGBA object color More...
 
float _color_b
 blue part of RGBA object color More...
 
float _color_a
 alpha part of RGBA object color More...
 
unsigned int _id
 Object ID. More...
 
unsigned int _owner
 Owner ID. More...
 

Detailed Description

Class representing a text object.

Text is represented by a cartesian coordinate, which denotes a specific point defined by the anchor, the text itself, and a text size.

Author
Tim Niemueller

Definition at line 114 of file visdisplay.h.

Constructor & Destructor Documentation

◆ Text()

VisualDisplay2D::Text::Text ( float  x,
float  y,
std::string  text,
fawkes::VisualDisplay2DInterface::Anchor  anchor,
float  size,
unsigned int  id,
unsigned int  owner,
unsigned char  r = 0,
unsigned char  g = 0,
unsigned char  b = 0,
unsigned char  a = 0 
)

Constructor.

Parameters
xX coordinate of anchor point
yY coordinate of anchor point
texttext to display
anchoranchor point relative to the text's bounding box
sizeheight of font in meters
idobject ID
ownerID of the owner of the object
rred part of RGBA color
ggreen part of RGBA color
bblue part of RGBA color
aalpha part of RGBA color

Definition at line 343 of file visdisplay.cpp.

Member Function Documentation

◆ draw()

void VisualDisplay2D::Text::draw ( Cairo::RefPtr< Cairo::Context > &  cr)
virtual

Draw shape to Cairo context.

This method shall be implemented by a shape to draw itself using the provided Cairo context.

Parameters
crreference to Cairo context. Note that this is a reference bypassing the reference pointer. This is done for efficiency and with the assumption that this method is only called by VisualDisplay2D::draw() which itself has proper refptr handling.

Implements VisualDisplay2D::Shape.

Definition at line 360 of file visdisplay.cpp.


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