Jump to content

GpiQueryViewingTransformMatrix: Difference between revisions

From EDM2
Created page with "==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 Val..."
 
No edit summary
 
Line 1: Line 1:
This function returns the current viewing transform (see [[GpiSetViewingTransformMatrix]]).
==Syntax==
==Syntax==
GpiQueryViewingTransformMatrix(hps, lCount, pmatlfArray);
GpiQueryViewingTransformMatrix(hps, lCount, pmatlfArray);


==Parameters==
==Parameters==

Latest revision as of 14:17, 7 April 2025

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

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

HPS          hps;          /*  Presentation-space handle. */
LONG         lCount;       /*  Number of elements. */
PMATRIXLF    pmatlfArray;  /*  Transform matrix. */
BOOL         rc;           /*  Success indicator. */

rc = GpiQueryViewingTransformMatrix(hps, lCount,
       pmatlfArray);


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);
}