DrawClippedBresenhamStippleLine

Draws a stippled, single pixel wide line with bresenham parameters.

Declaration

N_int32 NAPI GA_2DRenderFuncs::DrawClippedBresenhamStippleLine(
N_int32 x1,
N_int32 y1,
N_int32 initialError,
N_int32 majorInc,
N_int32 diagInc,
N_int32 count,
N_int32 flags,
N_int32 transparent,
N_int32 clipLeft,
N_int32 clipTop,
N_int32 clipRight,
N_int32 clipBottom)

Prototype In

snap/graphics.h

Parameters

x1 | X1 coordinate
y1 | Y1 coordinate
initialError | Initial error term
majorInc | Major increment factor for error term
diagInc | Diagonal increment factor for error term
count | Number of pixels to draw
flags | Flags to control drawing (GA_BresenhamLineFlagsType)
transparent | True for a transparent background
clipLeft | Left coordinate for clip rectangle (inclusive)
clipTop | Top coordinate for clip rectangle (inclusive)
clipRight | Right coordinate for clip rectangle (exclusive)
clipBottom | Bottom coordinate for clip rectangle (exclusive)

Description

This function is similar to the regular DrawStippleLineInt function, except that the bresenham parameters for the line are pre-computed and passed to this function. Allowing the application to pre-compute the bresenham parameters allows for accurate clipping as the bresenham parameters can be computed for the unclipped line, and initialised to the start of the clipped line segement. This function is used by OS/2 display drivers to get accurate line clipping. The values passed to the function for a regular integer line can be computed as follows:

flags = gaLineXPositive | gaLineYPositive | gaLineXMajor
| gaLineDoLastPel;
if ((absDeltaX = x2 - x1) < 0) {
absDeltaX = -absDeltaX;
flags &= ~gaLineXPositive;
}
if ((absDeltaY = y2 - y1) < 0) {
absDeltaY = -absDeltaY;
flags &= ~gaLineYPositive;
}
if (absDeltaY > absDeltaX) {
SWAP(absDeltaX,absDeltaY);
flags &= ~gaLineXMajor;
}
majorInc = 2 * absDeltaY; // 2 * dy
initialError = majorInc - absDeltaX; // 2 * dy - dx
diagInc = initialError - absDeltaX; // 2 * (dy - dx)

The output is clipped against the passed in clipping rectangle.

See Also

GA_2DRenderFuncs_DrawClippedStippleLineInt, DrawClippedLineInt, SetLineStipple, SetLineStippleCount

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