void LineDDA(nXStart, nYStart, nXEnd, nYEnd, lnddaprc, lParam) | |||||
int nXStart; | /* x-coordinate of line beginning | */ | |||
int nYStart; | /* y-coordinate of line beginning | */ | |||
int nXEnd; | /* x-coordinate of line end | */ | |||
int nYEnd; | /* y-coordinate of line end | */ | |||
LINEDDAPROC lnddaprc; | /* address of callback function | */ | |||
LPARAM lParam; | /* address of application-defined data | */ |
The LineDDA function computes all successive points in a line specified by starting and ending coordinates. For each point on the line, the system calls an application-defined callback function, specifying the coordinates of that point.
nXStart
Specifies the logical x-coordinate of the first point.
nYStart
Specifies the logical y-coordinate of the first point.
nXEnd
Specifies the logical x-coordinate of the endpoint. This endpoint is not part of the line.
nYEnd
Specifies the logical y-coordinate of the endpoint. This endpoint is not part of the line.
lnddaprc
Specifies the procedure-instance address of the application-defined callback function. The address must have been created by using the MakeProcInstance function. For more information about the callback function, see the description of the LineDDAProc callback function.
lParam
Points to 32 bits of application-defined data that is passed to the callback function.
This function does not return a value.
The following example uses the LineDDA function to draw a dot every two spaces between the beginning and ending points of a line:
/* Callback function */
void CALLBACK DrawDots(int xPos, int yPos, LPSTR lphdc)
{
static short cSpaces = 1;
if (cSpaces == 3) {
/* Draw a black dot. */
SetPixel(*(HDC FAR*) lphdc, xPos, yPos, 0);
/* Initialize the space count. */
cSpaces = 1;
}
else
cSpaces++;
}