A graphics order is a low-level graphics command that corresponds to a primitive function or attribute. In addition to code and data requirements, each graphics order uses approximately 11 bytes of storage. An application that uses 2000 graphics drawing orders will use around 22KB of memory to store them. The following table describes the four sizes of graphics orders.
Graphics Orders
┌────────────────────────┬────────────────────────────────────┐ │Graphics Order Size │Content │ ├────────────────────────┼────────────────────────────────────┤ │1 byte │A hexadecimal identifier │ │ │corresponding to a drawing function │ │ │or attribute function. This │ │ │identifier is also known as the │ │ │order code. │ ├────────────────────────┼────────────────────────────────────┤ │2 byte │The order code is in the first byte,│ │ │and data is in the second byte. │ ├────────────────────────┼────────────────────────────────────┤ │Long │The order code is in the first byte.│ │ │ │ │ │The length value of the actual data,│ │ │in bytes, is in the second byte. │ │ │ │ │ │The actual data (up to 255 bytes). │ ├────────────────────────┼────────────────────────────────────┤ │Very long │A hexadecimal identifier │ │(maximum length of 64KB)│specifically for extended orders, is│ │ │in the first byte. │ │ │ │ │ │The order code is in the second │ │ │byte. │ │ │ │ │ │A length value that specifies how │ │ │many bytes are used by the │ │ │graphics-order arguments, (high │ │ │order) is in the third byte. │ │ │ │ │ │A length value that specifies how │ │ │many bytes are used by the │ │ │graphics-order arguments, (low │ │ │order) is in the fourth byte. │ │ │ │ │ │The actual data. │ └────────────────────────┴────────────────────────────────────┘
The following example shows a long graphics order that corresponds to GpiLine:
81 8 100 0 0 0 100 0 0 0
The first number, 81, is the hexadecimal identifier that corresponds to GpiLine. The second number, 8, is the length value that specifies how many bytes are used by the graphics-order arguments. The next eight bytes contain the arguments for GpiLine. In this case, the arguments specify the line's end point at (100,100).
Graphics Segment │ ┌──────────────────────┐ ┌── 0x21 ┼────────── order # ──┐ │ │ │ 0x08 ┼────────── length │ │ ptl.x = 100L; │ │ 0x00 │ ────┐ │ │ ptl.y = 100L; │ │ 0x00 │ ├── x │ │ GpiMove (hps, &ptl); ┼──┘ 0x10 │ │ ├── element │ ptl.x = 200L; │ 0x00 │ ────┘ │ │ ptl.y = 400L; │ 0x00 │ ────┐ │ │ GpiMove (hps, &ptl); ┼──┐ 0x00 │ ├── y │ │ │ │ 0x20 │ │ │ └──────────────────────┘ │ 0x00 │ ────┘ ──┘ └── 0x81 ┼────────── order # ──┐ 0x08 ┼────────── length │ 0x00 │ ────┐ │ 0x00 │ ├── x │ 0x30 │ │ ├── element 0x00 │ ────┘ │ 0x00 │ ────┐ │ 0x00 │ ├── y │ 0x40 │ │ │ 0x00 │ ────┘ ──┘ │
Graphics Orders
The encoding that appears in the Graphics Segments column is a hexadecimal version of the order, length, and parameter information.
In most cases, graphics orders in a segment correspond to a subpicture, which is part of a complete, more complex picture. Your application would combine the individual segments to form the complete picture.
Three drawing modes affect how the operating system stores graphics orders in segments. These modes are described in the following table. The default drawing mode is draw (DM_DRAW). To specify another as the current drawing mode, use GpiSetDrawingMode.
The actual drawing mode is a combination of the drawing mode as set using GpiSetDrawingMode, and the segment status-chained, unchained, or outside of the segment. The actual drawing mode does not affect the storing of orders in segments.
Segment Graphics Drawing Modes
┌──────────────────┬──────────────────┬────────────────────────┐ │Drawing Mode │GpiSetDrawingMode │When this mode is set...│ │ │Value │ │ ├──────────────────┼──────────────────┼────────────────────────┤ │Draw │DM_DRAW │it is not possible to │ │ │ │store graphics orders in│ │ │ │a chained segment. │ ├──────────────────┼──────────────────┼────────────────────────┤ │Retain │DM_RETAIN │your application can │ │ │ │store graphics orders in│ │ │ │chained and unchained │ │ │ │segments. │ ├──────────────────┼──────────────────┼────────────────────────┤ │Draw-and-retain │DM_DRAWANDRETAIN │your application can │ │ │ │store graphics orders in│ │ │ │chained and unchained │ │ │ │segments. In this mode,│ │ │ │output intended for a │ │ │ │chained segment is both │ │ │ │drawn on the device and │ │ │ │stored in a segment. │ └──────────────────┴──────────────────┴────────────────────────┘