VSTGUI  3.6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Public Member Functions | Public Attributes | Protected Attributes | List of all members
CDrawContext Class Reference

A drawing context encapsulates the drawing context of the underlying OS. More...

#include <vstgui.h>

+ Inheritance diagram for CDrawContext:

Public Member Functions

 ~CDrawContext ()
 
void * getWindow ()
 
void setWindow (void *ptr)
 
void getLoc (CPoint &where) const
 
CFramegetFrame () const
 
void * getSystemContext () const
 
void forget ()
 decrease refcount and delete object if refcount == 0 More...
 
CColor getPoint (const CPoint &point)
 
void floodFill (const CPoint &start)
 
void drawArc (const CRect &rect, const CPoint &point1, const CPoint &point2)
 
void fillArc (const CRect &rect, const CPoint &point1, const CPoint &point2)
 
void polyLine (const CPoint *pPoint, long numberOfPoints)
 
void fillPolygon (const CPoint *pPoint, long numberOfPoints)
 
void fillRect (const CRect &rect)
 
void fillEllipse (const CRect &rect)
 
long getMouseButtons ()
 
void getMouseLocation (CPoint &point)
 
bool waitDoubleClick ()
 
bool waitDrag ()
 

Public Attributes

CPoint offsetScreen
 
CPoint offset
 

Protected Attributes

void * pSystemContext
 
void * pWindow
 
CFramepFrame
 
CFontRef font
 
CColor fontColor
 
CPoint penLoc
 
CCoord frameWidth
 
CColor frameColor
 
CColor fillColor
 
CLineStyle lineStyle
 
CDrawMode drawMode
 
CRect clipRect
 

Reference Counting Methods

virtual void remember ()
 increase refcount More...
 
long getNbReference () const
 get refcount More...
 

Message Methods

virtual CMessageResult notify (CBaseObject *sender, const char *message)
 

Constructor

 CDrawContext (CFrame *pFrame, void *pSystemContext, void *pWindow=0)
 

Draw primitives

void moveTo (const CPoint &point)
 move line position to point More...
 
void lineTo (const CPoint &point)
 draw a line from current position to point More...
 
void drawLines (const CPoint *points, const long &numberOfLines)
 draw multiple lines at once More...
 
void drawPolygon (const CPoint *pPoints, long numberOfPoints, const CDrawStyle drawStyle=kDrawStroked, bool closePolygon=true)
 draw a polygon More...
 
void drawRect (const CRect &rect, const CDrawStyle drawStyle=kDrawStroked)
 draw a rect More...
 
void drawArc (const CRect &rect, const float startAngle1, const float endAngle2, const CDrawStyle drawStyle=kDrawStroked)
 draw an arc, angles are in degree More...
 
void drawEllipse (const CRect &rect, const CDrawStyle drawStyle=kDrawStroked)
 draw an ellipse More...
 
void drawPoint (const CPoint &point, CColor color)
 draw a point More...
 

Line Mode

void setLineStyle (CLineStyle style)
 set the current line style More...
 
CLineStyle getLineStyle () const
 get the current line style More...
 
void setLineWidth (CCoord width)
 set the current line width More...
 
CCoord getLineWidth () const
 get the current line width More...
 

Draw Mode

void setDrawMode (CDrawMode mode)
 set the current draw mode, see CDrawMode More...
 
CDrawMode getDrawMode () const
 get the current draw mode, see CDrawMode More...
 

Clipping

void setClipRect (const CRect &clip)
 set the current clip More...
 
CRectgetClipRect (CRect &clip) const
 get the current clip More...
 
void resetClipRect ()
 reset the clip to the default state More...
 

Color

void setFillColor (const CColor color)
 set current fill color More...
 
CColor getFillColor () const
 get current fill color More...
 
void setFrameColor (const CColor color)
 set current stroke color More...
 
CColor getFrameColor () const
 get current stroke color More...
 

Font

void setFontColor (const CColor color)
 set current font color More...
 
CColor getFontColor () const
 get current font color More...
 
void setFont (const CFontRef font, const long &size=0, const long &style=-1)
 set current font More...
 
const CFontRefgetFont () const
 get current font More...
 
long getFontSize () const
 get current font size More...
 

Text

CCoord getStringWidth (const char *pStr)
 get the width of an ASCII encoded string More...
 
void drawString (const char *pString, const CRect &rect, const short opaque=false, const CHoriTxtAlign hAlign=kCenterText)
 draw an ASCII encoded string More...
 
CCoord getStringWidthUTF8 (const char *pStr)
 get the width of an UTF-8 encoded string More...
 
void drawStringUTF8 (const char *pString, const CRect &rect, const CHoriTxtAlign hAlign=kCenterText, bool antialias=true)
 draw an UTF-8 encoded string More...
 
void drawStringUTF8 (const char *string, const CPoint &_point, bool antialias=true)
 draw an UTF-8 encoded string More...
 

Detailed Description

A drawing context encapsulates the drawing context of the underlying OS.

Constructor & Destructor Documentation

CDrawContext ( CFrame inFrame,
void *  inSystemContext,
void *  inWindow = 0 
)

CDrawContext constructor.

Parameters
inFramethe parent CFrame
inSystemContextthe platform system context, can be NULL
inWindowthe platform window object

Member Function Documentation

void drawArc ( const CRect rect,
const float  startAngle1,
const float  endAngle2,
const CDrawStyle  drawStyle = kDrawStroked 
)

draw an arc, angles are in degree

void drawArc ( const CRect rect,
const CPoint point1,
const CPoint point2 
)
void drawEllipse ( const CRect rect,
const CDrawStyle  drawStyle = kDrawStroked 
)

draw an ellipse

void drawLines ( const CPoint points,
const long &  numberOfLines 
)

draw multiple lines at once

void drawPoint ( const CPoint point,
CColor  color 
)

draw a point

void drawPolygon ( const CPoint pPoints,
long  numberOfPoints,
const CDrawStyle  drawStyle = kDrawStroked,
bool  closePolygon = true 
)

draw a polygon

void drawRect ( const CRect rect,
const CDrawStyle  drawStyle = kDrawStroked 
)

draw a rect

void drawString ( const char *  pString,
const CRect rect,
const short  opaque = false,
const CHoriTxtAlign  hAlign = kCenterText 
)

draw an ASCII encoded string

void drawStringUTF8 ( const char *  pString,
const CRect rect,
const CHoriTxtAlign  hAlign = kCenterText,
bool  antialias = true 
)

draw an UTF-8 encoded string

void drawStringUTF8 ( const char *  string,
const CPoint _point,
bool  antialias = true 
)

draw an UTF-8 encoded string

void fillArc ( const CRect rect,
const CPoint point1,
const CPoint point2 
)
void fillEllipse ( const CRect rect)
Deprecated:
use VSTGUI::CDrawContext::drawEllipse with kDrawFilled as draw style
void fillPolygon ( const CPoint pPoint,
long  numberOfPoints 
)
Deprecated:
use VSTGUI::CDrawContext::drawPolygon with kDrawFilled as draw style
void fillRect ( const CRect rect)
Deprecated:
use VSTGUI::CDrawContext::drawRect with kDrawFilled as draw style
void floodFill ( const CPoint start)
void forget ( )
virtual

decrease refcount and delete object if refcount == 0

Reimplemented from CBaseObject.

CRect& getClipRect ( CRect clip) const
inline

get the current clip

CDrawMode getDrawMode ( ) const
inline

get the current draw mode, see CDrawMode

CColor getFillColor ( ) const
inline

get current fill color

const CFontRef& getFont ( ) const
inline

get current font

CColor getFontColor ( ) const
inline

get current font color

long getFontSize ( ) const
inline

get current font size

CFrame* getFrame ( ) const
inline
CColor getFrameColor ( ) const
inline

get current stroke color

CLineStyle getLineStyle ( ) const
inline

get the current line style

CCoord getLineWidth ( ) const
inline

get the current line width

void getLoc ( CPoint where) const
inline
long getMouseButtons ( )
void getMouseLocation ( CPoint point)
long getNbReference ( ) const
inlineinherited

get refcount

CColor getPoint ( const CPoint point)
CCoord getStringWidth ( const char *  pStr)

get the width of an ASCII encoded string

CCoord getStringWidthUTF8 ( const char *  pStr)

get the width of an UTF-8 encoded string

void* getSystemContext ( ) const
inline
void* getWindow ( )
inline
void lineTo ( const CPoint point)

draw a line from current position to point

void moveTo ( const CPoint point)

move line position to point

virtual CMessageResult notify ( CBaseObject sender,
const char *  message 
)
inlinevirtualinherited
void polyLine ( const CPoint pPoint,
long  numberOfPoints 
)
virtual void remember ( )
inlinevirtualinherited

increase refcount

void resetClipRect ( )

reset the clip to the default state

void setClipRect ( const CRect clip)

set the current clip

void setDrawMode ( CDrawMode  mode)

set the current draw mode, see CDrawMode

void setFillColor ( const CColor  color)

set current fill color

void setFont ( const CFontRef  font,
const long &  size = 0,
const long &  style = -1 
)

set current font

void setFontColor ( const CColor  color)

set current font color

void setFrameColor ( const CColor  color)

set current stroke color

void setLineStyle ( CLineStyle  style)

set the current line style

void setLineWidth ( CCoord  width)

set the current line width

void setWindow ( void *  ptr)
inline
bool waitDoubleClick ( )
Deprecated:
use kDoubleClick in the buttons parameter of the mouse methods instead
bool waitDrag ( )
Deprecated:
use the new mouse methods instead

Member Data Documentation

CRect clipRect
protected
CDrawMode drawMode
protected
CColor fillColor
protected
CFontRef font
protected
CColor fontColor
protected
CColor frameColor
protected
CCoord frameWidth
protected
CLineStyle lineStyle
protected
CPoint offset
CPoint offsetScreen
CPoint penLoc
protected
CFrame* pFrame
protected
void* pSystemContext
protected
void* pWindow
protected

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