| Home
| Previous
| Next
| Up

MGL_setLineStyle

Sets the current line style.

Declaration

void MGLAPI MGL_setLineStyle(
int style)

Prototype In

mgraph.h

Parameters

style | New line style to use

Description

Sets the current line style. MGL supports two different line styles, either pen style patterned lines (MGL_LINE_PENSTYLE) or stippled lines (MGL_LINE_STIPPLE). Pen style patterned lines are similar to those provided by QuickDraw for the Macintosh where lines are drawing using a rectangular pen that can have an arbitrary size and can be filled with an arbitrary pattern. Pen style patterned lines are the default. Stippled lines are similar to those used by CAD programs on the PC, and are 1-pixel wide lines that can be drawn using a 16-bit stipple mask. Stippled lines can be drawn very fast in hardware using the VBE/AF accelerator drivers.

In stippled line mode the line stipple pattern is used to determine which pixels in the line get drawn depending on which bits in the pattern are set. The stipple pattern is a 16-bit value, and everywhere that a bit is set to a 1 in the pattern, a pixel will be drawn in the line. Everywhere that a bit is a 0, the pixel will be skipped in the line. Note that bit 0 in the stipple pattern corresponds to pixel 0,16,32,... in the line, bit 1 is pixel 1,17,33 etc. To create a line that is drawn as a 'dot dot dash dash' you would use the following value:

0011100111001001b or 0x39C9

In stippled line mode the line stipple counter is used to count the number of pixels that have been drawn in the line, and is updated after the line has been drawn. The purpose of this counter is to allow you to draw connected lines using a stipple pattern and the stippling will be continuous across the break in the lines. You can use this function to reset the stipple counter to a known value before drawing lines to force the stipple pattern to start at a specific bit position (usually resetting it to 0 before drawing a group of lines is sufficient).

Note that VBE/AF 1.0 accelerated devices do not support the line stipple counter, so this counter is essentially reset to 0 every time that a line is drawn using the hardware. VBE/AF 2.0 will rectify this problem in the future.

See Also

MGL_setLineStipple, MGL_setLineStippleCount, MGL_getLineStyle

Copyright © 2002 SciTech Software, Inc. Visit our web site at http://www.scitechsoft.com