• Aucun résultat trouvé

AN INTRODUCTION TO SEGMENTS

Dans le document 4110 SERIES HOST PROGRAMMERS (Page 63-67)

• How to build segments

• Segment classes and matching classes

AN INTRODUCTION TO SEGMENTS

PREVIEW

• A segment is a reusable collection of graphics primitives and primitive attributes stored in the terminal's memory.

• The terminal can manipulate a segment as a single object.

• Using segments reduces communications time with the host.

• Segments are named by integers from 1 through 32767.

• Segment numbers 0, -1, -2, and -3 each have a spe-cial purpose.

• Segment attributes affect how the terminal draws the segment.

• You can change a segment's dynamic attributes after the segment has been defined.

• A segment's static attribute (the pivot point) cannot be changed after the segment definition has begun.

4110 SERIES HOST

CONCEPTS AND DEFINITIONS What Is a Segment?

A segment is a collection of graphics primitives and their attributes that the terminal a treats as a single object. A segment can contain nothing, as little as a single graphics primitive, or as much as an entire display. The terminal can draw, translate, rotate, or scale segments.

The terminal stores segments in its memory as a list of graphics primitives and changes to the primitive attributes.

Once a segment is defined, you cannot change the graphics primitives or their attributes.

You will find a discussion on how to define segments later in this section.

Retained and Non Retained Segments

When you define a segment, the terminal stores the graph-ics primitives in a segment definition as a retained segment - or more simply, a segment. The terminal displays these graphics primitives as you send them, unless you use the fixup level or segment visibility to suppress the display.

The terminal also displays the graphics primitives that you send outside of a segment definition. Once these primitives are executed, however, the terminal can no longer access them. These sequences of graphics primitives that are not part of a segment are sometimes called non retained seg-ments. In this manual, whenever the term segment is used, it means a retained segment: one that is stored in the termi-nal's memory and is accessible to the terminal.

7-1

SEGMENTS

Segment Numbering

Each segment must have a unique name, an integer from 1 through 32767. All segment commands require a segment number to identify the segment. Three segment commands (BEGIN HIGHER SEGMENT, BEGIN LOWER SEGMENT, and END SEGMENT) use an implicit segment number from, or calculated from, an ongoing segment definition. The re-maining segment commands require an explicit segment number. This segment number can be a normal segment number, or in the case of some commands, a special seg-ment number.

Segment numbers 0, -1, -2, and -3 have special mean-ing and can be used as parameters for some segment com-mands. You should check the 4110 Series Command Reference Manual to see if a special segment number is an allowed parameter for a particular command. The meaning of each special segment number is as follows:

• Segment 0 is the crosshair graphics input cursor. The crosshair cursor is generated by circuitry inside the termi-nal. You cannot manipulate it in all the ways that you can manipulate other segments. You can only position it, set its visibility, or report on it.

For example, although you can move the crosshair cursor position by using the SET-SEGMENT-POSITION command, you cannot scale or rotate the crosshair cursor. This means that segment number 0 is not allowed as a parameter in the SET-SEGMENT-IMAGE-TRANS-FORM command.

• Segment -1 means "all segments currently defined."

This includes defined segments from 1 through 32767.

Segment 0 is not included in Segment -1.

Segment -1 can be used in commands that change the dynamic segment attributes. For example, if you want to make all currently defined segments invisible, you can use -1 as the segment number in the SET-SEGMENT-VISIBILITY command.

• Segment -2 means "all future segments." For example, if you do not want to see segments as they are being de-fined, make Segment -2 invisible. (You must make indi-vidual segments visible before the terminal will display them.)

7-2

• Segment -3 means "all segments, from Segment 1 through Segment 32767, that match the current segment matching class." Using -3 as a segment number allows you to manipulate a class of segments simultaneously. A discussion on segment classes and matching classes is included later in this section.

SEGMENT ATTRIBUTES

A retained segment has a large number of attributes: defin-able characteristics that affect the visible display of the seg-ment. One attribute is set before you define the segment and cannot be changed. Other attributes can be altered to change the appearance of the segment.

The Pivot Point and the Segment Origin

The pivot point is the coordinate specified by the SET-PIVOT-POINT command. In an untransformed segment, the pivot point is the origin of the segment. When you define a segment, the graphics primitive commands are stored rela-tive to the segment's pivot point. If you transform a seg-ment, the rotation is about the segment origin and scaling is centered on it.

If you define segments after changing the location of future segments by issuing the SET-SEGMENT-POSITION or SET-SEGMENT-IMAGE-TRAN8FORM commands for Seg-ment -2 (all future segments), the origin of newly defined segments is defined as though you had moved the pivot point with the SET-PIVOT-POINT command. The pivot pOint, however, remains at the coordinates set by the SET-PIVOT-POINT command.

When you move a segment, the terminal moves the seg-ment origin to the location you specify; then redraws the segment by relative MOVEs and DRAWs about that loca-tion. Thus, each time the terminal draws a segment, the terminal begins with an absolute MOVE to the segment lo-cation, then draws the segment relative to that location.

4110 SERIES HOST

(

Dynamic Segment Attributes

A segment's dynamic attributes are those attributes that can be changed after the segment is defined. These attributes are:

Position, Scaling, and Rotation. The command SET-SEG-MENT-POSITION changes the location of the segment's or-igin in terminal space. On raster display terminals, you may not see a change in the display after moving a segment, depending on the fixup level. On DVST terminals, you will see segments - that are displayed in Storage mode -displayed in their new position, while the old image remains on the screen.

In addition to simply positioning a segment, you might want to change the size or rotation of a segment. You can scale, rotate, and position a segment with the SET-SEGMENT-IMAGE-TRANSFORM command.

On a raster display terminal you can make segments visible or invisible with the SET-SEGMENT-VISIBILITY command.

A visible segment is retained and displayed; an invisible seg-ment is retained but not displayed.

The SET-SEGMENT-WRITING-MODE command deter-mines just how a terminal draws a segment on the display screen. This command affects raster display and DVST ter-minals differently.

When a raster display terminal displays a segment, it writes a pattern into the raster memory. All raster terminals can draw the segment in one of two ways: Set mode and XOR raster memory cell and the color index of the affected pixel.

The terminal can erase a segment by redrawing it in XOR mode.

A disadvantage of XOR mode is that segment overlaps can be drawn in the color index that is the result of the XOR between the two color indices. When it is important that the segment look correct at an overlap, you should either use OR operations between the color index of the pixel and the raster memory cell of the affected pixel.

When a DVST terminal displays a segment, it displays in either storage or refresh mode. Storage mode allows you to write the segment to the screen, where it remains until the screen is erased. Refresh mode allows you to delete a seg-ment from the display without eraSing the screen. (Erasing the screen uses terminal processor time.)

You can highlight - that is, cause a segment to blink be-tween invisible and visible - with the SET-SEGMENT-HIGHLIGHTING command. DVST terminals display highlighted segments in refresh and alternately make them visible and invisible.

The detectability of a segment determines whether or not the segment can be picked by the GIN Pick function. You can set the segment detectability with the command SET-SEGMENT-DETECTABILITY. For more information see Section 9, Graphics Input.

The display priority of a segment determines the order in which the terminal draws segments on the display screen and the order in which the terminal scans segments during a GIN Pick. You can change the segment display priority with the SET-SEGMENT-DISPLAY-PRIORITY command. The display priority for a segment may be any integer from -32768 through +32767.

7-3

SEGMENTS

When a raster display terminal redraws segments, it draws those segments with a higher display priority later than those with a lower display priority. If segments overlap, the segments drawn later appear to be closer to the viewer.

Figure 7-1 shows how you can change the appearance of a picture by interchanging the display priority of two

segments.

When the terminal is doing a GIN Pick, it examines seg-ments in priority order. Thus, if parts of several segseg-ments fall in the pick aperture, the highest priority segment is picked. See Section 9, Graphics Input for details on the Pick function.

Segment Class. Each segment contains a 64-bit segment class field. The contents of this field can be changed after the segment is defined. You will find a discussion on seg-ment classes later in this section.

SEGMENT 1

SEGMENT 1 DRAWN BEFORE SEGMENT 2

USE OF SEGMENTS

The primary reason to use segments is to reduce communi-cation with the host computer. You do not have to send the entire group of graphics primitives to draw your display each time you change it. Rather, the terminal remembers and re-draws the visible segments to form the display. When the terminal does a pan or zoom, it draws the new display from the segments which define the old display.

You can also use segments to replicate images on the dis-play, or use a segment as a GIN cursor.

SEGMENT 2

Figure 7-1. Interchanging the Display Priority of Two Segments.

7-4 4110 SERIES HOST

(

(

(

Dans le document 4110 SERIES HOST PROGRAMMERS (Page 63-67)

Documents relatifs