📄 gif89.txt
字号:
+- -+ 4 | | +---------------+ 5 | | Text Grid Width Unsigned +- -+ 6 | | +---------------+ 7 | | Text Grid Height Unsigned +- -+ 8 | | +---------------+ 9 | | Character Cell Width Byte +---------------+ 10 | | Character Cell Height Byte +---------------+ 11 | | Text Foreground Color Index Byte +---------------+ 12 | | Text Background Color Index Byte +---------------+ +===============+ | | N | | Plain Text Data Data Sub-blocks | | +===============+ +---------------+ 0 | | Block Terminator Byte +---------------+ i) Extension Introducer - Identifies the beginning of an extension block. This field contains the fixed value 0x21. ii) Plain Text Label - Identifies the current block as a Plain Text Extension. This field contains the fixed value 0x01. iii) Block Size - Number of bytes in the extension, after the Block Size field and up to but not including the beginning of the data portion. This field contains the fixed value 12. 21 iv) Text Grid Left Position - Column number, in pixels, of the left edge of the text grid, with respect to the left edge of the Logical Screen. v) Text Grid Top Position - Row number, in pixels, of the top edge of the text grid, with respect to the top edge of the Logical Screen. vi) Image Grid Width - Width of the text grid in pixels. vii) Image Grid Height - Height of the text grid in pixels. viii) Character Cell Width - Width, in pixels, of each cell in the grid. ix) Character Cell Height - Height, in pixels, of each cell in the grid. x) Text Foreground Color Index - Index into the Global Color Table to be used to render the text foreground. xi) Text Background Color Index - Index into the Global Color Table to be used to render the text background. xii) Plain Text Data - Sequence of sub-blocks, each of size at most 255 bytes and at least 1 byte, with the size in a byte preceding the data. The end of the sequence is marked by the Block Terminator. xiii) Block Terminator - This zero-length data block marks the end of the Plain Text Data Blocks. d. Extensions and Scope. The scope of this block is the Plain Text Data Block contained in it. This block may be modified by the Graphic Control Extension. e. Recommendations. The data in the Plain Text Extension is assumed to be preformatted. The selection of font and size is left to the discretion of the decoder. If characters less than 0x20 or greater than 0xf7 are encountered, it is recommended that the decoder display a Space character (0x20). The encoder should use grid and cell dimensions such that an integral number of cells fit in the grid both horizontally as well as vertically. For broadest compatibility, character cell dimensions should be around 8x8 or 8x16 (width x height); consider an image for unusual sized text.26. Application Extension. a. Description. The Application Extension contains application-specific information; it conforms with the extension block syntax, as described below, and its block label is 0xFF. b. Required Version. 89a. 22 c. Syntax. 7 6 5 4 3 2 1 0 Field Name Type +---------------+ 0 | | Extension Introducer Byte +---------------+ 1 | | Extension Label Byte +---------------+ +---------------+ 0 | | Block Size Byte +---------------+ 1 | | +- -+ 2 | | +- -+ 3 | | Application Identifier 8 Bytes +- -+ 4 | | +- -+ 5 | | +- -+ 6 | | +- -+ 7 | | +- -+ 8 | | +---------------+ 9 | | +- -+ 10 | | Appl. Authentication Code 3 Bytes +- -+ 11 | | +---------------+ +===============+ | | | | Application Data Data Sub-blocks | | | | +===============+ +---------------+ 0 | | Block Terminator Byte +---------------+ i) Extension Introducer - Defines this block as an extension. This field contains the fixed value 0x21. ii) Application Extension Label - Identifies the block as an Application Extension. This field contains the fixed value 0xFF. iii) Block Size - Number of bytes in this extension block, following the Block Size field, up to but not including the beginning of the Application Data. This field contains the fixed value 11. 23 iv) Application Identifier - Sequence of eight printable ASCII characters used to identify the application owning the Application Extension. v) Application Authentication Code - Sequence of three bytes used to authenticate the Application Identifier. An Application program may use an algorithm to compute a binary code that uniquely identifies it as the application owning the Application Extension. d. Extensions and Scope. This block does not have scope. This block cannot be modified by any extension. e. Recommendation. None.27. Trailer. a. Description. This block is a single-field block indicating the end of the GIF Data Stream. It contains the fixed value 0x3B. b. Required Version. 87a. c. Syntax. 7 6 5 4 3 2 1 0 Field Name Type +---------------+ 0 | | GIF Trailer Byte +---------------+ d. Extensions and Scope. This block does not have scope, it terminates the GIF Data Stream. This block may not be modified by any extension. e. Recommendations. None. 24AppendixA. Quick Reference Table.Block Name Required Label Ext. Vers.Application Extension Opt. (*) 0xFF (255) yes 89aComment Extension Opt. (*) 0xFE (254) yes 89aGlobal Color Table Opt. (1) none no 87aGraphic Control Extension Opt. (*) 0xF9 (249) yes 89aHeader Req. (1) none no N/AImage Descriptor Opt. (*) 0x2C (044) no 87a (89a)Local Color Table Opt. (*) none no 87aLogical Screen Descriptor Req. (1) none no 87a (89a)Plain Text Extension Opt. (*) 0x01 (001) yes 89aTrailer Req. (1) 0x3B (059) no 87aUnlabeled BlocksHeader Req. (1) none no N/ALogical Screen Descriptor Req. (1) none no 87a (89a)Global Color Table Opt. (1) none no 87aLocal Color Table Opt. (*) none no 87aGraphic-Rendering BlocksPlain Text Extension Opt. (*) 0x01 (001) yes 89aImage Descriptor Opt. (*) 0x2C (044) no 87a (89a)Control BlocksGraphic Control Extension Opt. (*) 0xF9 (249) yes 89aSpecial Purpose BlocksTrailer Req. (1) 0x3B (059) no 87aComment Extension Opt. (*) 0xFE (254) yes 89aApplication Extension Opt. (*) 0xFF (255) yes 89alegend: (1) if present, at most one occurrence (*) zero or more occurrences (+) one or more occurrencesNotes : The Header is not subject to Version Numbers.(89a) The Logical Screen Descriptor and the Image Descriptor retained theirsyntax from version 87a to version 89a, but some fields reserved under version87a are used under version 89a. 25AppendixB. GIF Grammar.A Grammar is a form of notation to represent the sequence in which certainobjects form larger objects. A grammar is also used to represent the number ofobjects that can occur at a given position. The grammar given here representsthe sequence of blocks that form the GIF Data Stream. A grammar is given bylisting its rules. Each rule consists of the left-hand side, followed by someform of equals sign, followed by the right-hand side. In a rule, theright-hand side describes how the left-hand side is defined. The right-handside consists of a sequence of entities, with the possible presence of specialsymbols. The following legend defines the symbols used in this grammar for GIF.Legend: <> grammar word ::= defines symbol * zero or more occurrences + one or more occurrences | alternate element [] optional elementExample:<GIF Data Stream> ::= Header <Logical Screen> <Data>* TrailerThis rule defines the entity <GIF Data Stream> as follows. It must begin with aHeader. The Header is followed by an entity called Logical Screen, which isdefined below by another rule. The Logical Screen is followed by the entityData, which is also defined below by another rule. Finally, the entity Data isfollowed by the Trailer. Since there is no rule defining the Header or theTrailer, this means that these blocks are defined in the document. The entityData has a special symbol (*) following it which means that, at this position,the entity Data may be repeated any number of times, including 0 times. Forfurther reading on this subject, refer to a standard text on ProgrammingLanguages.The Grammar.<GIF Data Stream> ::= Header <Logical Screen> <Data>* Trailer<Logical Screen> ::= Logical Screen Descriptor [Global Color Table]<Data> ::= <Graphic Block> | <Special-Purpose Block><Graphic Block> ::= [Graphic Control Extension] <Graphic-Rendering Block><Graphic-Rendering Block> ::= <Table-Based Image> | Plain Text Extension<Table-Based Image> ::= Image Descriptor [Local Color Table] Image Data<Special-Purpose Block> ::= Application Extension | Comment Extension 26NOTE : The grammar indicates that it is possible for a GIF Data Stream tocontain the Header, the Logical Screen Descriptor, a Global Color Table and theGIF Trailer. This special case is used to load a GIF decoder with a GlobalColor Table, in preparation for subsequent Data Streams without color table
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -