There are two ways of specifying attributes, Bundled and Individually. Attributes may be set individually by calling the appropriate routines one at a time. As an example, for a polyline one could set the line style, the line width, and the colour by calling the routines GSLN, GSLWSC, and GPLCI, before calling GPL to output the polyline. Setting attributes individually will ensure that the primitives to which they are bound appear the same on all workstations, assuming that the workstations have sufficient capability. However, if attributes are set using bundles, then the results will be workstation-dependent.
Bundled attributes are assigned by selecting a bundle index
for a particular type of primitive using the routines given in section
on Page
. The bundle index points to an entry in the
appropriate workstation bundle table.
Hence, each workstation has a bundle table for every primitive type,
and each entry in a bundle table contains a pre-defined set of
attributes for that particular primitive.
For example, the first entry in the polyline bundle table may contain
the attributes dotted and red, the second may
contain solid, double thickness and blue, etc.
Note that attribute bundles do
not contain geometric attributes.
Beginners are advised to ignore attribute bundles and to set each
attribute individually. However, read the next section on
Aspect Source Flags before trying out a program.
As an example of why one might make use of attribute bundles, consider an application which sometimes uses a colour terminal and sometimes a monochrome one. By drawing polylines with, say, bundle table index 5, the actual appearance of the polylines will depend on the contents of polyline bundle 5 on the two workstations. Thus, the application can arrange to distinguish the polylines by using a particular colour on the colour terminal, and a particular dash pattern on the monochrome terminal, without making changes to the body of the code which draws the primitives.
By using attribute bundles to specify attributes, and assuming that
the primitives have been stored in segments
(segments are described in Chapter on Page
),
the application can also change the appearance of primitives
after they have been output to a workstation by
re-defining the contents of the bundle table.
This effect can not be achieved if the
attributes are set individually without deleting and re-drawing
the primitives.
To control whether a primitive attribute should be set individually, or using a bundle table index, each primitive has a set of attributes called the Aspect Source Flags (ASFs); one flag for each primitive attribute. If the ASF for a particular attribute is set to 'GBUNDL', then the primitive will be bound to the attributes in the bundle table entry pointed to by the bundle index currently in force. If the ASF for a particular attribute is set to 'GINDIV', then the primitive will be bound to the current individual attribute values for that type of primitive.
Unfortunately, the committee which designed GKS could not agree on whether the default setting for the ASFs should be bundled or individual. Thus, American implementations, such as PLOT10/GKS, tend to default the ASFs to set attributes individually, whilst European implementations, such as GKSGRAL, tend to default ASFs to bundled attributes. In order to be safe, users of GKS are advised to set their own default values for the ASFs as soon as they open GKS. This can be done by calling:
CALL GSASF(ASFLST)where ASFLST is an array of 13 integers, one for each attribute, which must be set to 'GBUNDL' or 'GINDIV'. The bundle table index for each attribute is given in parentheses in the attribute list below. An example program which calls GSASF may be found in Appendix on Page
It is possible to define the entries in the bundle tables by calling one of the following routines:
Set polyline representation:
GSPLR(WKID, PLI, LN, LWSC, PLCI)
Set polymarker representation
GSPMR(WKID, PMI, MK, MKSC, PMCI)
Set text representation
GSTXR(WKID, TXI, TXF, TXP, CHXP, CHSP, TXCI)
Set fill area representation
GSFAR(WKID, FAI, FAIS, FASI, FACI)
Set pattern representation
GSPAR(WKID, PAI, DIMX, DIMY, NCS, NRS, DX, DY, PACI)As arguments, each routine requires the workstation identifier (WKID) and bundle index (PLI, etc.) to be set, plus a value for each of the non-geometric attributes for that particular primitive, and which are listed below. Details of GSPAR will not be given in this Primer; see the GKSGRAL manual or one of the references in the bibliography for more information.