LINEPACK

From EDM2
Jump to: navigation, search

Line information data structure on a per-line basis.

typedef struct _LINEPACK {
  ULONG        ulStyleStep;     /* Value to be added to ulStyleValue. */
  ULONG        ulStyleValue;    /* Style value at the current pel. */
  ULONG        ulFlags;         /* Flags used for the LINEPACK data structure. */
  LINEPACK     plpkNext;        /* Pointer to next LINEPACK data structure. */
  ULONG        ulAbsDeltaX;     /* Clipped Bresenham Delta X, absolute. */
  ULONG        ulAbsDeltaY;     /* Clipped Bresenham Delta Y, absolute. */
  POINTL       ptlClipStart;    /* Pointer to location for device to perform Bresenham algorithm. */
  POINTL       ptlClipEnd;      /* Ending location for Bresenham algorithm (see ptlClipStart). */
  POINTL       ptlStart;        /* Pointer to starting location for line. */
  POINTL       ptlEnd;          /* Ending location for line. */
  LONG         lClipStartError; /* Standard Bresenham error at the clipped start point. */
} LINEPACK;

typedef LINEPACK *PLINEPACK;
ulStyleStep
The value to be added to ulStyleValue on each pel stepped along the line style's direction.
ulStyleValue
The style value at the current pel. It is composed of an error value and a mask position, as follows:
high word 3 bits 5 bits 8 bits
not used not used mask pos error value
ulFlags
Miscellaneous flags used for the LINEPACK data structure.
LINE_DO_FIRST_PEL Draws the first pel.
LINE_DIR_Y_POSITIVE Indicates line direction is bottom-to-top.
LINE_HORIZONTAL Indicates line is horizontal. No Bresenham algorithm.
LINE_X_MAJOR Line is XMAJOR.
LINE_DIR_X_POSITIVE Indicates line direction is right-to-left.
LINE_VERTICAL Indicates line is vertical. No Bresenham algorithm.
LINE_STYLE_X_MAJOR Line style is XMAJOR.
LINE_DO_LAST_PEL Draws the last pel.
ulAbsDeltaX
Clipped Bresenham Delta X, absolute (ptlStart.x - ptlEnd.x).
ulAbsDeltaY
Clipped Bresenham Delta Y, absolute (ptlStart.y - ptlEnd.y).
ptlClipStart
Pointer to location where device performs the Bresenham algorithm. Sets only the pels from ptlClipStart to ptlClipEnd, inclusive.
ptlClipEnd
Ending location for Bresenham algorithm (see previous parameter, ptlClipStart).
ptlStart
Pointer to starting location for line. The device can perform the Bresenham algorithm from ptlStart or ptlClipStart.
ptlEnd
Ending location for line.
lClipStartError
The standard Bresenham error at the clipped start point. This error is calculated from the initial error at the start point and the error increments for major step and diagonal step. The initial error and the error increments are as follows:
MAX :Maximum (ulAbsDeltaX, ulAbsDeltaY)
MIN :Minimum (ulAbsDeltaX, ulAbsDeltaY)
Major Increment : Increment to the error for stepping along the major axis: 2 * MIN.
Diagonal Increment : Increment to the error for stepping along the major and minor axes: 2 * MIN - 2 * MAX.
Initial Error : Error at the start point:
2 * MIN - MAX, if LINE_DIR_X_POSITIVE is On
2 * MIN - MAX - 1, if LINE_DIR_Y_POSITIVE is Off.
Horizontal and vertical lines. The line is drawn from the clipped start to clipped end. The lClipStartError will not be given.
First pel consideration. Set the first pel at the ptlStart (not ptlClipStart) only if LINE_DO_FIRST_PEL is set and the first pel is not clipped.
Last pel consideration. Set the last pel at the ptlEnd (not ptlClipEnd) only if LINE_DO_LAST_PEL is set and the last pel is not clipped.
Styling. Lines are styled using the ulStyleMask, ulStyleStep and ulStyleValue.
Error Value : Error value at the current pel.
Mask Position : Bit position of the ulStyleMask.
If this bit is on, set the current pel to the ulFGColor through usForeROP; otherwise, set the current pel to the ulBGColor through usBackROP.