eCo Software Developer Connection


About DevCon
Subscription to DevCon
Budget of DevCon
FAQ


Roadmap
eCo Software runtime
eCo Software toolkit
Contacts

This is an old revision of the document!


GpiEnableYInversion() source: wiki.netlabs.org

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

Call the function with

lHeight = height - 1; GpiEnableYInversion(hps, lHeight);

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.

It seems the aptl[] parameter of GpiBitBlt does not get inverted! However, the bitmaps themselves do!

The output of GPIPartialArc gets mirrored across the Y-axis - the rotational direction changes!

 
en/gpienableyinversion.1255188660.txt.gz · Last modified: 2009/10/10 14:31 (external edit)

 
Recent changes RSS feed
© 2001 - 2009 eCo Software, All rights reserved