GpiEnableYInversion: Difference between revisions
Created page with "This function is exported by PMGPI.DLL as ordinal 723. ==Syntax== BOOL APIENTRY GpiEnableYInversion(HPS hps, LONG lHeight); ==Remarks== It is belived it was introduced wit..." |
|||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
This function is exported by PMGPI.DLL as ordinal 723. | This function is exported by PMGPI.DLL as ordinal 723. | ||
==Syntax== | ==Syntax== | ||
Line 6: | Line 5: | ||
==Remarks== | ==Remarks== | ||
It is belived it was introduced with the Open32 API (previously called DAPIE or DAX). | It is belived it was introduced with the Open32 API (previously called DAPIE or DAX). Its 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. | 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. | ||
Line 18: | Line 17: | ||
==Sample Code== | ==Sample Code== | ||
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!) | 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!) | ||
<pre> | |||
static BOOL APIENTRY (*fnGpiEnableYInversion)(HPS hps, LONG lHeight) = NULL; | static BOOL APIENTRY (*fnGpiEnableYInversion)(HPS hps, LONG lHeight) = NULL; | ||
Line 44: | Line 43: | ||
} | } | ||
} | } | ||
</pre> | |||
Or you can tell the linker to import it, by adding something like this to your *.def file: | Or you can tell the linker to import it, by adding something like this to your *.def file: | ||
IMPORTS | IMPORTS | ||
GpiEnableYInversion = PMGPI.723 | GpiEnableYInversion = PMGPI.723 | ||
Call the function with | Call the function with | ||
lHeight = height - 1; | lHeight = height - 1; | ||
GpiEnableYInversion(hps, lHeight); | GpiEnableYInversion(hps, lHeight); | ||
[[Category:Gpi]] | [[Category:Gpi]] |
Latest revision as of 23:37, 23 April 2025
This function is exported by PMGPI.DLL as ordinal 723.
Syntax
BOOL APIENTRY GpiEnableYInversion(HPS hps, LONG lHeight);
Remarks
It is belived it was introduced with the Open32 API (previously called DAPIE or DAX). Its 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!
Sample Code
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);