Jump to content

GpiQueryPel

From EDM2

This function returns the color of a pel at a position specified in world coordinates.

Syntax

lColor = GpiQueryPel(hps, pptlPoint)

Parameters

hps (HPS)
Presentation-space handle.
pptlPoint (PPOINTL)
Position in world coordinates.


Returns

lColor (LONG) - returns
Color index of the pel.
This is a color index or RGB value, according to the logical color table in force (see GpiCreateLogColorTable).
>=0
Color of the pel
CLR_NOINDEX
No valid index (color is not in logical color table)
GPI_ALTERROR
Error.

Errors

Possible returns from WinGetLastError.

PMERR_INV_HPS (0x207F)
An invalid presentation-space handle was specified.
PMERR_PS_BUSY (0x20F4)
An attempt was made to access the presentation space from more than one thread simultaneously.
PMERR_INV_COORDINATE (0x205B)
An invalid coordinate value was specified.
PMERR_PEL_IS_CLIPPED (0x20EF)
An attempt was made to query a pel that had been clipped using GpiQueryPel.
PMERR_PEL_NOT_AVAILABLE (0x20F0)
An attempt was made to query a pel that did not exist in GpiQueryPel (for example, a memory device context with no selected bit map).
PMERR_NO_BITMAP_SELECTED (0x20E4)
An attempt has been made to operate on a memory device context that has no bit map selected.
PMERR_INV_DC_TYPE (0x2060)
An invalid type parameter was specified with DevOpenDC, or a function was issued that is invalid for a OD_METAFILE_NOQUERY device context.


Example Code

#define INCL_GPIBITMAPS /* Or use INCL_GPI, INCL_PM, */
#include <os2.h>

HPS        hps;        /*  Presentation-space handle. */
PPOINTL    pptlPoint;  /*  Position in world coordinates. */
LONG       lColor;     /*  Color index of the pel. */

lColor = GpiQueryPel(hps, pptlPoint);

In this example we query the color of a pel at a position specified in world coordinates.

 

#define INCL_GPIBITMAPS
#include <OS2.H>

LONG lcolorindex;       /* color index of pel. */
HPS hps;                /* Presentation space handle. */
POINTL     ptlPoint;   /* position in world coordinates. */
LONG xcoord, ycoord;
GpiQueryPel(hps, &ptlPoint);
xcoord = ptlPoint.x; ycoord = ptlPoint.y;