Drag[en]gine Game Engine  1.0
deCanvasPaint Class Reference

Canvas rendering geometric shapes. More...

#include <deCanvasPaint.h>

Inheritance diagram for deCanvasPaint:
deCanvas deResource deObject

Public Types

enum  eShapeTypes {
  estPoints, estLines, estRectangle, estEllipse,
  estPie, estPolygon
}
 Shape types. More...
 
- Public Types inherited from deCanvas
enum  eBlendModes { ebmBlend, ebmAdd }
 Blend modes used to blend canvas over previous content. More...
 

Public Member Functions

Management
eShapeTypes GetShapeType () const
 Shape type. More...
 
void SetShapeType (eShapeTypes shapeType)
 Set shape type. More...
 
const decColorGetLineColor () const
 Line color. More...
 
void SetLineColor (const decColor &color)
 Set line color. More...
 
const decColorGetFillColor () const
 Fill color. More...
 
void SetFillColor (const decColor &color)
 Set fill color. More...
 
float GetThickness () const
 Line thickness in units. More...
 
void SetThickness (float thickness)
 Line thickness in units. More...
 
Points
int GetPointCount () const
 Number of points. More...
 
const decPointGetPointAt (int position) const
 Point at position. More...
 
void AddPoint (const decPoint &point)
 Add a point. More...
 
void RemovePointFrom (int position)
 Remove a point. More...
 
void RemoveAllPoints ()
 Remove all points. More...
 
Visiting
virtual void Visit (deCanvasVisitor &visitor)
 Visit canvas. More...
 
- Public Member Functions inherited from deCanvas
const decPointGetPosition () const
 Position in parent canvas view units. More...
 
void SetPosition (const decPoint &position)
 Set position in parent canvas view units. More...
 
const decPointGetSize () const
 Size in parent canvas view units. More...
 
void SetSize (const decPoint &size)
 Set size in parent canvas view units. More...
 
const decTexMatrix2GetTransform () const
 Transformation matrix affecting the canvas and all its content. More...
 
void SetTransform (const decTexMatrix2 &transform)
 Set transformation matrix affecting the canvas and all its content. More...
 
const decColorMatrixGetColorTransform () const
 Transformation matrix affecting the canvas content color. More...
 
void SetColorTransform (const decColorMatrix &transform)
 Set transformation matrix affecting the canvas content color. More...
 
bool GetVisible () const
 Canvas is visible. More...
 
void SetVisible (bool visible)
 Set if canvas is visible. More...
 
float GetOrder () const
 Render order. Larger renders ontop of smaller. More...
 
void SetOrder (float order)
 Set render order. Larger renders ontop of smaller. More...
 
float GetTransparency () const
 Transparency in the range from 0 to 1 where 1 is opaque and 0 fully transparent. More...
 
void SetTransparency (float transparency)
 Set transparency in the range from 0 to 1 where 1 is opaque and 0 fully transparent. More...
 
eBlendModes GetBlendMode () const
 Blend mode used to blend canvas over previous content. More...
 
void SetBlendMode (eBlendModes blendMode)
 Set blend mode used to blend canvas over previous content. More...
 
void NotifyContentChanged ()
 Notify peers about changes to the canvas content. More...
 
deBaseGraphicCanvasGetPeerGraphic () const
 Graphic system peer object or NULL if not set. More...
 
void SetPeerGraphic (deBaseGraphicCanvas *peer)
 Set graphic system peer object or NULL if not set. More...
 
deCanvasViewGetParentView () const
 Parent view or NULL if not set. More...
 
void SetParentView (deCanvasView *view)
 Set parent view or NULL if not set. More...
 
deCanvasGetLLViewPrev () const
 Previous canvas in the parent view linked list or NULL if not set. More...
 
void SetLLViewPrev (deCanvas *canvas)
 Set next canvas in the parent view linked list or NULL if not set. More...
 
deCanvasGetLLViewNext () const
 Next canvas in the parent view linked list or NULL if not set. More...
 
void SetLLViewNext (deCanvas *canvas)
 Set next canvas in the parent view linked list NULL if not set. More...
 
 deCanvas (deCanvasManager *manager)
 Create canvas. More...
 
- Public Member Functions inherited from deResource
deResourceManagerGetResourceManager () const
 Resource manager or NULL if resource is leaking. More...
 
deEngineGetEngine () const
 Game engine object from resource manager. More...
 
deResourceGetLLManagerPrev () const
 Previous resource in the resource manager linked list. More...
 
void SetLLManagerPrev (deResource *resource)
 Set next resource in the resource manager linked list. More...
 
deResourceGetLLManagerNext () const
 Next resource in the resource manager linked list. More...
 
void SetLLManagerNext (deResource *resource)
 Set next resource in the resource manager linked list. More...
 
void MarkLeaking ()
 Marks the resource leaking. More...
 
 deResource (deResourceManager *resourceManager)
 Create resource. More...
 
- Public Member Functions inherited from deObject
int GetRefCount () const
 Reference count. More...
 
void AddReference ()
 Add reference increasing reference count by 1. More...
 
void FreeReference ()
 Decrease reference count by one and delete object if count reaches 0. More...
 
 deObject ()
 Create object with reference count of 1. More...
 

Constructors and Destructors

 deCanvasPaint (deCanvasManager *manager)
 Create canvas. More...
 
virtual ~deCanvasPaint ()
 Clean up canvas. More...
 

Additional Inherited Members

- Protected Member Functions inherited from deCanvas
virtual ~deCanvas ()
 Clean up canvas. More...
 
- Protected Member Functions inherited from deResource
virtual ~deResource ()
 Clean up resource. More...
 
- Protected Member Functions inherited from deObject
virtual ~deObject ()
 Clean up object. More...
 

Detailed Description

Canvas rendering geometric shapes.

Author
Pl├╝ss Roland
Version
1.0
Date
2015

Member Enumeration Documentation

◆ eShapeTypes

Shape types.

Enumerator
estPoints 

Points of radius thickness.

Add N points to render N points.

estLines 

Disconnected line segments.

Add N*2 points to render N disconnected line segments.

estRectangle 

Filled or empty rectangle.

The width and height of the rectangle matches the canvas size rendering a rectangle filling the entire canvas.

estEllipse 

Filled or empty circle or ellipse.

Add 0 or 1 points to render a circle or ellipse. The radi of the circle or ellipse matches the size of the canvas rendering a circle or ellipse filling the entire canvas. The optional point defines the open (x coordinate) and close (y coordinate) angle. If no point is not set the circle or ellipse is closed. If a point is set the circle or ellipse is open with a line drawn between the open angle (x coordinate) and the close angle (y coordinate). The angles are expressed as radians running counter-clock-wise relative to the up axis of the canvas. If the circle or ellipse is open and the fillColor is not transparent the circle or ellipse is filled up to the straight connection line between the two end points.

estPie 

Filled or empty pie.

Same definition as deCanvasPaint::estEllipse with the difference that in the open case a connection line is drawn from one end point to the other across the center point.

estPolygon 

Open or closed filled or empty polygon.

Add N points to render a polygon with N corners. At least 2 points are required for the outline of the polygon to be rendered. At least 3 points are required for the polygon to be filled if fillColor is not transparent. The points have to be oriented clockwise. The polygon is not required to be convex. If the last point is equal to the first point the polygon is closed otherwise open. If the polygon is open it is filled up to the straight connection line between the two end points.

Constructor & Destructor Documentation

◆ deCanvasPaint()

deCanvasPaint::deCanvasPaint ( deCanvasManager manager)

Create canvas.

The default values are:

◆ ~deCanvasPaint()

virtual deCanvasPaint::~deCanvasPaint ( )
protectedvirtual

Clean up canvas.

Note
Subclasses should set their destructor protected too to avoid users accidently deleting a reference counted object through the object pointer. Only FreeReference() is allowed to delete the object.

Member Function Documentation

◆ AddPoint()

void deCanvasPaint::AddPoint ( const decPoint point)

Add a point.

Referenced by GetPointCount().

◆ GetFillColor()

const decColor& deCanvasPaint::GetFillColor ( ) const
inline

Fill color.

References SetFillColor().

◆ GetLineColor()

const decColor& deCanvasPaint::GetLineColor ( ) const
inline

Line color.

References SetLineColor().

◆ GetPointAt()

const decPoint& deCanvasPaint::GetPointAt ( int  position) const

Point at position.

Exceptions
deeInvalidParamposition is less than 0.
deeInvalidParamposition is larger or equal to GetPointCount().

Referenced by GetPointCount().

◆ GetPointCount()

int deCanvasPaint::GetPointCount ( ) const
inline

Number of points.

References AddPoint(), GetPointAt(), RemoveAllPoints(), RemovePointFrom(), and Visit().

◆ GetShapeType()

eShapeTypes deCanvasPaint::GetShapeType ( ) const
inline

Shape type.

References SetShapeType().

◆ GetThickness()

float deCanvasPaint::GetThickness ( ) const
inline

Line thickness in units.

References SetThickness().

◆ RemoveAllPoints()

void deCanvasPaint::RemoveAllPoints ( )

Remove all points.

Referenced by GetPointCount().

◆ RemovePointFrom()

void deCanvasPaint::RemovePointFrom ( int  position)

Remove a point.

Exceptions
deeInvalidParamposition is less than 0.
deeInvalidParamposition is larger or equal to GetPointCount().

Referenced by GetPointCount().

◆ SetFillColor()

void deCanvasPaint::SetFillColor ( const decColor color)

Set fill color.

Referenced by GetFillColor().

◆ SetLineColor()

void deCanvasPaint::SetLineColor ( const decColor color)

Set line color.

Referenced by GetLineColor().

◆ SetShapeType()

void deCanvasPaint::SetShapeType ( eShapeTypes  shapeType)

Set shape type.

Exceptions
deeInvalidParamshapeType is not a member of deCanvasPaint::eShapeTypes.

Referenced by GetShapeType().

◆ SetThickness()

void deCanvasPaint::SetThickness ( float  thickness)

Line thickness in units.

thickness is clamped to 0 or larger.

Referenced by GetThickness().

◆ Visit()

virtual void deCanvasPaint::Visit ( deCanvasVisitor visitor)
virtual

Visit canvas.

Reimplemented from deCanvas.

Referenced by GetPointCount().


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