Jump to content

GpiSetPageViewport

From EDM2
Revision as of 15:48, 12 October 2022 by Ak120 (talk | contribs)

This function sets the page viewport within device space.

Syntax

GpiSetPageViewport(hps, prclViewport);

Parameters

hps (HPS) - input
Presentation-space handle.
prclViewport (PRECTL) - input
Page viewport.
The page viewport is specified in device units.

Return Code

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_PAGE_VIEWPORT (0x20AD)
An invalid viewport parameter was specified with GpiSetPageViewport.
PMERR_INV_COORDINATE (0x205B)
An invalid coordinate value was specified.

Remarks

The presentation page maps to the page viewport and together they define the device transform.

When a presentation space is associated with a device context, a default page viewport is set up.

The origin in device space is mapped to the bottom-left of the output media (window or paper, for example).

This function must not be issued when there is no device context associated with the presentation space.

This function is ignored if issued to a presentation space that is associated with a device context of type OD_QUEUED (with PM_Q_STD data), OD_METAFILE, orOD_METAFILE_NOQUERY.

Example Code

This example sets the area of the device in which the picture is displayed to page viewport within device space.

#define INCL_GPITRANSFORMS
#include <os2.h>

HPS hps;          /* Presentation-space */
                  /* handle. */
RECTL rclField = {25L,   /* x coordinate of left-hand edge of */
                         /* rectangle. */
                  25L,   /* y coordinate of bottom edge of */
                         /* rectangle. */
                  425L,  /* x coordinate of right-hand edge of */
                         /* rectangle. */
                  425L}; /* y coordinate of top edge of
                         /* rectangle. */

GpiSetPageViewport(hps, &rclField);

Related Functions