On the Concept of Attributes
Definition
Segments Attributes (SA) are properties of segments which may be altered after the segment has been
closed (e.g. visibility) - segments might be switched on and off (posted and unposted).
Drawing Attributes (DA) are attributes possessed by individual drawing elements (e.g. lines).
These may not be individually altered after the element has been created - e.g. colour, it is conceivable
that individual lines might have colour as an attribute.
Problems
- How to specify the values of these attributes.
- How to specify the scope of these attributes.
- What is the interaction between the two types of attributes.
- What attributes do we have.
Observations
- Things are a lot easier if the SA's and DA's are disjoint.
- Let us divide attributes into 3 classes:
- PDA Pure DA's which do not apply to segments
- PSA Pure SA's which do not apply to drawing elements
- CA Common attributes which apply to both
- When a segment is opened, all SA's and DA's are set to default
values.
- PDA's may be set to apply to all following drawing elements until another setting,
or the end of the segment is reached. They cannot be modified.
- PSA's may be set at any time and apply to the whole segment.
- If a CA is used only (the intended use) as a PDA or PSA, then it should behave exactly as a PDA or PSA.
- If a CA is used as a CA then we have two possible interpretations:
- The use as a SA overrides the use as a DA (e.g. if a segment was drawn with red and blue lines, and
then the segment attribute was modified to be red, then the whole segment becomes red).
- The use as a DA overrides the use as a SA, that is only the initial default setting of the attribute is
altered (e.g. if a segment consisted of a part with the defaults unchanged and then a red part, then setting
the segment to blue would simply make the first part blue).
- What attributes might we have?
- Colour
- width
- Intensity
- Dottedness/Dashness/Solidity
- Visibility (Post/Unpost)
- Highlight
- Pen sensitivity
- Stored/refreshed
- CA's are so nasty ... that we should not have any! i.e. we should partition the attributes in 8 into PDA's and PSA's.
- Let us call the current value of the PSA's the segment status:
- 0 invisible
- 1 visible-refreshed
- 2 visible-stored
- 3 visible-highlighted
i.e. the function is set segment status (nseg, istatus)
- Drop pen sensitivity - because:
- It is too device dependent?
- It can be done outside the graphics system (i.e. the application programmer can ignore any pen hits that he does not want).
- PDA's - we are left with a hotch-potch of device dependent attributes, if we provide functions which operate
on these attributes directly then the programs using them will be device dependent.
The way out of this is to use one level of indirection in the same way as in operating
systems (e.g. select output stream n - where the correspondence between physical device and stream number is
defined externally perhaps in the job description). Thus:
select line style (n)
Where a table of line types giving colour/intensity/hardware mode etc. is set up externally.
Then, to go from one device to another, the table and not the program is changed.