CDrawContext

#include <vstgui.h>

class CDrawContext;

A drawing context encapsulates the drawing context of the underlying OS. It implements the drawing functions.


CDrawContext

1.0

CDrawContext (CFrame *frame, void *systemContext, void *window = 0);

Create a drawing context.

frame The parent frame.
systemContext -
window The output of a drawing context is the given window.

Example :

void MyPlug::idle ()		{
static CDrawContext drawContext
(frame, NULL, systemWindow);

AEffGUIEditor::idle ();

myControl->update (drawContext);
}

~CDrawContext

1.0

virtual ~CDrawContext ();

Destroy a drawContext object.


moveTo

1.0

void moveTo (CPoint& point);

Move the current pen position to specified point.


lineTo

1.0

void lineTo (CPoint& point);

Draw a line from the current pen position to the specified point (this point (pixel) is not drawn).


polyLine

1.0

void polyLine (CPoint& *pPoint, long numberOfPoints);

Draw a polyline defined by a list of points. p is an array of points of size numberofPoints.


fillPolygon

1.0

void fillPolygon (CPoint& *pPoint, long numberOfPoints);

Draw a filled polygon without its boundary. p is an array of points. if the first and the last point are different, the polygon will be closed. The fill color is set by setFillColor.


drawRect

1.0

void drawRect (CRect& rect);

The given rect is framed using the current frame color.


fillRect

1.0

void fillRect (CRect& rect);

The given rect is filled with the current fill color (note that with MOTIF the fill and the frame color are the same), its boundary is not drawn.


drawArc

1.0

void drawArc (CRect& rect, CPoint&point1, CPoint& point2);

An arc included in the given rect with a begin angle defined by point1 and a end angle defined by point2 is framed (these 2 points ara defined as in Windows).


fillArc

1.0

void fillArc (CRect& rect, CPoint&point1, CPoint& point2);

Same as the previous function, but the arc is filled without its boundary.


drawEllipse

1.0

void drawEllipse (CRect& rect);

An ellipse is drawn in the given rect.


fillEllipse

1.0

void fillEllipse (CRect& rect);

An filled ellipse is drawn in the given rect without its boundary.


drawPoint

1.0

void drawPoint (CPoint& point, CColor &color);

A point is drawn at a given position with a specified color.


getPoint

2.2

CColor getPoint (CPoint& point);

Returns the color of the point.


floodFill

2.2

void floodFill (CPoint& start);

From the point start, fills the area in all directions til the color doesn't change.


setLineStyle

1.0

void setLineStyle (CLineStyle style);

Sets the style to draw a line. It affects the functions lineTo, drawArc, polyLine, etc. The default setting is kLineSolid.


CLineStyle

1.0

CLineStyle getLineStyle ();

Gets the current style to draw a line.


setLineWidth

1.0

void setLineWidth (int width);

Sets the width of the pen drawing a frame. It affects the functions lineTo, drawArc, polyLine, etc. The default setting is 1.


getLineWidth

1.0

int getLineWidth ();

Gets the current width of the pen drawing a frame.


setDrawMode

2.0

void setDrawMode (CDrawModemode);

Sets the current drawing mode.


getDrawMode

2.1

CDrawModegetDrawMode ();

Gets the current drawing mode.


setClipRect

2.0

void setClipRect (const CRect &clip);

Sets a given clipping rectangle to this context.


getClipRect

2.0

CRect&getClipRect (CRect&clip);

Gets the current clipping rectangle.


resetClipRect

2.1

void resetClipRect ();

Reset the clipping area to its frame size.


setFillColor

1.0

void setFillColor (CColor color);

Sets the fill color (Note that with MOTIF, this affect the frame color!).


getFillColor

1.0

CColor getFillColor ();

Gets the current fill color.


setFrameColor

1.0

void setFrameColor (CColor color);

Sets the frame color (Note that with MOTIF, this affect the fill color and the font color!).


getFrameColor

1.0

CColor getFrameColor ();

Gets the current frame color.


setFontColor

1.0

void setFontColor (CColor color);

Sets the font color (Note that with MOTIF, this affect the frame color!).


getFontColor

1.0

CColor getFontColor ();

Gets the current font color.


setFont

1.0

void setFont (CFont fontID, const long size = 0, long style = 0);

style A constant from CTxtFace.

Sets the current font.


getFont

2.1

CFontgetFont ();

Gets the current font.


getStringWidth

2.0

long getStringWidth (const char *pStr);

Returns the string width (pixels) of the given text in the current font.


drawString

1.0

void drawString (const char *string, CRect& rect,
const short opaque = false, const CHoriTxtAlignhAlign = kCenterText));

The string is drawn within the rectangle using a given alignment. The opaque function allows to draw or not a background.


getMouseButtons

1.0

long getMouseButtons ();

Returns the current mouse button used with Modifiers (see CButton).


getMouseLocation

1.0

void getMouseLocation (CPoint& point);

Returns the current position of the mouse.


WaitDoubleClick

2.0

bool waitDoubleClick ();

Returns true if a double-click occurs.


waitDrag

2.2

bool waitDrag ();

Actually dragging into the context.


getWindow

1.0

void *getWindow ();

Returns the window of the frame.


setWindow

1.0

void setWindow (void *ptr);

Sets the window of the frame.


getLoc

1.0

void getLoc (CPoint& where);

Returns the current position of the pen.

Example :

void ScoView::update (CDrawContext *context)	 {
long x, y;
CPoint p;
CColor  greenColor = {0, 255, 0, 0};
context->setFrameColor (greenColor);
context->moveTo (p(x, y));
...
// draw the line
context->lineTo (p(x, y));
}

getFrame

2.2

CFrame *getFrame ();

Returns the frame for the context.


getSystemContext

2.2

void *getSystemContext ();


Copyright ©2003 Steinberg Media Technologies GmbH. All Rights Reserved.