GpiEnableYInversion()

Definition:

BOOL APIENTRY GpiEnableYInversion(HPS hps, LONG lHeight);

This function is exported by PMGPI.DLL as ordinal 723. You can use this function by loading it dynamically when needed, for example by the following code. (The code assumes that the program uses other Gpi* functions so PMGPI.DLL is already attached to the process!)

static BOOL APIENTRY (*fnGpiEnableYInversion)(HPS hps, LONG lHeight) = NULL; void GpiEnableYInversion(HPS hps, LONG lHeight) {  HMODULE hmod; int rc; if (fnGpiEnableYInversion) fnGpiEnableYInversion(hps, lHeight); else {    // Interesting, it doesn't work with DosQueryModuleHandle, even // though it returns the very same handle. //  [ rc = DosQueryModuleHandle("PMGPI", &hmod); ] // I have to load and free the module instead... rc = DosLoadModule(NULL, 0, "PMGPI", &hmod); if (rc!=NO_ERROR) return; DosQueryProcAddr(hmod, 723, NULL, (PFN *)&fnGpiEnableYInversion); DosFreeModule(hmod); if (fnGpiEnableYInversion) fnGpiEnableYInversion(hps, lHeight); } }

Or you can tell the linker to import it, by adding something like this to your *.def file:

IMPORTS GpiEnableYInversion = PMGPI.723

Notes:

I think it was introduced with the Open32 API (previously called DAPIE or DAX). It's purpose is to ease the porting of Windows applications to OS/2. Using this API for a given Presentation Space handle (HPS), all the Gpi functions will be inverted using the given lHeight value.

Please note that not only the coordinates will be top-left based, but the blitting and handling of bitmaps will also be inverted. For example, using the GpiDrawBits API expects a pointer to a pixel array, which is bottom-up by default. Once this call is used on the target Presentation Space, you'll have to have the pixels top-up way in your buffer if you want to have your image to be shown correctly.

The current setting of Y-Inversion can be queried with the GpiQueryYInversion API.