Empirical
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
emp::web::CanvasShape Class Referenceabstract

Define an arbitrary shape to draw on a canvas (base clase) More...

#include <CanvasShape.h>

Inheritance diagram for emp::web::CanvasShape:
emp::web::CanvasAction emp::web::CanvasCircle emp::web::CanvasClearRect emp::web::CanvasLine emp::web::CanvasMultiLine emp::web::CanvasPolygon emp::web::CanvasRect emp::web::CanvasText

Public Member Functions

 CanvasShape (double _x, double _y, const std::string &fc="", const std::string &lc="", double lw=1.0)
 
 CanvasShape (Point _p, const std::string &fc="", const std::string &lc="", double lw=1.0)
 
virtual ~CanvasShape ()
 
void MoveTo (Point _p)
 Shift the position of this shape to a point. More...
 
void MoveTo (double _x, double _y)
 Shift the position of this shape to coordinates. More...
 
void SetLineWidth (double lw=1.0)
 Setup details needed before drawing lines. More...
 
void SetFillColor (const std::string &color)
 Change the fill color of this shape. More...
 
void SetLineColor (const std::string &color)
 Change the stroke color of this shape. More...
 
void ApplyColor ()
 Actually change the color on screen. More...
 
virtual void Apply ()=0
 Apply current action to emp_i.ctx. More...
 
virtual CanvasActionClone () const =0
 Make a copy of the current action. More...
 

Protected Member Functions

void Fill (const std::string &style="")
 Helper function to set the fill status. More...
 
void Stroke (const std::string &style="")
 Helper function to set the stroke status. More...
 
void LineWidth (double line_width=1.0)
 Helper function to set the stroke status. More...
 

Protected Attributes

Point p
 Anchor point for this shape. More...
 
std::string fill_color
 Internal color to fill shape with. More...
 
std::string line_color
 Border color for shape. More...
 
double line_width
 How wide should lines be? More...
 

Detailed Description

Define an arbitrary shape to draw on a canvas (base clase)

Constructor & Destructor Documentation

emp::web::CanvasShape::CanvasShape ( double  _x,
double  _y,
const std::string &  fc = "",
const std::string &  lc = "",
double  lw = 1.0 
)
inline
emp::web::CanvasShape::CanvasShape ( Point  _p,
const std::string &  fc = "",
const std::string &  lc = "",
double  lw = 1.0 
)
inline
virtual emp::web::CanvasShape::~CanvasShape ( )
inlinevirtual

Member Function Documentation

virtual void emp::web::CanvasAction::Apply ( )
pure virtualinherited
void emp::web::CanvasShape::ApplyColor ( )
inline

Actually change the color on screen.

virtual CanvasAction* emp::web::CanvasAction::Clone ( ) const
pure virtualinherited
void emp::web::CanvasAction::Fill ( const std::string &  style = "")
inlineprotectedinherited

Helper function to set the fill status.

void emp::web::CanvasAction::LineWidth ( double  line_width = 1.0)
inlineprotectedinherited

Helper function to set the stroke status.

void emp::web::CanvasShape::MoveTo ( Point  _p)
inline

Shift the position of this shape to a point.

void emp::web::CanvasShape::MoveTo ( double  _x,
double  _y 
)
inline

Shift the position of this shape to coordinates.

void emp::web::CanvasShape::SetFillColor ( const std::string &  color)
inline

Change the fill color of this shape.

void emp::web::CanvasShape::SetLineColor ( const std::string &  color)
inline

Change the stroke color of this shape.

void emp::web::CanvasShape::SetLineWidth ( double  lw = 1.0)
inline

Setup details needed before drawing lines.

void emp::web::CanvasAction::Stroke ( const std::string &  style = "")
inlineprotectedinherited

Helper function to set the stroke status.

Member Data Documentation

std::string emp::web::CanvasShape::fill_color
protected

Internal color to fill shape with.

std::string emp::web::CanvasShape::line_color
protected

Border color for shape.

double emp::web::CanvasShape::line_width
protected

How wide should lines be?

Point emp::web::CanvasShape::p
protected

Anchor point for this shape.


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