Jump to content

GpiQueryViewingTransformMatrix

From EDM2

This function returns the current viewing transform (see GpiSetViewingTransformMatrix).

Syntax

GpiQueryViewingTransformMatrix(hps, lCount, pmatlfArray)

Parameters

hps (HPS) - input
Presentation-space handle.
lCount (LONG) - input
Number of elements.
The number of elements to be returned in pmatlfArray (must be in the range 0 through 9). If 0 is specified, no matrix elements are returned.
pmatlfArray (PMATRIXLF) - output
Transform matrix.
A structure in which the elements of the viewing transform matrix are returned.

Return Value

rc (BOOL) - returns
Success indicator.
TRUE : Successful completion
FALSE : Error occurred.

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_MICROPS_FUNCTION (0x20A1)
An attempt was made to issue a function that is invalid in a micro presentation space.
PMERR_INV_LENGTH_OR_COUNT (0x2092)
An invalid length or count parameter was specified.

Example Code

This example uses the GpiQueryViewingTransformMatrix function to see if the width and the height of drawing are already doubled. If this is not the case, the GpiSetViewingTransformMatrix is used to replace the existing viewing transformation. The new transformation will then double the width and height of drawing.

#define INCL_GPITRANSFORMS
#include <os2.h>

HPS hps; /* Presentation space handle. */
LONG lCount; /* maximum number of elements */
MATRIXLF matlf = { MAKEFIXED(2,0), /* scale x coordinates by a */
                                /* factor of 2. */
                   0, 0, 0,      /* no rotation. */
                   MAKEFIXED(2,0), /* scale y coordinates by a */
                                /* factor of 2. */
                   0, 0, 1};     /* no rotation. */
lCount = 9L; /* number of elements. */

GpiQueryViewingTransformMatrix(hps, lCount, &matlf);

if (matlf.fxM12 == MAKEFIXED(2, 0))
{
  GpiSetViewingTransformMatrix(hps, lCount, &matlf, TRANSFORM_REPLACE);
}