Jump to content

SDLine: Difference between revisions

From EDM2
Ak120 (talk | contribs)
mNo edit summary
Line 1: Line 1:
SDLine is a preclipped line rendering routine. It processes line operations onto a destination linear address. SDLine is the default when OS2_PM_DRV_ENABLE: QueryDeviceSurface does not hook the pfnLine function directly.  
SDLine is a preclipped line rendering routine. It processes line operations onto a destination linear address. SDLine is the default when OS2_PM_DRV_ENABLE: QueryDeviceSurface does not hook the pfnLine function directly.


== Syntax ==  
== Syntax ==  
  SDLine(pInput, pOutput);
  SDLine(pInput, pOutput)
 
== Parameters ==
== Parameters ==
; pInput ([[PLINEINFO]]) - input : Pointer to LINEINFO data structure.
;pInput ([[PLINEINFO]]) - input : Pointer to LINEINFO data structure.
 
::;ulLength : Length of the LINEINFO data structure.
::;ulLength : Length of the LINEINFO data structure.  
::;ulType : Defines line type.
 
:::LINE_SOLID : Line will be solid in Foreground color.
::; ulType : Defines line type.  
:::LINE_INVISIBLE : Line is not drawn.
:::LINE_SOLID : Line will be solid in Foreground color.  
:::LINE_ALTERNATE : Line will be alternating Foreground and Background color; ignores style.
:::LINE_INVISIBLE : Line is not drawn.  
::; ulStyleMask : A 32-bit style mask.
:::LINE_ALTERNATE : Line will be alternating Foreground and Background color; ignores style.  
::;cLines :Count of lines to be drawn.
 
::;ulFGColor :Line Foreground color.
::; ulStyleMask : A 32-bit style mask.  
::;ulBGColor :Line Background color.
 
::;usForeROP :Line Foreground mix.
::;cLines :Count of lines to be drawn.  
::;usBackROP :Line Background mix.
 
::;pDstBmapInfo :Destination surface (BMAPINFO).
::;ulFGColor :Line Foreground color.  
::;alpkLinePack :Array of line details information.
 
:::;ulStyleStep : The value to be added to ulStyleValue on each pel stepped along the line style's direction.
::;ulBGColor :Line Background color.  
:::;ulStyleValue: The style value at the current pel. It is composed of an error value and a mask position, as follows:
 
::;usForeROP :Line Foreground mix.  
 
::;usBackROP :Line Background mix.  
 
::;pDstBmapInfo :Destination surface (BMAPINFO).  
 
::;alpkLinePack :Array of line details information.  
 
:::;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        │
  │high word      │3 bits        │5 bits        │8 bits        │
Line 39: Line 26:
  │not used      │not used      │mask pos      │error value    │
  │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.


:::;ulFlags :Miscellaneous flags used for the LINEPACK data structure.
:::;ulAbsDeltaX :Clipped Bresenham Delta X, absolute (ptlStart.x - ptlEnd.x).
::::LINE_DO_FIRST_PEL Draws the first pel.
:::;ulAbsDeltaY :Clipped Bresenham Delta Y, absolute (ptlStart.y - ptlEnd.y).
::::LINE_DIR_Y_POSITIVE Indicates line direction is bottom-to-top.
:::;ptlClipStart :Pointer to location where device performs the Bresenham algorithm. Sets only the pels from ptlClipStart to ptlClipEnd, inclusive.
::::LINE_HORIZONTAL Indicates line is horizontal. No Bresenham algorithm.
:::;ptlClipEnd :Ending location for Bresenham algorithm (see previous parameter, ptlClipStart).
::::LINE_X_MAJOR  Line is XMAJOR.
:::;ptlStart  :Pointer to starting location for line. The device can perform the Bresenham algorithm from ptlStart or ptlClipStart.
::::LINE_DIR_X_POSITIVE  Indicates line direction is right-to-left.
:::;ptlEnd  : Ending location for line.
::::LINE_VERTICAL  Indicates line is vertical. No Bresenham algorithm.
:::;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:
::::LINE_STYLE_X_MAJOR  Line style is XMAJOR.
::::;MAX :Maximum (ulAbsDeltaX, ulAbsDeltaY)
::::LINE_DO_LAST_PEL  Draws the last pel.
::::;MIN :Minimum (ulAbsDeltaX, ulAbsDeltaY)
 
::::;Major Increment : Increment to the error for stepping along the major axis:
:::;ulAbsDeltaX :Clipped Bresenham Delta X, absolute (ptlStart.x - ptlEnd.x).  
  2 * MIN.
 
:::;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:  
::::; Diagonal Increment : Increment to the error for stepping along the major and minor axes:  
  2 * MIN - 2 * MAX.  
  2 * MIN - 2 * MAX.
::::; Initial Error : Error at the start point:  
::::; Initial Error : Error at the start point:
  2 * MIN - MAX, if LINE_DIR_X_POSITIVE is On  
  2 * MIN - MAX, if LINE_DIR_X_POSITIVE is On
  2 * MIN - MAX - 1, if LINE_DIR_Y_POSITIVE is Off.  
  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.  
:::::'''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.  
:::::'''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.  
:::::'''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.  
:::::'''Styling.''' Lines are styled using the ulStyleMask, ulStyleStep and ulStyleValue.
 
::::::;Error Value : Error value at the current pel.
::::::;Error Value : Error value at the current pel.  
::::::; Mask Position : Bit position of the ulStyleMask.
::::::; 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.
 
:::;prclBounds : Bounding rect of the clipped line.
::::::If this bit is on, set the current pel to the ulFGColor through usForeROP; otherwise, set the current pel to the ulBGColor through usBackROP.  
 
:::;prclBounds : Bounding rect of the clipped line.  
 
; pOutput ([[PVOID]]) - input : Reserved.
; pOutput ([[PVOID]]) - input : Reserved.


== Returns ==
== Returns ==
; rc (ULONG) - returns : Return codes.  
; rc (ULONG) - returns : Return codes.
Valid values are:  
Valid values are:
  RC_SUCCESS  
  RC_SUCCESS
  RC_ERROR  
  RC_ERROR


== Remarks ==
== Remarks ==
'''Simulation support:''' This function is simulated by a handling routine in Revision 2.X of the graphics engine.  
'''Simulation support:''' This function is simulated by a handling routine in Revision 2.X of the graphics engine.


== Example Code ==
== Example Code ==
Line 104: Line 77:
#include <os2.h>
#include <os2.h>


PLINEINFO    pInput;  /* Pointer to LINEINFO data structure. */
PLINEINFO    pInput;  /* Pointer to LINEINFO data structure. */
PVOID        pOutput;  /* Reserved. */
PVOID        pOutput;  /* Reserved. */
ULONG        rc;      /* Return codes. */
ULONG        rc;      /* Return codes. */


rc = SDLine(pInput, pOutput);
rc = SDLine(pInput, pOutput);
</PRE>
</PRE>
== Related Functions ==
* [[]]


[[Category:PDD]]
[[Category:PDD]]

Revision as of 09:06, 5 February 2018

SDLine is a preclipped line rendering routine. It processes line operations onto a destination linear address. SDLine is the default when OS2_PM_DRV_ENABLE: QueryDeviceSurface does not hook the pfnLine function directly.

Syntax

SDLine(pInput, pOutput)

Parameters

pInput (PLINEINFO) - input
Pointer to LINEINFO data structure.
ulLength
Length of the LINEINFO data structure.
ulType
Defines line type.
LINE_SOLID : Line will be solid in Foreground color.
LINE_INVISIBLE : Line is not drawn.
LINE_ALTERNATE : Line will be alternating Foreground and Background color; ignores style.
ulStyleMask
A 32-bit style mask.
cLines
Count of lines to be drawn.
ulFGColor
Line Foreground color.
ulBGColor
Line Background color.
usForeROP
Line Foreground mix.
usBackROP
Line Background mix.
pDstBmapInfo
Destination surface (BMAPINFO).
alpkLinePack
Array of line details information.
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.
prclBounds
Bounding rect of the clipped line.
pOutput (PVOID) - input
Reserved.

Returns

rc (ULONG) - returns
Return codes.

Valid values are:

RC_SUCCESS
RC_ERROR

Remarks

Simulation support: This function is simulated by a handling routine in Revision 2.X of the graphics engine.

Example Code

#include <os2.h>

PLINEINFO    pInput;   /* Pointer to LINEINFO data structure. */
PVOID        pOutput;  /* Reserved. */
ULONG        rc;       /* Return codes. */

rc = SDLine(pInput, pOutput);