Fawkes API  Fawkes Development Version
VisualDisplay2D::Shape Class Referenceabstract

#include "visdisplay.h"

Inheritance diagram for VisualDisplay2D::Shape:

Public Member Functions

 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...
 
virtual void draw (Cairo::RefPtr< Cairo::Context > &cr)=0
 
void apply_style (Cairo::RefPtr< Cairo::Context > &cr)
 
unsigned int id ()
 
unsigned int owner ()
 
void color (float &r, float &g, float &b, float &a)
 

Protected Attributes

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 shape. All shapes inherit from the class and provide drawing primitives. The internal object representations are instances of shapes.

Author
Tim Niemueller

Definition at line 49 of file visdisplay.h.

Constructor & Destructor Documentation

◆ Shape()

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.

Parameters
idobject ID
ownerID of the owner of the object
line_styledrawing style of lines of shapes
rred part of RGBA color
ggreen part of RGBA color
bblue part of RGBA color
aalpha part of RGBA color

Definition at line 204 of file visdisplay.cpp.

◆ ~Shape()

VisualDisplay2D::Shape::~Shape ( )
virtual

Virtual empty destructor.

Definition at line 222 of file visdisplay.cpp.

Member Function Documentation

◆ apply_style()

void VisualDisplay2D::Shape::apply_style ( Cairo::RefPtr< Cairo::Context > &  cr)
inline

Set style on context. This method sets the style determined by the shape to the 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.

Definition at line 63 of file visdisplay.h.

References _id.

◆ color()

void VisualDisplay2D::Shape::color ( float &  r,
float &  g,
float &  b,
float &  a 
)
inline

Get shape color.

Parameters
rupon return contains red part of RGBA color
gupon return contains green part of RGBA color
bupon return contains blue part of RGBA color
aupon return contains alpha part of RGBA color

Definition at line 79 of file visdisplay.h.

◆ draw()

VisualDisplay2D::Shape::draw ( Cairo::RefPtr< Cairo::Context > &  cr)
pure 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.

Implemented in VisualDisplay2D::Text, VisualDisplay2D::Circle, VisualDisplay2D::Rectangle, and VisualDisplay2D::Line.

◆ id()

unsigned int VisualDisplay2D::Shape::id ( )
inline

Get shape ID.

Returns
shape ID

Definition at line 69 of file visdisplay.h.

References _owner.

◆ owner()

unsigned int VisualDisplay2D::Shape::owner ( )
inline

Get owner ID.

Returns
owner ID

Definition at line 74 of file visdisplay.h.

References _color_a, _color_b, _color_g, and _color_r.

Member Data Documentation

◆ _color_a

float VisualDisplay2D::Shape::_color_a
protected

alpha part of RGBA object color

Definition at line 92 of file visdisplay.h.

Referenced by owner().

◆ _color_b

float VisualDisplay2D::Shape::_color_b
protected

blue part of RGBA object color

Definition at line 91 of file visdisplay.h.

Referenced by owner().

◆ _color_g

float VisualDisplay2D::Shape::_color_g
protected

green part of RGBA object color

Definition at line 90 of file visdisplay.h.

Referenced by owner().

◆ _color_r

float VisualDisplay2D::Shape::_color_r
protected

red part of RGBA object color

Definition at line 89 of file visdisplay.h.

Referenced by owner().

◆ _id

unsigned int VisualDisplay2D::Shape::_id
protected

Object ID.

Definition at line 94 of file visdisplay.h.

Referenced by apply_style().

◆ _line_style

fawkes::VisualDisplay2DInterface::LineStyle VisualDisplay2D::Shape::_line_style
protected

Line style.

Definition at line 88 of file visdisplay.h.

◆ _owner

unsigned int VisualDisplay2D::Shape::_owner
protected

Owner ID.

Definition at line 95 of file visdisplay.h.

Referenced by id().


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