GDDM V3R2 Base Application Programming Guide
Previous topic | Next topic | Contents | Index | Contact z/OS | Library | PDF | BOOK


Drawing chain and segment priority

GDDM V3R2 Base Application Programming Guide
SC33-0867-01



As mentioned earlier in this topic, segments are normally added to the drawing chain when they are created, and subsequently drawn in the order that they appear on the drawing chain. Later segments are said to have higher priority than earlier ones. If you visualize segments as being drawn in layers, with one segment per layer, each new one overlays all the existing ones. Where primitives from different segments occupy the same location, the later one obscures the earlier (assuming the default mix mode of overpaint).

Graphics primitives within a segment follow the same rule: later primitives are drawn on top of earlier ones. When a segment is copied or included, its primitives are drawn on top of any existing primitives, and any later primitives are drawn on top of the copied or included ones.

You can change the priorities of existing segments in the drawing chain with the GSSPRI call:


         /* Segment-id  Ref-seg-id   Order  */
     CALL GSSPRI(3,         7,         1); /* Put seg 3 after seg 7  */
     CALL GSSPRI(9,         2,        -1); /* Put seg 9 before seg 2 */

The first parameter specifies the segment whose priority is to be changed. The second specifies another segment called the reference segment. The third parameter must be either 1, meaning the first segment is to become the next higher in priority to the reference segment, or -1, meaning the first segment is to become the next lower in priority to the reference segment.

In addition to altering the drawing order, GSSPRI can affect which primitives are detected by a pick input device (see "Writing interactive graphics applications" in topic 11.0).

You cannot change the priorities of graphics primitives within a segment, nor of primitives outside segments, nor of segment 0.

One use of the GSSPRI call is in three-dimensional applications, when it is used to ensure that hidden surfaces are not visible or detectable. Another is in drawing layered pictures such as microchip layouts.

You can query segment priorities with the GSQPRI call:


     DCL NEXT_SEG FIXED BIN(31);

/* Ref-seg-id Seg-id Order */ CALL GSQPRI(3, NEXT_SEG, 1); /* Which seg follows seg 3? */

In the second parameter, GDDM returns the segment next to the one specified in the first parameter - its successor if the last parameter is 1, or its predecessor if this is -1. If the last parameter is 1 and the specified segment is the latest one, GDDM returns 0 in the second parameter. And GDDM similarly returns 0 if the last parameter is -1 and the specified segment is the earliest one.

You cannot query the position of segment 0. A value of 0 in the first parameter has a special meaning, which depends on the value of the last parameter. If this is 1, GDDM returns the identifier of the latest segment, or if it is -1, of the earliest segment.

Subtopics:

Go to the previous page Go to the next page



Copyright IBM Corporation 1990, 2012