Drag[en]gine Game Engine  1.0
deCanvas Class Reference

Canvas rendering 2D content. More...

#include <deCanvas.h>

Inheritance diagram for deCanvas:
deResource deObject deCanvasCanvasView deCanvasImage deCanvasPaint deCanvasRenderWorld deCanvasText deCanvasVideoPlayer deCanvasView

Public Types

enum  eBlendModes { ebmBlend, ebmAdd }
 Blend modes used to blend canvas over previous content. More...
 

Public Member Functions

Management
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...
 
System Peers
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...
 
Visiting
virtual void Visit (deCanvasVisitor &visitor)
 Visit canvas. More...
 
Linked List
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...
 
- 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

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

Additional Inherited Members

- 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 2D content.

Canvas are the basic elements of 2D rendering. At the top stands a deCanvasView representing a view on a set of child canvas. A canvas has a position and size relative to the parent canvas view coordinate system. The position of the canvas is the top left corner and the size spawns to the right bottom corner. An additional transformation matrix allows to apply transformation effects to the canvas and its coordinate system. The canvas coordinate system maps (0,0) to the top left corner of the canvas and (size.x,size.y) to the lower right corner. This coordinate system is then eventually transformed by the transformation matrix. Units are measured as pixels unless transformed. Canvas can be set invisible hiding the canvas and all content inside. The order of the canvas defines the render order with canvas of higher order rendered above those with smaller number. This uncouples the render ordering from the actual ordering of the canvas objects in a deCanvasView. If two canvas have the same order the render order is undefined.

Author
Pl├╝ss Roland
Version
1.0
Date
2015

Member Enumeration Documentation

◆ eBlendModes

Blend modes used to blend canvas over previous content.

Enumerator
ebmBlend 

Blend canvas over previous content.

Pixel color is oldColor * (1-transparency) + newColor * transparency. This is the default blend mode.

ebmAdd 

Add canvas over previous content.

Pixel color is oldColor + newColor * transparency.

Constructor & Destructor Documentation

◆ deCanvas()

deCanvas::deCanvas ( deCanvasManager manager)

Create canvas.

The default size is set to 20x20 units.

◆ ~deCanvas()

virtual deCanvas::~deCanvas ( )
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

◆ GetBlendMode()

eBlendModes deCanvas::GetBlendMode ( ) const
inline

Blend mode used to blend canvas over previous content.

References NotifyContentChanged(), and SetBlendMode().

◆ GetColorTransform()

const decColorMatrix& deCanvas::GetColorTransform ( ) const
inline

Transformation matrix affecting the canvas content color.

References SetColorTransform().

◆ GetLLViewNext()

deCanvas* deCanvas::GetLLViewNext ( ) const
inline

Next canvas in the parent view linked list or NULL if not set.

References SetLLViewNext().

◆ GetLLViewPrev()

deCanvas* deCanvas::GetLLViewPrev ( ) const
inline

Previous canvas in the parent view linked list or NULL if not set.

References SetLLViewPrev().

◆ GetOrder()

float deCanvas::GetOrder ( ) const
inline

Render order. Larger renders ontop of smaller.

References SetOrder().

◆ GetParentView()

deCanvasView* deCanvas::GetParentView ( ) const
inline

Parent view or NULL if not set.

References SetParentView().

◆ GetPeerGraphic()

deBaseGraphicCanvas* deCanvas::GetPeerGraphic ( ) const
inline

Graphic system peer object or NULL if not set.

References SetPeerGraphic(), and Visit().

◆ GetPosition()

const decPoint& deCanvas::GetPosition ( ) const
inline

Position in parent canvas view units.

References SetPosition().

◆ GetSize()

const decPoint& deCanvas::GetSize ( ) const
inline

Size in parent canvas view units.

References SetSize().

◆ GetTransform()

const decTexMatrix2& deCanvas::GetTransform ( ) const
inline

Transformation matrix affecting the canvas and all its content.

References SetTransform().

◆ GetTransparency()

float deCanvas::GetTransparency ( ) const
inline

Transparency in the range from 0 to 1 where 1 is opaque and 0 fully transparent.

References SetTransparency().

◆ GetVisible()

bool deCanvas::GetVisible ( ) const
inline

Canvas is visible.

References SetVisible().

◆ NotifyContentChanged()

void deCanvas::NotifyContentChanged ( )

Notify peers about changes to the canvas content.

Referenced by GetBlendMode().

◆ SetBlendMode()

void deCanvas::SetBlendMode ( eBlendModes  blendMode)

Set blend mode used to blend canvas over previous content.

Referenced by GetBlendMode().

◆ SetColorTransform()

void deCanvas::SetColorTransform ( const decColorMatrix transform)

Set transformation matrix affecting the canvas content color.

Referenced by GetColorTransform().

◆ SetLLViewNext()

void deCanvas::SetLLViewNext ( deCanvas canvas)

Set next canvas in the parent view linked list NULL if not set.

Referenced by GetLLViewNext().

◆ SetLLViewPrev()

void deCanvas::SetLLViewPrev ( deCanvas canvas)

Set next canvas in the parent view linked list or NULL if not set.

Referenced by GetLLViewPrev().

◆ SetOrder()

void deCanvas::SetOrder ( float  order)

Set render order. Larger renders ontop of smaller.

Referenced by GetOrder().

◆ SetParentView()

void deCanvas::SetParentView ( deCanvasView view)

Set parent view or NULL if not set.

Referenced by GetParentView().

◆ SetPeerGraphic()

void deCanvas::SetPeerGraphic ( deBaseGraphicCanvas peer)

Set graphic system peer object or NULL if not set.

Referenced by GetPeerGraphic().

◆ SetPosition()

void deCanvas::SetPosition ( const decPoint position)

Set position in parent canvas view units.

Referenced by GetPosition().

◆ SetSize()

void deCanvas::SetSize ( const decPoint size)

Set size in parent canvas view units.

Referenced by GetSize().

◆ SetTransform()

void deCanvas::SetTransform ( const decTexMatrix2 transform)

Set transformation matrix affecting the canvas and all its content.

Referenced by GetTransform().

◆ SetTransparency()

void deCanvas::SetTransparency ( float  transparency)

Set transparency in the range from 0 to 1 where 1 is opaque and 0 fully transparent.

Referenced by GetTransparency().

◆ SetVisible()

void deCanvas::SetVisible ( bool  visible)

Set if canvas is visible.

Referenced by GetVisible().

◆ Visit()

virtual void deCanvas::Visit ( deCanvasVisitor visitor)
virtual

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