Jump to content

SDLine: Difference between revisions

From EDM2
Ak120 (talk | contribs)
 
(4 intermediate revisions by 2 users not shown)
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.
 
;pOutput ([[PVOID]]) - input: Reserved.
::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.
</PRE>
 
; 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 122: Line 21:
#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]]

Latest revision as of 02:45, 26 March 2020

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.
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);