GDDM V3R2 Base Application Programming Guide
|
Previous topic |
Next topic |
Contents |
Index |
Contact z/OS |
Library |
PDF |
BOOK
Creating segments, using GSSEG GDDM V3R2 Base Application Programming Guide SC33-0867-01 |
|
Segments are opened by executing a GSSEG call. They can be named:
CALL GSSEG(24); /* Define named segment with identifier 24 */
or unnamed:
CALL GSSEG(0); /* Define an unnamed segment (in other */
/* words, one with a zero identifier) */
Unnamed segments are not recommended if you are going to use GSSAVE, and
GSLOAD. See "Storing and retrieving graphics pictures" in topic 10.0.
By default, created segments are appended by GDDM to a drawing chain, containing all the segments that you create in the order that you create them. Only the segment data held in the drawing chain appears after a complete regeneration of the screen. Primitives belong to the currently open segment. This can be closed with a GSSCLS call:
CALL GSSCLS; /* Close current segment */
Issuing this call does not delete the graphics primitives enclosed in the
segment, it means that you do not intend to add any further primitives to
them.
A segment must be closed before another one can be opened. It must also be closed before respecifying any object that is above it in the graphics hierarchy (as described in "Hierarchy of GDDM concepts" in topic 7.0). For example:
CALL GSVIEW(0.0,1.0,0.0,0.5); /* Define first viewport */
CALL GSSEG(1); /* Open a graphics segment */
CALL GSMOVE(20.0,30.0);/*Start drawing picture in first viewport*/
.
.
.
CALL GSSCLS; /* Must close segment before defining new viewport */
You cannot reopen a named segment, once closed. But you can create as
many unnamed segments as you may choose, as explained in "Unnamed
segments" in topic 9.3.1.
You can still draw primitives when there is no segment open. The effects are described in "Primitives outside segments" in topic 9.8.1. Within a page you may have as many named or unnamed segments as you choose, but each named segment must have a different nonzero identifier. For example, it would be an error to issue CALL GSSEG(24) if the current page already has a segment with that identifier. Graphics primitive attributes are associated with the segment that is current when they are defined. If you issue CALL GSCOL(2) to change the current color to red, all later primitives in the segment (such as lines and arcs) are drawn in red. If you then close the segment and open a new one, all the graphics attributes (including color) are usually reset to the defaults. A called segment, however, does not assume the default attributes on being opened. Instead, it inherits the current attributes. These remain current until changed within the called segment. See "Calling segments from other segments, using GSCALL" in topic 9.7. Once a primitive has been drawn with an explicitly defined attribute, as in the above GSCOL call, it cannot be altered. You cannot normally change, a line's color from red to blue, unless the line was drawn with the default color attribute. This can affect already-drawn pictures, as described in "Changing default attribute values" in topic 2.7.1. It is important to remember that segments are collections of primitives, not areas of the screen. You could, for instance, create one segment comprised of some primitives in each corner of the screen, and another comprised of some other primitives in the middle. And you can overlap primitives from different segments. Figure 42 comprises only three segments. For identification, all the primitives of each one are the same color.
|
Copyright IBM Corporation 1990, 2012 |