Every graphics presentation space has a set of graphics attributes. A normal presentation space has a larger set of graphics attributes than a micro or cached micro presentation space. (Segment-related attributes, for example, do not apply in micro presentation spaces.) These attributes all have default values, which means that they always have an effect on graphics, even if you have not explicitly specified their values. The attributes can be broken into two general groups. The first group comprises those attributes that form a part of the picture and that can vary as the picture is drawn. These are:
With the exception of the segment attributes and the viewing transformation, these attributes are reset to their default values at the start of a root segment, unless the fast-chaining attribute is set. If the fast-chaining attribute is set, their values cannot be guaranteed. You should, therefore, explicitly set any attribute values required in the segment. Similarly, the values of these attributes cannot be guaranteed following a call to:
Any GpiDraw... function Any GpiCorrelate... function
GpiCallSegmentMatrix
GpiCloseSegment
Therefore, if any of these functions is followed by primitives outside a segment, you should explicitly set required attribute values. When GpiCloseSegment is followed by GpiOpenSegment (and also between any two segments in the chain), the fast-chaining attribute determines what happens to the current values of these attributes. The viewing transformation and the segment attributes are unaffected by fast-chaining.
These attributes take effect when graphics are sent to an output device, not when graphics are defined. For this reason, the calls to GpiQuery... that retrieve the current values of these attributes are invalid in retain mode. The majority of the group-one attribute-setting functions cause graphics orders to be added to the current segment.
The second group of attributes defines the environment in which the picture is drawn. These attributes do not normally vary as the picture is drawn, but have an overall effect on the result of any drawing or correlation operation. This group includes:
The functions to GpiQuery... that retrieve the current values of these attribute are valid in all drawing modes. None of the group-two attribute-setting functions causes graphics orders to be added to the current segment.
The following table lists the graphics attributes, identifies the GPI function or functions that you use to change current settings, and lists the default value of each one. Note that these default values are the initial settings. The table also indicates whether the attribute is a group-one or a group-two attribute.
┌──────────────┬──────────────────────────────┬─────────────────────────────┬─────┬─────┐│Graphics │GPI Function │Default Value │Group│Group│ │Attribute │ │ │One │Two │ ├──────────────┼──────────────────────────────┼─────────────────────────────┼─────┼─────┤ │Arc parameters│GpiSetArcParams │(1,1,0,0) │Yes │ │ ├──────────────┼──────────────────────────────┼─────────────────────────────┼─────┼─────┤ │Foreground │GpiSetColor(1) │CLR_DEFAULT │Yes │ │ │color │ │(device-dependent) │ │ │ ├──────────────┼──────────────────────────────┼─────────────────────────────┼─────┼─────┤ │Foreground mix│GpiSetMix(1) │FM_DEFAULT (overpaint) │Yes │ │ ├──────────────┼──────────────────────────────┼─────────────────────────────┼─────┼─────┤ │Background │GpiSetBackColor(1) │CLR_DEFAULT │Yes │ │ │color │ │(device-dependent) │ │ │ ├──────────────┼──────────────────────────────┼─────────────────────────────┼─────┼─────┤ │Background mix│GpiSetBackMix(1) │BM_DEFAULT (leave-alone) │Yes │ │ ├──────────────┼──────────────────────────────┼─────────────────────────────┼─────┼─────┤ │Character │GpiSetCharAngle(1) │(1,0) │Yes │ │ │angle │ │ │ │ │ ├──────────────┼──────────────────────────────┼─────────────────────────────┼─────┼─────┤ │Character box │GpiSetCharBox(1) │Device-dependent │Yes │ │ ├──────────────┼──────────────────────────────┼─────────────────────────────┼─────┼─────┤ │Character │GpiSetCharDirection(1) │CHDIRN_DEFAULT (left to │Yes │ │ │Direction │ │right) │ │ │ ├──────────────┼──────────────────────────────┼─────────────────────────────┼─────┼─────┤ │Character mode│GpiSetCharMode(1) │CM_DEFAULT (mode 1) │Yes │ │ ├──────────────┼──────────────────────────────┼─────────────────────────────┼─────┼─────┤ │Character set │GpiSetCharSet(1) │LCID_DEFAULT (system font) │Yes │ │ ├──────────────┼──────────────────────────────┼─────────────────────────────┼─────┼─────┤ │Character │GpiSetCharShear(1) │(0,1) │Yes │ │ │shear │ │ │ │ │ ├──────────────┼──────────────────────────────┼─────────────────────────────┼─────┼─────┤ │Line end │GpiSetLineEnd(1) │LINEEND_DEFAULT (flat) │Yes │ │ ├──────────────┼──────────────────────────────┼─────────────────────────────┼─────┼─────┤ │Line join │GpiSetLineJoin(1) │LINEJOIN_DEFAULT (beveled) │Yes │ │ ├──────────────┼──────────────────────────────┼─────────────────────────────┼─────┼─────┤ │Line type │GpiSetLineType(1) │LINETYPE_DEFAULT (solid) │Yes │ │ ├──────────────┼──────────────────────────────┼─────────────────────────────┼─────┼─────┤ │Line width │GpiSetLineWidth(1) │LINEWIDTH_DEFAULT (1.0) │Yes │ │ ├──────────────┼──────────────────────────────┼─────────────────────────────┼─────┼─────┤ │Geometric line│GpiSetLineWidthGeom(1) │1 │Yes │ │ │width │ │ │ │ │ ├──────────────┼──────────────────────────────┼─────────────────────────────┼─────┼─────┤ │Marker │GpiSetMarker(1) │MARKSYM_DEFAULT (cross) │Yes │ │ ├──────────────┼──────────────────────────────┼─────────────────────────────┼─────┼─────┤ │Marker box │GpiSetMarkerBox(1) │Device-dependent │Yes │ │ ├──────────────┼──────────────────────────────┼─────────────────────────────┼─────┼─────┤ │Marker set │GpiSetMarkerSet(1) │LCID_DEFAULT (system marker │Yes │ │ │ │ │set) │ │ │ ├──────────────┼──────────────────────────────┼─────────────────────────────┼─────┼─────┤ │Pattern │GpiSetPattern(1) │PATSYM_DEFAULT (solid) │Yes │ │ ├──────────────┼──────────────────────────────┼─────────────────────────────┼─────┼─────┤ │Pattern │GpiSetPatternRefPoint(1) │(0,0) │Yes │ │ │reference │ │ │ │ │ │point │ │ │ │ │ ├──────────────┼──────────────────────────────┼─────────────────────────────┼─────┼─────┤ │Pattern set │GpiSetPatternSet(1) │LCID_DEFAULT (system pattern │Yes │ │ │ │ │set) │ │ │ ├──────────────┼──────────────────────────────┼─────────────────────────────┼─────┼─────┤ │Model │GpiSetModelTransformMatrix │Identity │Yes │ │ │transformation│ │ │ │ │ ├──────────────┼──────────────────────────────┼─────────────────────────────┼─────┼─────┤ │Instance │GpiCallSegmentMatrix │Identity │Yes │ │ │transformation│ │ │ │ │ ├──────────────┼──────────────────────────────┼─────────────────────────────┼─────┼─────┤ │Segment │GpiSetSegmentTransformMatrix │Identity │Yes │ │ │transformation│ │ │ │ │ ├──────────────┼──────────────────────────────┼─────────────────────────────┼─────┼─────┤ │Viewing │GpiSetViewingTransformMatrix │Identity │Yes │ │ │transformation│ │ │ │ │ ├──────────────┼──────────────────────────────┼─────────────────────────────┼─────┼─────┤ │Default │GpiSetDefaultViewMatrix │Identity │ │Yes │ │viewing │ │ │ │ │ │transformation│ │ │ │ │ ├──────────────┼──────────────────────────────┼─────────────────────────────┼─────┼─────┤ │Page viewport │GpiSetPageViewport │Device-dependent │ │Yes │ ├──────────────┼──────────────────────────────┼─────────────────────────────┼─────┼─────┤ │Clipping path │GpiSetClipPath │No clipping │Yes │ │ ├──────────────┼──────────────────────────────┼─────────────────────────────┼─────┼─────┤ │Viewing window│GpiSetViewingLimits │No clipping │Yes │ │ ├──────────────┼──────────────────────────────┼─────────────────────────────┼─────┼─────┤ │Graphics field│GpiSetGraphicsField │No clipping │ │Yes │ ├──────────────┼──────────────────────────────┼─────────────────────────────┼─────┼─────┤ │Clipping │GpiSetClipRegion │No clipping │ │Yes │ │region │ │ │ │ │ ├──────────────┼──────────────────────────────┼─────────────────────────────┼─────┼─────┤ │Tag │GpiSetTag │0 │Yes │ │ ├──────────────┼──────────────────────────────┼─────────────────────────────┼─────┼─────┤ │Segment │GpiSetInitialSegmentAttrs │ATTR_DETECTABLE - OFF │Yes │ │ │attributes │GpiSetSegmentAttrs │ATTR_VISIBLE - ON │ │ │ │ │ │ATTR_CHAINED - ON │ │ │ │ │ │ATTR_DYNAMIC - OFF │ │ │ │ │ │ATTR_FASTCHAIN - ON │ │ │ │ │ │ATTR_PROP_DETECTABLE - ON │ │ │ │ │ │ATTR_PROP_VISIBLE - ON │ │ │ ├──────────────┼──────────────────────────────┼─────────────────────────────┼─────┼─────┤ │Pick-aperture │GpiSetPickAperturePosition │Device-dependent │ │Yes │ │size │ │ │ │ │ ├──────────────┼──────────────────────────────┼─────────────────────────────┼─────┼─────┤ │Current │GpiSetCurrentPosition GpiMove²│(0,0) │Yes │ │ │position │ │ │ │ │ ├──────────────┼──────────────────────────────┼─────────────────────────────┼─────┼─────┤ │Drawing │GpiSetDrawControl │DCTL_ERASE - OFF │ │Yes │ │controls │ │DCTL_DISPLAY - ON │ │ │ │ │ │DCTL_BOUNDARY - OFF │ │ │ │ │ │DCTL_DYNAMIC - OFF │ │ │ │ │ │DCTL_CORRELATE - OFF │ │ │ └──────────────┴──────────────────────────────┴─────────────────────────────┴─────┴─────┘
Notes: (1). Can also be set using GpiSetAttrs.
(2). Is also updated indirectly by most primitive-drawing functions.
Each of the following functions causes all group-one and group-two graphics attributes to be set to their default values:
In specific circumstances, some of the GPI functions modify the group-one attributes and thus make their values unpredictable. Therefore, when you call any of these functions, you should respecify attribute values that have a particular importance to your application. For example, if the current foreground color is CLR_RED before you call GpiDrawChain you cannot always rely on the current color remaining CLR_RED when GpiDrawChain completes. If you want to continue working in red, respecify the color when GpiDrawChain completes. In general, the functions that affect group-one-attribute values are those related to the drawing and correlation of retained graphics, and to the creation, closing, and deletion of graphics segments.
With the exception of the viewing transformation and the segment attributes, the default values of these attributes apply to all primitive-drawing that occurs outside a segment bracket.
Note: In the last two functions here, the foreground-mix value is always set to FM_XOR, and the background-mix value is always set to BM_LEAVEALONE.