1、INCITS/ISO/IEC 9637-2-1992 (R1999)(formerly ANSI/ISO/IEC 9637-2-1992 (R1999) for Information Technology -Computer Graphics -Interfacing Techniquesfor Dialogues withGraphical Devices (CGI) -Data Stream Binding -Part 2: Binary EncodingAmericanNationalStandardApproval of an American National Standard r
2、equires review by ANSI that therequirements for due process, consensus, and other criteria for approval havebeen met by the standards developer.Consensus is established when, in the judgment of the ANSI Board of StandardsReview, substantial agreement has been reached by directly and materiallyaffect
3、ed interests. Substantial agreement means much more than a simplemajority, but not necessarily unanimity. Consensus requires that all views andobjections be considered, and that a concerted effort be made toward theirresolution.The use of American National Standards is completely voluntary; their ex
4、istencedoes not in any respect preclude anyone, whether he has approved the standardsor not, from manufacturing, marketing, purchasing, or using products, processes,or procedures not conforming to the standards.The American National Standards Institute does not develop standards and will inno circum
5、stances give an interpretation of any American National Standard.Moreover, no person shall have the right or authority to issue an interpretation ofan American National Standard in the name of the American National StandardsInstitute. Requests for interpretations should be addressed to the secretari
6、at orsponsor whose name appears on the title page of this standard.CAUTION NOTICE: This American National Standard may be revised orwithdrawn at any time. The procedures of the American National StandardsInstitute require that action be taken periodically to reaffirm, revise, or withdrawthis standar
7、d. Purchasers of American National Standards may receive currentinformation on all standards by calling or writing the American National StandardsInstitute.Published byAmerican National Standards Institute11 West 42nd Street, New York, New York 10036Copyright 1992 by Information Technology Industry
8、Council (ITI)All rights reserved.These materials are subject to copyright claims of International Standardization Organization (ISO),International Electrotechnical Commission (IEC), American National Standards Institute (ANSI), andInformation Technology Industry Council (ITI). Not for resale. No par
9、t of this publication may bereproduced in any form, including an electronic retrieval system, without the prior written permission of ITI.All requests pertaining to this standard should be submitted to ITI, 1250 Eye Street NW, Washington, DC20005.Printed in the United States of AmericaANSI/ISO/IEC 9
10、637-2-l 992 American National Standard for Information Technology - Computer Graphics - Interfacing Techniques for Dialogues with Graphical Devices (CGI) - Data Stream Binding - Part 2: Binary Encoding Secretariat Computer and Business Equipment Manufacturers Association Approved July 18, 1994 Ameri
11、can National Standards Institute, Inc. CONTENTS Foreword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . * 1 Scope . . . . . . . . . . . . . . . . . . . . . . . . . . 2 Normative References . . , . . . . . . . . , . . . .
12、 . . . . . . . 2 3 Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 4 Overall structure . . . , . . . . . . . . . . . . . . . . 4.1 General form of the data stream . . . . . . . . . . . 4.2 General structure of the Binary Encoding . . . . . . 4.3 Encoding functions . . . . . . . .
13、 . . . . . . . . . 4.3.1 General structure of the representation header 4.3.2 Basic short-form representation header . . . . 4.3.3 Basic long-form representation header . . . . 4.3.4 Extended-form representation header . . . . . 4.4 Encoding parameter data , . . . . . . . . . . . . . . 4.5 Encoding
14、function response data . . . . . . . . . . . 4 5 Binary 5.1 s i 5 5 5 5.1 Structure of response representations Encoding primitive data forms . gned Integer . 1.1 Signed Integer at 8-bit precision 1.2 Signed Integer at Is-bit precision 1.3 Signed Integer at 24-bit precision . . . . . . . . . . . . .
15、 . . . . . . * . . . . . * . . . . . . . . . . . . . . . . . . 5.1.4 Signed Integer at 32-bit precision 5.2 Unsigned Integer Unsigned Integer at 8-bit precision . Unsigned Integer at Is-bit precision . Unsigned Integer at 24-bit precision . Unsigned Integer at 32-bit precision . 5.2.1 5.2.2 5.2.3 5.
16、2.4 5.3 Octet 5.4 Fixed 5.4.1 5.4.2 5.4.3 5.5 Float . . . . . . * . . . . . . . . . * . . . . . Poini Real Fixed Point Fixed Point Values of F ing Point Rea Real at 32-bit precision . Real at 64-bit precision . ixed Point Real 1 . . . . . . . . . . . . . . . . . . . . . Page iv vii 1 5 5 5 7 7 8 8 1
17、0 12 12 13 14 14 15 15 15 15 16 16 16 16 16 17 17 17 17 18 18 6 Representation of abstract parameter data types . 19 6.1 Special Binary Encoding rules 24 6.1.1 Encoding the precision functions . 24 6.1.1.1 Binary Encoding precision functions 25 6.1.2 Encoding strings, fixed strings, and data records
18、. 28 6.1.2.1 Encoding data record contents . 29 6.1.2.2 String parameters and character sets 30 6.1.3 Encoding input functions 31 6.1.: INHERITANCE FILTER enumerated values . 31 6.1.5 Encoding point lists . 33 6.1.6 Encoding transformation matrix components 34 6.1.7 Encoding local colour precision 6
19、,1.7-l Encoding CELL ARRAY and PATTERNTABLE * 34 local colour precision . 35 6.1.7.2 Encoding PIXEL ARRAY local colour precision . . 35 6.1.8 Colour specifier lists 36 6.1.8.1 Encoding colour specifier lists 6.1.8.2 Encoding lists of input colour vaiuesand local 37 37 colour precision 38 6.1.9 Encod
20、ing PATTERN TABLE and INQUIRE PATTERN colour specifiers. 38 7 Representation of each function and response . 39 7.1 Dpcode assignments . 39 7.1.1 Class code assignments 39 7.1.2 Function id code assignments . 41 8 Defaults. 62 9 Classification and designation 63 9.1 Conformance . 63 A Algorithms and
21、 rules for class code assignment 64 B Encoding exaxnpleti . 66 iii Foreword (This foreword is not part of American National Standard ANSI/ISO/IEC 9637- 2-1992. This document is identical to ISOllEC 9637-2-1992 and the following five paragraphs are the original foreword as it appeared in that documen
22、t.) IS0 (the International Organization for Standardization) and IEC (the International Electrotechnical Commission) form the specialized system for worldwide standardization. National bodies that are members of IS0 or IEC participate in the development of International Standards through technical c
23、ommittees established by the respective organization to deal with particular fields of technical activity. IS0 and IEC technical commit- tees collaborate in fields of mutual interest. Other international organiza- tions, governmental and non-governmental, in liaison with IS0 and IEC, also take part
24、in the work. In the field of information technology, IS0 and IEC have established a joint technical committee, ISO/IEC JTC 1. Draft International Standards adopt- ed by the joint technical committee are circulated to national bodies for voting. Publication as an International Standard requires appro
25、val by at least 75% of the national bodies casting a vote. International Standard ISO/IEC 9637-2 was prepared by Joint Technical Committee ISO/IEC JTC 1, Information technology. ISO/IEC 9637 consists of the following parts, under the general title information technology - Computer graphics - interfa
26、cing techniques for dialogues with graphical devices (CGI) - Data stream binding - Part 7: Character encoding - Part 2: Binary encoding Annex A forms an integral part of this part of ISO/IEC 9637. Annex B is for information only. Requests for interpretation, suggestions for improvement or addenda, o
27、r defect reports are welcome. They should be sent to the X3 Secretariat, Computer and Business Equipment Manufacturers Association, 1250 Eye Street, NW, Suite 200, Washington, DC 20005. This standard was processed and approved for submittal to ANSI by Accredited Standards Committee on Information Pr
28、ocessing Systems, X3. Committee approval of the standard does not necessarily imply that all committee members voted for its approval. At the time it approved this standard, the X3 Committee had the following members: James D. Converse, Chair Donald C. Loughry, Vice-Chair Joanne Flanagan, Secretary
29、Organization Represented Name of Representative American Nuclear Society . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Geraldine C. Main Sally Hartzell (Alt.) AMP, Inc. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
30、 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Edward Kelly Charles Brill (Alt.) Apple Computer, Inc. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Karen Higginbottom AT the first (or only) partition of a repre
31、sentation contains the opcode (class code and id code); Alignment of function representations and response representations: every function/response representation begins on a Is-bit boundary. Alignment of representations which follow partitions that require an odd number of a-bit entities may requir
32、e a partition to be padded with an a-bit entity with all bits zero; Uniformity of format: all function representations and response data records have an associated parameter length value. As a result, it is possible to ignore function representations which are not supported by the interpreter; Effic
33、iency of encoding parameter data: parameter data such as coordinates, indexes and colours are encoded as one or more a-bit entities. The precision of every parameter is determined by the appropriate default precision or as set by a precision setting CC1 function; vii ISO/IEC 9637-2:1992 (E) lSO/IEC
34、d f) g) h) i) j) k) Extensibility: the arrangement of opcode class and id values has been designed to allow future growth; Format of real data: real numbers are encoded using either IEEE floating point representation or a fixed-point representation; Run length encoding option: if many adjacent colou
35、rs have the same value, efficient encoding is possible. For each run a cell count is specified followed by the colour (or colour index); Packed list encoding option: if adjacent colours do not have the same value, bit-stream lists are provided in which the values are packed as closely as possible; E
36、ncoding of soliciting functions: the assignment of opcodes to functions which require a response has been designed so that all such functions can be recognized by a CC1 interpreter; Response Data: responses to soliciting functions have been assigned different opcodes from their associated soliciting
37、 functions. However, the response opcode can be derived in a straightforward manner from the soliciting function opcode; Lists of data: there is a standard technique for representing lists of any type of data (with a few specific exceptions); This encoding is guided by the same objectives as the Com
38、puter Graphics Metafile Binary Encoding, ISO/IEC 8632-3:1992. For each CGI function which is identical in both semantics and parameterization to a CGM element, the encoding will be identical. That is, the opcodes will be identical and the parameters will use the same data type and appear in the same
39、 order. The extension mechanism defined in this- - - - ISO/IEC 9637-2:1992 (E) lSO/IEC 3 Definitions 3.1 representation: Portion of a binary-encoded function or response representation that contains the opcode (function/response class plus function/response id) and parameter length information. (See
40、 4.3.4.) 3.2 octet: - the short-form representation only accommodates parameter list data up to 30 octets in length. The long-form representation accommodates lengths up to 32767 octets per data partition with an indefinite number of partitions. - the basic form representations accommodate only 14 f
41、unction classes and 127 function ids. The extended form representations accommodate an unlimited number of function classes and function ids. 7 ISO/IEC 9637-2:1992 (E) Overall strut ture lSO/IEC Encoding functions The representation forms also differ in the There are specific fields, unique to each
42、identify the type of representation header. function opcode (function class and function encoded. format of the representation headers. type of representation header, that There are also differences in how the id) and the parameter list length are 4.3.2 Basic short-form representation header For the
43、 basic short-form, the representation header consists of a single word divided into three fields: function class, function id and parameter list length. 15 14 13 12 11 10 9 a 7 6 5 4 3 2 1 0 Word 1 1 func. class 1 function id 1 parm list len 1 Figure 2 - Format of a basic short-form representation h
44、eader. The fields in the basic short-form representation header are as follows: bits 15-12 function class (value range O-14) bits II-5 function id (value range O-127) bits 4-0 parameter list length: the number of octets of parameter data that follow for this command (value range O-30) 4.3.3 Basic lo
45、ng-form representation header The representation header of the basic long-form representation consists of two words. The first word of the basic long-form representation has the same structure as the first word of the basic short-form representation with the difference that the parameter list length
46、 field contains the binary value 11111 (decimal 31). This value indicates that the header is a basic long-form representation header rather than a basic short-form representation header. The second word contains the length of the following parameter data partition and a flag that indicates if the pa
47、rameter data partition is followed by another data partition or not. lSO/IEC ISO/IEC 9637-2:1992 (E) Encoding functions Overall structure An indefinite number of parameter partitions can be accommodated by the long-form representation. When the partition flag, bit 15 of the second word of the header
48、 has the value I, it indicates that there wi 11 be another parameter data partition to follow. Each subsequent data partition of the function representation is preceded by a word composed of a partition flag and the partitions parameter list length in the same format as the second word of the repres
49、entation header. The final data partition of a function representation is indicated by the partition flag being set to zero. The parameter list length supplied in each of the parameter data partitions specifies the length of that partition in octets and not the length of the complete function representation data. Partitions need not start on a word boundary, therefore no padding octet needs to be appended to the data in a data partition which contains an odd number of octets for its parameter list length. 15 14 13 12 11 10 9 3 7 6 5 4 3 2 1 0 Word I func class I func