#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. | |
virtual | ~Shape () |
Virtual empty destructor. | |
virtual void | draw (Cairo::RefPtr< Cairo::Context > &cr)=0 |
Draw shape to Cairo context. | |
void | apply_style (Cairo::RefPtr< Cairo::Context > &cr) |
Set style on context. | |
unsigned int | id () |
Get shape ID. | |
unsigned int | owner () |
Get owner ID. | |
void | color (float &r, float &g, float &b, float &a) |
Get shape color. | |
Protected Attributes | |
fawkes::VisualDisplay2DInterface::LineStyle | _line_style |
Line style. | |
float | _color_r |
red part of RGBA object color | |
float | _color_g |
green part of RGBA object color | |
float | _color_b |
blue part of RGBA object color | |
float | _color_a |
alpha part of RGBA object color | |
unsigned int | _id |
Object ID. | |
unsigned int | _owner |
Owner ID. |
All shapes inherit from the class and provide drawing primitives. The internal object representations are instances of shapes.
Definition at line 43 of file visdisplay.h.
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.
id | object ID | |
owner | ID of the owner of the object | |
line_style | drawing style of lines of shapes | |
r | red part of RGBA color | |
g | green part of RGBA color | |
b | blue part of RGBA color | |
a | alpha part of RGBA color |
Definition at line 179 of file visdisplay.cpp.
References _color_a, _color_b, _color_g, _color_r, _id, _line_style, and _owner.
VisualDisplay2D::Shape::~Shape | ( | ) | [virtual] |
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.
cr | reference 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 51 of file visdisplay.h.
void VisualDisplay2D::Shape::color | ( | float & | r, | |
float & | g, | |||
float & | b, | |||
float & | a | |||
) | [inline] |
Get shape color.
r | upon return contains red part of RGBA color | |
g | upon return contains green part of RGBA color | |
b | upon return contains blue part of RGBA color | |
a | upon return contains alpha part of RGBA color |
Definition at line 56 of file visdisplay.h.
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.
cr | reference 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::Line, VisualDisplay2D::Rectangle, VisualDisplay2D::Circle, and VisualDisplay2D::Text.
unsigned int VisualDisplay2D::Shape::id | ( | ) | [inline] |
unsigned int VisualDisplay2D::Shape::owner | ( | ) | [inline] |
float VisualDisplay2D::Shape::_color_a [protected] |
alpha part of RGBA object color
Definition at line 64 of file visdisplay.h.
Referenced by apply_style(), color(), and Shape().
float VisualDisplay2D::Shape::_color_b [protected] |
blue part of RGBA object color
Definition at line 63 of file visdisplay.h.
Referenced by apply_style(), color(), and Shape().
float VisualDisplay2D::Shape::_color_g [protected] |
green part of RGBA object color
Definition at line 62 of file visdisplay.h.
Referenced by apply_style(), color(), and Shape().
float VisualDisplay2D::Shape::_color_r [protected] |
red part of RGBA object color
Definition at line 61 of file visdisplay.h.
Referenced by apply_style(), color(), and Shape().
unsigned int VisualDisplay2D::Shape::_id [protected] |
unsigned int VisualDisplay2D::Shape::_owner [protected] |