Jump to content

GreDrawBorder

From EDM2
Revision as of 17:07, 30 November 2019 by Martini (talk | contribs) (Created page with "GreDrawBorder draws an internal border in a rectangular frame. The interior can also be filled. This function must be hooked by all presentation drivers. Drivers for hardcop...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

GreDrawBorder draws an internal border in a rectangular frame. The interior can also be filled.

This function must be hooked by all presentation drivers. Drivers for hardcopy devices do nothing except return TRUE (Successful). Display drivers must return Failure if fast-frame drawing is not supported. GreDrawBorder is not called by any specific function; it is used to do fast frame drawing.

Simulation support
None. This function is mandatory for all drivers.

Syntax

GreDrawBorder(hdc, prclFrame, cxBorder, cyBorder, clrBorder, clrInterior, flCmd, pInstance, lFunction);

Parameters

hdc (HDC) - input
Device context handle.
prclFrame (PRECTL) - input
Pointer to a RECTL structure.

_ Pointer that defines the frame in screen coordinates. Coordinates are passed in screen coordinates, which are inclusive at the bottom-left corner and exclusive at the top-right corner.

cxBorder (ULONG) - input
Thickness of vertical border in device coordinates.
cyBorder (ULONG) - input
Thickness of horizontal border in device coordinates.
clrBorder (LONG) - input
Color of border in any valid format.
clrInterior (LONG) - input
Color of interior in any valid format.
flCmd (ULONG) - input
Options flag.
Valid values are:
  • DB_ROP
An option flag that defines the mix to be used for the border and the interior. The mixes are mutually exclusive with one another but can be combined independently with DB_INTERIOR or DB_AREAATTRS. This option can have any of the following values:
  • DB_PATCOPY
(Default) Use ROP_PATCOPY (see GreBitblt). This is a copy of the pattern to the destination.
  • DB_PATINVERT
Exclusive-OR the current pattern and the destination (ROP_PATINVERT). Current mix and color parameters are ignored.
  • DB_DESTINVERT
Inverts the destination (ROP_DESTINVERT).
  • DB_AREAMIXMODE
Maps the current area foreground-mix attribute to a BitBlt raster operation. The area background-mix mode is ignored.
  • DB_INTERIOR
Fills the area defined by prclFrame, excluding the border defined by cxBorder and cyBorder.
  • DB_AREAATTRS
When set, the pattern used for the border is the one currently defined in the area attribute. The pattern used for the interior is the one that would be obtained by calling GreSetAttributes with the area attribute background color passed for the foreground color, and the area attribute foreground color passed for the background. See GreSetAttributes.
When this flag is not set (default), the border pattern is equivalent to using GreSetAttributes for the area attributes, which use clrBorder as foreground color and clrInterior as the background.
The Interior pattern is equivalent to using GreSetAttributes for the area attributes, which use clrInterior color as foreground color and clrBorder as the background.

The handling routine should ignore the remaining flags, DB_STANDARD and DB_DLGBORDER, which are used by the Frame Manager.

pInstance (PVOID) - input
Pointer to instance data.
lFunction (ULONG) - input
High-order WORD=flags; low-order WORD=NGreDrawBorder.

Returns

rc (BOOL) - returns
Return Codes.

On completion, the handling routine must return a BOOLEAN value to indicate success or an error.

  • TRUE Successful
  • FALSE 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_IS_SELECTED
  • PMERR_BITMAP_NOT_SELECTED
  • PMERR_COORDINATE_OVERFLOW
  • PMERR_DEV_FUNC_NOT_INSTALLED
  • PMERR_EXCEEDS_MAX_SEG_LENGTH
  • PMERR_HBITMAP_BUSY
  • PMERR_HDC_BUSY
  • PMERR_HUGE_FONTS_NOT_SUPPORTED
  • PMERR_INCOMPATIBLE_BITMAP
  • PMERR_INCORRECT_DC_TYPE
  • PMERR_INSUFFICIENT_MEMORY
  • PMERR_INV_BACKGROUND_COL_ATTR
  • PMERR_INV_BITBLT_MIX
  • PMERR_INV_BITBLT_STYLE
  • PMERR_INV_BITMAP_DIMENSION
  • PMERR_INV_COLOR_ATTR
  • PMERR_INV_COLOR_DATA
  • PMERR_INV_COLOR_FORMAT
  • PMERR_INV_COLOR_INDEX
  • PMERR_INV_COLOR_OPTIONS
  • PMERR_INV_COLOR_START_INDEX
  • PMERR_INV_COORD_SPACE
  • PMERR_INV_COORDINATE
  • PMERR_INV_DC_DATA
  • PMERR_INV_DC_TYPE
  • PMERR_INV_DRAW_BORDER_OPTION
  • PMERR_INV_DRIVER_NAME
  • PMERR_INV_HBITMAP
  • PMERR_INV_HDC
  • PMERR_INV_ID
  • PMERR_INV_IN_AREA
  • PMERR_INV_IN_PATH
  • PMERR_INV_INFO_TABLE
  • PMERR_INV_LENGTH_OR_COUNT
  • PMERR_INV_PATTERN_SET_ATTR
  • PMERR_INV_PATTERN_SET_FONT
  • PMERR_INV_PICK_APERTURE_POSN
  • PMERR_INV_SCAN_START
  • PMERR_INV_USAGE_PARM
  • PMERR_UNSUPPORTED_ATTR_VALUE

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


Sample

#define INCL_GRE_BITMAPS
#include <os2.h>

HDC       hdc;          /*  Device context handle. */
PRECTL    prclFrame;
ULONG     cxBorder;     /*  Thickness of vertical border in device coordinates. */
ULONG     cyBorder;     /*  Thickness of horizontal border in device coordinates. */
LONG      clrBorder;    /*  Color of border in any valid format. */
LONG      clrInterior;  /*  Color of interior in any valid format. */
ULONG     flCmd;        /*  Options flag. */
PVOID     pInstance;    /*  Pointer to instance data. */
ULONG     lFunction;
BOOL      rc;           /*  Return Codes. */

rc = GreDrawBorder(hdc, prclFrame, cxBorder,
       cyBorder, clrBorder, clrInterior, flCmd,
       pInstance, lFunction);

Remarks

Related Functions