The V C++ GUI Framework:vPen

From EDM2
Jump to: navigation, search

A class to specify the pen used to draw lines and shapes.

Synopsis

Header:
<v/vpen.h>
Class name:
vPen

Description

Pens are used to draw lines and the outlines of shapes. Pens have several attributes, including color, width, and style.

Methods

vPen(unsigned int r = 0, unsigned int g = 0, unsigned int b = 0, int width = 1, int style = vSolid)

The constructor for a pen allows you to specify the pen's color, width, and style. The default will construct a solid black pen of width 1.

int operator ==, !=

You can use the operators == and != for comparisons.

vColor GetColor()

This method returns the current color of the pen as a vColor object.

int GetStyle()

This method returns the current style of the pen.

void GetWidth()

This gets the width of the line the pen will draw.

void SetColor(vColor& c)

You can use this method to set the pen color by passing in a vColor object.

void SetStyle(int style)

This method is used to change the style of a pen. Styles include:

vSolid
The pen draws a solid line.
vTransparent
The pen is transparent. A transparent pen can be used to avoid drawing borders around shapes. When drawing text, a transparent pen draws the text over the existing background.
vDash
The pen draws a dashed line.
vDot
The pen draws a dotted line.
vDashDot
The pen draws an alternating dash and dotted line.

void SetWidth(int width)

This sets the width of the line the pen will draw.