Jump to content

GreEndArea

From EDM2
Revision as of 19:26, 19 May 2025 by Martini (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

GreEndArea indicates the end of a set of drawing functions that define the boundary of an area. If the final (X,Y) position is not the same as the starting position of the last figure in the area, the handling routine must close the figure by drawing a line from the current position to the start of the final figure. Upon completion, the current (X,Y) position is the last (X,Y) position specified in the area boundary unless a closure line was drawn. In this case, the start of the last figure in the area definition becomes the current (X,Y) position.

The area fill can be built up in memory or on devices that have hardware assistance for area fill in the device. For convex figures, performance gain can be increased by recording the start and end pel positions across each scan line. Whatever algorithm is used to fill the area, the interior fill must be identical in each occurrence. If it is not identical, bit-map operations can fail to join correctly when copied to the screen.

This function can be hooked by the presentation driver.

Simulation support
This function is simulated by a handling routine in the graphics engine.
Note
If the flOptions bit BA_EXCL (specified on the GreBeginArea call) was set on and the driver is calling the engine with fill path for simulation, the fill path flOptions parameter must have the FPATH_EXCL bit set.

Syntax

GreEndArea(hdc, flCancel, pInstance, lFunction)

Parameters

hdc (HDC) - input
Device context handle.
flCancel (ULONG) - input
The value of this flag specifies whether this call cancels the area definition:
  • EA_DRAW Draw the area. This flag is the default.
  • EA_CANCEL Cancel the area definition. Otherwise, draw the area.
Note
When GreBeginArea is not called and EA_CANCEL is set, GreEndArea is valid but has no effect, thus allowing the handling routine to reset an area bracket to a known state when it has no knowledge of the actual current state.
pInstance (PVOID) - input
Pointer to instance data.
lFunction (ULONG) - input
High-order WORD=flags; low-order WORD=NGreEndArea.

Return Code

rc (LONG) - returns
Return codes.
This function returns 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) on any part of the interior, regardless of mix
  • 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_BASE_ERROR
  • PMERR_BITMAP_NOT_SELECTED
  • PMERR_COORDINATE_OVERFLOW
  • PMERR_DEV_FUNC_NOT_INSTALLED
  • PMERR_EXCEEDS_MAX_SEG_LENGTH
  • PMERR_HDC_BUSY
  • PMERR_HRGN_BUSY
  • PMERR_HUGE_FONTS_NOT_SUPPORTED
  • PMERR_INSUFFICIENT_MEMORY
  • PMERR_INV_AREA_CONTROL
  • PMERR_INV_BACKGROUND_COL_ATTR
  • PMERR_INV_BACKGROUND_MIX_ATTR
  • PMERR_INV_CHAR_DIRECTION_ATTR
  • PMERR_INV_CHAR_MODE_ATTR
  • PMERR_INV_CODEPAGE
  • PMERR_INV_COLOR_ATTR
  • PMERR_INV_COLOR_DATA
  • PMERR_INV_COLOR_INDEX
  • PMERR_INV_COORD_SPACE
  • PMERR_INV_COORDINATE
  • PMERR_INV_HDC
  • PMERR_INV_HRGN
  • PMERR_INV_IN_AREA
  • PMERR_INV_IN_PATH
  • PMERR_INV_LENGTH_OR_COUNT
  • PMERR_INV_LINE_TYPE_ATTR
  • PMERR_INV_MIX_ATTR
  • PMERR_INV_PATTERN_REF_PT_ATTR
  • PMERR_INV_PATTERN_SET_ATTR
  • PMERR_INV_PATTERN_SET_FONT
  • PMERR_INV_PICK_APERTURE_POSN
  • PMERR_INV_RECT
  • PMERR_INV_REGION_CONTROL
  • PMERR_NOT_IN_AREA
  • PMERR_PATH_LIMIT_EXCEEDED
  • PMERR_REGION_IS_CLIP_REGION.

Refer to the "Error Explanations" section in the Presentation Manager Programming Reference for further explanation.

Example Code

#define INCL_GRE_PATHS
#include <os2.h>

HDC      hdc;        /*  Device context handle. */
ULONG    flCancel;
PVOID    pInstance;  /*  Pointer to instance data. */
ULONG    lFunction;  /*  High-order WORD=flags; low-order WORD=NGreEndArea. */
LONG     rc;         /*  Return codes. */

rc = GreEndArea(hdc, flCancel, pInstance, lFunction);