Jump to content

GPIGuide - Graphics Functions: Difference between revisions

From EDM2
Created page with "{{IBM-Reprint}} {{GPIGuide}} ==Coordinates== GPI coordinate values that are in world or model space are passed in variables of data type LONG. For a presentation space of fo..."
 
Ak120 (talk | contribs)
mNo edit summary
Line 15: Line 15:


==Matrix Parameter Values==
==Matrix Parameter Values==
These GPI functions define transforms:
These GPI functions define transforms:
 
:GpiSetSegmentTransformMatrix
    GpiSetSegmentTransformMatrix
:GpiSetModelTransformMatrix
    GpiSetModelTransformMatrix
:GpiCallSegmentMatrix
    GpiCallSegmentMatrix
:GpiSetViewingTransformMatrix
    GpiSetViewingTransformMatrix
:GpiSetDefaultViewMatrix
    GpiSetDefaultViewMatrix
:GpiCreatePS
    GpiCreatePS
:GpiSetPageViewport.  
    GpiSetPageViewport.  


;Note: The last two functions define the device transform; the page viewport may be defaulted.
;Note: The last two functions define the device transform; the page viewport may be defaulted.
Line 41: Line 39:


==Drawing Process Check Errors==
==Drawing Process Check Errors==
Some GPI functions involve processing buffers of graphics orders or retained graphics segments (the data for which consists of graphics orders). These functions can give rise to Drawing Process Check (DPC) errors if an order is found that either is not valid in its context or that contains invalid data. If this happens, processing of the function stops and the error is recorded. Note that orders up to the one found to be in error are processed by the function, and output occurs if drawing is being performed.
Some GPI functions involve processing buffers of graphics orders or retained graphics segments (the data for which consists of graphics orders). These functions can give rise to Drawing Process Check (DPC) errors if an order is found that either is not valid in its context or that contains invalid data. If this happens, processing of the function stops and the error is recorded. Note that orders up to the one found to be in error are processed by the function, and output occurs if drawing is being performed.


Each function that can return these errors has Drawing Process Check errors in its error condition list. The full list of DPC errors is:
Each function that can return these errors has Drawing Process Check errors in its error condition list. The full list of DPC errors is:
 
:PMERR_INV_IN_AREA PMERR_INV_IN_PATH
    PMERR_INV_IN_AREA PMERR_INV_IN_PATH
:PMERR_INV_IN_ELEMENT
    PMERR_INV_IN_ELEMENT
:PMERR_ALREADY_IN_ELEMENT
    PMERR_ALREADY_IN_ELEMENT
:PMERR_STOP_DRAW_OCCURRED (warning)
    PMERR_STOP_DRAW_OCCURRED (warning)
:PMERR_PATH_INCOMPLETE
    PMERR_PATH_INCOMPLETE
:PMERR_AREA_INCOMPLETE
    PMERR_AREA_INCOMPLETE
:PMERR_IMAGE_INCOMPLETE
    PMERR_IMAGE_INCOMPLETE
:PMERR_INV_ORDER_LENGTH
    PMERR_INV_ORDER_LENGTH
:PMERR_NOT_IN_IMAGE
    PMERR_NOT_IN_IMAGE
:PMERR_NOT_IN_AREA
    PMERR_NOT_IN_AREA
:PMERR_NOT_IN_ELEMENT
    PMERR_NOT_IN_ELEMENT
:PMERR_NOT_IN_PATH
    PMERR_NOT_IN_PATH
:PMERR_INSUFFICIENT_MEMORY
    PMERR_INSUFFICIENT_MEMORY
:PMERR_SEG_CALL_STACK_EMPTY
    PMERR_SEG_CALL_STACK_EMPTY
:PMERR_SEG_CALL_STACK_FULL
    PMERR_SEG_CALL_STACK_FULL
:PMERR_TRUNCATED_ORDER
    PMERR_TRUNCATED_ORDER
:PMERR_CALLED_SEG_NOT_FOUND
    PMERR_CALLED_SEG_NOT_FOUND
:PMERR_DYNAMIC_SEG_SEQ_ERROR
    PMERR_DYNAMIC_SEG_SEQ_ERROR
:PMERR_PROLOG_ERROR
    PMERR_PROLOG_ERROR
:PMERR_INV_IN_VECTOR_SYMBOL
    PMERR_INV_IN_VECTOR_SYMBOL


==Functions==
==Functions==
Line 72: Line 68:
==GPI Function Context==
==GPI Function Context==
A number of the GPI error conditions indicate that a function has been used in the wrong context. This appendix lists every function and shows, for each one, whether it can be used:
A number of the GPI error conditions indicate that a function has been used in the wrong context. This appendix lists every function and shows, for each one, whether it can be used:
* In a micro presentation space
* In a micro presentation space
* While there is an open segment bracket
* While there is an open segment bracket

Revision as of 15:09, 24 June 2023

Reprint Courtesy of International Business Machines Corporation, © International Business Machines Corporation

GPI Guide and Reference
  1. How to Use the GPI Guide and Reference
  2. Graphics Functions
  3. Data Types
  4. Graphics Orders
  5. Graphics Orders Data Types
  6. Errors
  7. Area and Polygon Primitives
  8. Bit Maps
  9. Creating and Drawing Retained Graphics
  10. Character String Primitives
  11. Clipping and Boundary Determination
  12. Color and Mix Attributes
  13. Correlation
  14. Coordinate Spaces and Transformations
  15. Editing Retained Graphics and Graphics Segments
  16. Fonts
  17. Graphics Attributes
  18. Line and Arc Primitives
  19. Marker Primitives
  20. Matrix Multiplication
  21. Metafiles
  22. Print Job Submission and Manipulation
  23. Presentation Spaces and Device Contexts
  24. Paths
  25. Regions
  26. Notices
  27. Glossary

Coordinates

GPI coordinate values that are in world or model space are passed in variables of data type LONG. For a presentation space of format GPIF_LONG (see GpiCreatePS), the signed value must be contained within the low-order 28 bits.

For a presentation space with a format of GPIF_SHORT, the signed value must be contained within the low-order 16 bits. Coordinates that exceed this limit are truncated without error, when stored in a segment. As a consequence, a large positive number may appear as a negative number.

In both instances, after transformation to media space (that is, device space, possibly including a translation for the window origin), coordinate values must be in the range -32 768 through +32 767.

The PMERR_COORDINATE_OVERFLOW error condition occurs if a coordinate is too large to be handled.

Region coordinates must be within the range -32 767 through +32 765.

Matrix Parameter Values

These GPI functions define transforms:

GpiSetSegmentTransformMatrix
GpiSetModelTransformMatrix
GpiCallSegmentMatrix
GpiSetViewingTransformMatrix
GpiSetDefaultViewMatrix
GpiCreatePS
GpiSetPageViewport.
Note
The last two functions define the device transform; the page viewport may be defaulted.

Concatenation of transform matrixes can occur as the transform is specified, for example, if TRANSFORM_ADD is specified. Concatenation also occurs during drawing, between the various transforms in the viewing pipeline.

During the process of concatenation, it is possible for the matrix parameter overflow error, PMERR_INV_MATRIX_ELEMENT, to occur. This error is raised if either of the following conditions occurs for any intermediate value during the concatenation arithmetic (see, for example, GpiSetSegmentTransformMatrix for an explanation of matrix element numbers):

  • Any of the matrix elements 1, 2, 4, or 5 is greater than 32 767 or less than -32 768 (ñ1 for a GPIF_SHORT format presentation space), or
  • Either of elements 7 or 8 is greater than 134 217 727 (2 -1) or less than -134 217 728 (-2) (greater than 32 767 or less than -32 768 for a GPIF_SHORT format presentation space).

Rounding Errors

In general for graphics coordinates, when non-unity transforms (apart from simple translation) are involved, rounding errors occur. For example, adding the coordinates of one point to a delta value, to produce the coordinates of a second point (all in world coordinates) does not always map to the same device pel as if the computation had been done in device coordinates. Such errors can be avoided if calculations are done in device coordinates, or if there are no scaling (or rotational, or shear) elements in the transforms. Alternatively, the problems can be reduced, though not eliminated, by defining very fine world coordinates.

Drawing Process Check Errors

Some GPI functions involve processing buffers of graphics orders or retained graphics segments (the data for which consists of graphics orders). These functions can give rise to Drawing Process Check (DPC) errors if an order is found that either is not valid in its context or that contains invalid data. If this happens, processing of the function stops and the error is recorded. Note that orders up to the one found to be in error are processed by the function, and output occurs if drawing is being performed.

Each function that can return these errors has Drawing Process Check errors in its error condition list. The full list of DPC errors is:

PMERR_INV_IN_AREA PMERR_INV_IN_PATH
PMERR_INV_IN_ELEMENT
PMERR_ALREADY_IN_ELEMENT
PMERR_STOP_DRAW_OCCURRED (warning)
PMERR_PATH_INCOMPLETE
PMERR_AREA_INCOMPLETE
PMERR_IMAGE_INCOMPLETE
PMERR_INV_ORDER_LENGTH
PMERR_NOT_IN_IMAGE
PMERR_NOT_IN_AREA
PMERR_NOT_IN_ELEMENT
PMERR_NOT_IN_PATH
PMERR_INSUFFICIENT_MEMORY
PMERR_SEG_CALL_STACK_EMPTY
PMERR_SEG_CALL_STACK_FULL
PMERR_TRUNCATED_ORDER
PMERR_CALLED_SEG_NOT_FOUND
PMERR_DYNAMIC_SEG_SEQ_ERROR
PMERR_PROLOG_ERROR
PMERR_INV_IN_VECTOR_SYMBOL

Functions

The GPI Functions are listed here

GPI Function Context

A number of the GPI error conditions indicate that a function has been used in the wrong context. This appendix lists every function and shows, for each one, whether it can be used:

  • In a micro presentation space
  • While there is an open segment bracket
  • While there is an open area bracket
  • While there is an open element bracket
  • While there is an open path bracket.

A yes (Yes) means that a function can be used; a no (No) means that it cannot. There are some additional qualifiers in the form of superscript numbers. These generally indicate some further restriction on the context in which a function can be called, and are explained at the end of this appendix.

Where GPI Functions Can Be Called

...