GreSelectBitmap

From EDM2
Revision as of 03:25, 16 January 2020 by Martini (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

GreSelectBitmap selects a bit map into a memory DC or (if called with a NULL bit-map handle) deselects the existing bit map from the DC.

This function is supported by the graphics engine.

Syntax

GreSelectBitmap(hdc, hbm, pInstance, lFunction);

Parameters

hdc (HDC) - input
Device context handle.
hbm (HBITMAP) - input
Bit-map handle.
pInstance (PVOID) - input
Pointer to instance data.
lFunction (ULONG) - input
High-order WORD=flags; low-order WORD=NGreSelectBitmap.

Returns

rc (HBITMAP) - returns
On completion, this function returns an HBITMAP value:
  • HBM_ERROR Error
  • Null Successful
  • Other Handle of deselected bit map
An error is raised when the bit map:
  • Is incompatible with the DC and cannot be converted
  • Is already selected into a DC
  • Has been assigned a Set ID for use as a pattern in an area fill operation
Possible Errors Detected: Error codes posted by the graphics engine for this function include:
  • PMERR_BITMAP_IS_SELECTED
  • PMERR_DEV_FUNC_NOT_INSTALLED
  • PMERR_HBITMAP_BUSY
  • PMERR_HDC_BUSY
  • PMERR_INSUFFICIENT_MEMORY
  • PMERR_INV_BITMAP_DIMENSION
  • PMERR_INV_COORDINATE
  • PMERR_INV_HBITMAP
  • PMERR_INV_HDC
  • PMERR_INV_HRGN
  • PMERR_INV_IN_AREA
  • PMERR_INV_IN_PATH
  • PMERR_INV_INFO_TABLE
  • PMERR_INV_LENGTH_OR_COUNT
  • PMERR_INV_RECT
  • PMERR_INV_REGION_CONTROL
  • PMERR_INV_SCAN_START
Refer to the "Error Explanations" section of the Presentation Manager Programming Reference for further explanation.


Sample

#define INCL_GRE_DEVSUPPORT
#include <os2.h>

HDC        hdc;        /*  Device context handle. */
HBITMAP    hbm;        /*  Bit-map handle. */
PVOID      pInstance;  /*  Pointer to instance data. */
ULONG      lFunction;  /*  High-order WORD=flags; low-order WORD=NGreSelectBitmap. */
HBITMAP    rc;         /*  On completion, this function returns an HBITMAP value: */

rc = GreSelectBitmap(hdc, hbm, pInstance,
       lFunction);

Remarks

If GreSelectBitmap is called to deselect a bit map, the return code is the handle of the deselected bit map.

When created, a bit map has to be selected into a DC before the presentation driver can write to it. A bit map can be selected into the DC that created it or into any DC that has a compatible bit-map format. Compatibility can be ensured by using one of the standard formats. Note that the presentation driver must select a bit map into a device context before attempting to draw it.