Jump to content

GreDrawRLE: Difference between revisions

From EDM2
Created page with "GreDrawRLE draws a run-length-encoded shape. If the call is passed back to the graphics engine, it calls the GrePolyScanline entry point. This function can be hooked by the ..."
 
Ak120 (talk | contribs)
mNo edit summary
Line 1: Line 1:
GreDrawRLE draws a run-length-encoded shape. If the call is passed back to the graphics engine, it calls the GrePolyScanline entry point.  
GreDrawRLE draws a run-length-encoded shape. If the call is passed back to the graphics engine, it calls the [[GrePolyScanline]] entry point.


This function can be hooked by the presentation driver.  
This function can be hooked by the presentation driver.


;Simulation support: This function is simulated by a handling routine in the graphics engine.  
;Simulation support: This function is simulated by a handling routine in the graphics engine.


==Syntax==
==Syntax==
  GreDrawRLE(hdc, pRLEHDR, pInstance, lFunction);
  GreDrawRLE(hdc, pRLEHDR, pInstance, lFunction)


==Parameters==
==Parameters==
;hdc (HDC) - input  
;hdc (HDC) - input:Device context handle.
:Device context handle.  
;pRLEHDR (PRLEHDR) - input:Pointer to run-length-encoding data header ([[RLEHDR]]) structure.
 
;pInstance (PVOID) - input:Pointer to instance data.
;pRLEHDR (PRLEHDR) - input  
;lFunction (ULONG) - input:High-order WORD=flags; low-order WORD=NGreDrawRLE.
:Pointer to run-length-encoding data header.
 
:Pointer an RLEHDR structure:
 
typedef struct {
                  LONG      lType;
                  BRECTL    brectlBounds;
                  PVOID      pRLE;
                } RLEHDR;
 
 
:GreDrawRLE always supports lType=0. In this format, the pRLE field in the RLE header points to an array of POINTL structures (see below). The brectlBounds rectangle contains the tightest rectangle that fits around the shape.
 
:The RLE array starts with an (X,Y) pair, where Y is the Y-coordinate, and X is the number of runs on the line. The number of (X,Y) pairs follow, where X is the left side of the run and Y is the right side, exclusive. The next (X,Y) pair holds the header of the next line. The Y-coordinate must increase. If the number of points is 0, the end of the data has been reached. For example, the following array of eight POINTL structures defines two scan lines of run-length-encoded data:
 
(3,45), (20,25), (42,56), (100,350),  (Three pairs of runs at Scan Line 45)
(2,46), (19,26), (43,56),            (Two pairs of runs at Scan Line 46)
(0,47)                                (End of RLE data indicator)
 
:The presentation driver draws lines between the following device-coordinate-space pairs, inclusive, given the data in the above example:
 
(20 ,45) to (24 ,45)
(42 ,45) to (55 ,45)
(100,45) to (349,45)
(19 ,46) to (25 ,46)
(43 ,46) to (55 ,46)
 
:Notice that pels are drawn up to, but not including, the right coordinate of the run. That is, runs are filled inclusive or exclusive.  
 
;pInstance (PVOID) - input  
:Pointer to instance data.  
 
;lFunction (ULONG) - input  
:High-order WORD=flags; low-order WORD=NGreDrawRLE.  


==Return Code==
==Return Code==
;rc (ULONG) - returns  
;rc (ULONG) - returns:Return codes.
:Return codes.  
:On completion, the handling routine must return an integer (cHits) indicating, where appropriate, whether correlation hits were detected:
:*GPI_OK Successful
:*GPI_HITS Successful with correlation hit (returned by display drivers when the correlation flag is ON, and a hit is detected)
:*GPI_ERROR Error
:Possible Errors Detected: When an error is detected, the handling routine must call WinSetErrorInfo to post the condition. Error codes for conditions that the handling routine is expected to check include:
:*PMERR_BITMAP_NOT_SELECTED
:*PMERR_COORDINATE_OVERFLOW
:*PMERR_DEV_FUNC_NOT_INSTALLED
:*PMERR_HDC_BUSY
:*PMERR_INV_COLOR_DATA
:*PMERR_INV_COLOR_INDEX
:*PMERR_INV_COORD_SPACE
:*PMERR_INV_HDC
:*PMERR_INV_IN_AREA
:*PMERR_INV_IN_PATH
:*PMERR_INV_LENGTH_OR_COUNT
:*PMERR_INV_PICK_APERTURE_POSN
:Refer to the "Error Explanations" section in the ''Presentation Manager Programming Reference'' for further explanation.


:On completion, the handling routine must return an integer (cHits) indicating, where appropriate, whether correlation hits were detected:
==Remarks==
GreDrawRLE is called by the area fill code in the graphics engine. The calling function uses the driver's CAPS_ADDITIONAL_GRAPHICS/CAPS_CLIP_FILLS field, which is queried during the first instance of DevOpenDC. If it is set, the data delivered to GreDrawRLE has already been clipped and the COM_PRECLIP flag will be set in the flag's WORD of the function number. All coordinates are passed as screen coordinates.


:*GPI_OK Successful
:*GPI_HITS Successful with correlation hit (returned by display drivers when the correlation flag is ON, and a hit is detected)
:*GPI_ERROR Error
:Possible Errors Detected:  When an error is detected, the handling routine must call WinSetErrorInfo to post the condition. Error codes for conditions that the handling routine is expected to check include:
:*PMERR_BITMAP_NOT_SELECTED
:*PMERR_COORDINATE_OVERFLOW
:*PMERR_DEV_FUNC_NOT_INSTALLED
:*PMERR_HDC_BUSY
:*PMERR_INV_COLOR_DATA
:*PMERR_INV_COLOR_INDEX
:*PMERR_INV_COORD_SPACE
:*PMERR_INV_HDC
:*PMERR_INV_IN_AREA
:*PMERR_INV_IN_PATH
:*PMERR_INV_LENGTH_OR_COUNT
:*PMERR_INV_PICK_APERTURE_POSN
:Refer to the "Error Explanations" section in the Presentation Manager Programming Reference for further explanation.
==Remarks==
GreDrawRLE is called by the area fill code in the graphics engine. The calling function uses the driver's CAPS_ADDITIONAL_GRAPHICS/CAPS_CLIP_FILLS field, which is queried during the first instance of DevOpenDC. If it is set, the data delivered to GreDrawRLE has already been clipped and the COM_PRECLIP flag will be set in the flag's WORD of the function number. All coordinates are passed as screen coordinates.
==Sample Code==
==Sample Code==
<PRE>
<PRE>

Revision as of 17:49, 7 February 2020

GreDrawRLE draws a run-length-encoded shape. If the call is passed back to the graphics engine, it calls the GrePolyScanline entry point.

This function can be hooked by the presentation driver.

Simulation support
This function is simulated by a handling routine in the graphics engine.

Syntax

GreDrawRLE(hdc, pRLEHDR, pInstance, lFunction)

Parameters

hdc (HDC) - input
Device context handle.
pRLEHDR (PRLEHDR) - input
Pointer to run-length-encoding data header (RLEHDR) structure.
pInstance (PVOID) - input
Pointer to instance data.
lFunction (ULONG) - input
High-order WORD=flags; low-order WORD=NGreDrawRLE.

Return Code

rc (ULONG) - returns
Return codes.
On completion, the handling routine must return an integer (cHits) indicating, where appropriate, whether correlation hits were detected:
  • GPI_OK Successful
  • GPI_HITS Successful with correlation hit (returned by display drivers when the correlation flag is ON, and a hit is detected)
  • GPI_ERROR Error
Possible Errors Detected: When an error is detected, the handling routine must call WinSetErrorInfo to post the condition. Error codes for conditions that the handling routine is expected to check include:
  • PMERR_BITMAP_NOT_SELECTED
  • PMERR_COORDINATE_OVERFLOW
  • PMERR_DEV_FUNC_NOT_INSTALLED
  • PMERR_HDC_BUSY
  • PMERR_INV_COLOR_DATA
  • PMERR_INV_COLOR_INDEX
  • PMERR_INV_COORD_SPACE
  • PMERR_INV_HDC
  • PMERR_INV_IN_AREA
  • PMERR_INV_IN_PATH
  • PMERR_INV_LENGTH_OR_COUNT
  • PMERR_INV_PICK_APERTURE_POSN
Refer to the "Error Explanations" section in the Presentation Manager Programming Reference for further explanation.

Remarks

GreDrawRLE is called by the area fill code in the graphics engine. The calling function uses the driver's CAPS_ADDITIONAL_GRAPHICS/CAPS_CLIP_FILLS field, which is queried during the first instance of DevOpenDC. If it is set, the data delivered to GreDrawRLE has already been clipped and the COM_PRECLIP flag will be set in the flag's WORD of the function number. All coordinates are passed as screen coordinates.

Sample Code

#define INCL_GRE_LINE
#include <os2.h>

HDC        hdc;        /*  Device context handle. */
PRLEHDR    pRLEHDR;    /*  Pointer to run-length-encoding data header. */
PVOID      pInstance;  /*  Pointer to instance data. */
ULONG      lFunction;  /*  High-order WORD=flags; low-order WORD=NGreDrawRLE. */
ULONG      rc;         /*  Return codes. */

rc = GreDrawRLE(hdc, pRLEHDR, pInstance, lFunction);