Jump to content

GpiSetPageViewport: Difference between revisions

From EDM2
Ak120 (talk | contribs)
mNo edit summary
 
(One intermediate revision by one other user not shown)
Line 15: Line 15:


==Errors==  
==Errors==  
Possible returns from WinGetLastError
Possible returns from WinGetLastError:
; PMERR_INV_HPS (0x207F) : An invalid presentation-space handle was specified.
;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_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_PAGE_VIEWPORT (0x20AD) : An invalid viewport parameter was specified with GpiSetPageViewport.
; PMERR_INV_COORDINATE (0x205B) : An invalid coordinate value was specified.
;PMERR_INV_COORDINATE (0x205B) : An invalid coordinate value was specified.


==Remarks==
==Remarks==
Line 53: Line 53:


==Related Functions==
==Related Functions==
*GpiCreatePS
*[[GpiCreatePS]]
*[[GpiQueryPageViewport]]
*[[GpiQueryPageViewport]]


[[Category:Gpi]]
[[Category:Gpi]]

Latest revision as of 23:39, 7 April 2025

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