Subversion Repositories Kolibri OS

Rev

Rev 1079 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
8341 dunkaist 1
;;================================================================================================;;
2
;;//// gif.inc //// (c) mike.dld, 2007-2008 //////////////////////////////////////////////////////;;
3
;;================================================================================================;;
4
;;                                                                                                ;;
5
;; This file is part of Common development libraries (Libs-Dev).                                  ;;
6
;;                                                                                                ;;
7
;; Libs-Dev is free software: you can redistribute it and/or modify it under the terms of the GNU ;;
8
;; Lesser General Public License as published by the Free Software Foundation, either version 2.1 ;;
9
;; of the License, or (at your option) any later version.                                         ;;
10
;;                                                                                                ;;
11
;; Libs-Dev is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without  ;;
12
;; even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU  ;;
13
;; Lesser General Public License for more details.                                                ;;
14
;;                                                                                                ;;
15
;; You should have received a copy of the GNU Lesser General Public License along with Libs-Dev.  ;;
16
;; If not, see .                                                    ;;
17
;;                                                                                                ;;
18
;;================================================================================================;;
19
 
20
 
21
struct gif.FileHeader ; GIF87a
22
  Signature	  db 3 dup(?) ; Header Signature (always "GIF")
23
  Version	  db 3 dup(?) ; GIF format version("87a" or "89a")
24
ends
25
 
26
struct gif.LogicalScreenDescriptor ; GIF87a
27
  ScreenWidth	  dw ?	      ; Width of Display Screen in Pixels
28
  ScreenHeight	  dw ?	      ; Height of Display Screen in Pixels
29
  Packed	  db ?	      ; Screen and Color Map Information
30
  BackgroundColor db ?	      ; Background Color Index
31
  AspectRatio	  db ?	      ; Pixel Aspect Ratio
32
ends
33
 
34
gif.LSD.Packed.SizeOfGlobalColorTableMask  = 000000111b
35
gif.LSD.Packed.SizeOfGlobalColorTableShift = 0
36
gif.LSD.Packed.ColorTableSortFlag	   = 000001000b
37
gif.LSD.Packed.ColorTableSortShift	   = 3
38
gif.LSD.Packed.ColorResolutionMask	   = 001110000b
39
gif.LSD.Packed.ColorResolutionShift	   = 4
40
gif.LSD.Packed.GlobalColorTableFlag	   = 010000000b
41
gif.LSD.Packed.GlobalColorTableShift	   = 7
42
 
43
struct gif.Header
44
  file gif.FileHeader
45
  lsd  gif.LogicalScreenDescriptor
46
ends
47
 
48
struct gif.RgbTriplet ; GIF87a
49
  Red	db ? ; Red Color Element
50
  Green db ? ; Green Color Element
51
  Blue	db ? ; Blue Color Element
52
ends
53
 
54
struct gif.Block
55
  Introducer db ?
56
ends
57
 
58
gif.Block.Introducer.EndOfData	     = 0x00
59
gif.Block.Introducer.Extension	     = 0x21
60
gif.Block.Introducer.ImageDescriptor = 0x2C
61
gif.Block.Introducer.EndOfFile	     = 0x3B
62
 
63
struct gif.ImageDescriptor ; GIF87a
64
; we read Introducer before parsing gif.ImageDescriptor,
65
; so it is convenient to not include it in struct
66
;  b	     gif.Block ; Introducer = 2Ch (',')
67
  Left	     dw ?      ; X position of image on the display
68
  Top	     dw ?      ; Y position of image on the display
69
  Width      dw ?      ; Width of the image in pixels
70
  Height     dw ?      ; Height of the image in pixels
71
  Packed     db ?      ; Image and Color Table Data Information
72
ends
73
 
74
gif.ID.Packed.SizeOfLocalColorTableMask  = 000000111b
75
gif.ID.Packed.SizeOfLocalColorTableShift = 0
76
gif.ID.Packed.SortFlag			 = 000100000b
77
gif.ID.Packed.SortShift 		 = 5
78
gif.ID.Packed.InterleaceFlag		 = 001000000b
79
gif.ID.Packed.InterleaceShift		 = 6
80
gif.ID.Packed.LocalColorTableFlag	 = 010000000b
81
gif.ID.Packed.LocalColorTableShift	 = 7
82
 
83
struct gif.Extension
84
  b	     gif.Block ; Introducer = 21h ('|')
85
  Label      db ?      ; Extension label
86
ends
87
 
88
gif.Extension.Label.PlainText	    = 0x01
89
gif.Extension.Label.GraphicsControl = 0xF9
90
gif.Extension.Label.Comment	    = 0xFE
91
gif.Extension.Label.Application     = 0xFF
92
 
93
struct gif.PlainTextExtension ; GIF89a
94
;  e		   gif.Extension ; Label = 01h
95
;  BlockSize	   db ? 	 ; Size of Extension Block (always 0Ch)
96
  TextGridLeft	   dw ? 	 ; X position of text grid in pixels
97
  TextGridTop	   dw ? 	 ; Y position of text grid in pixels
98
  TextGridWidth    dw ? 	 ; Width of the text grid in pixels
99
  TextGridHeight   dw ? 	 ; Height of the text grid in pixels
100
  CellWidth	   db ? 	 ; Width of a grid cell in pixels
101
  CellHeight	   db ? 	 ; Height of a grid cell in pixels
102
  TextFgColorIndex db ? 	 ; Text foreground color index value
103
  TextBgColorIndex db ? 	 ; Text background color index value
104
  PlainTextData    db ? 	 ; The Plain Text data (*)
105
; Terminator       db ?          ; Block Terminator (always 0)
106
ends
107
 
108
struct gif.GraphicsControlExtension ; GIF89a
109
;  e	     gif.Extension ; Label = F9h
110
;  BlockSize  db ?	   ; Size of remaining fields (always 04h)
111
; previous fields are not included in this structure for convenience
112
; (they are parsed before this)
113
  Packed     db ?	   ; Method of graphics disposal to use
114
  DelayTime  dw ?	   ; Hundredths of seconds to wait
115
  ColorIndex db ?	   ; Transparent Color Index
116
; Terminator db ?          ; Block Terminator (always 0)
117
ends
118
 
119
struct gif.CommentExtension ; GIF89a
120
  e	      gif.Extension ; Label = FEh
121
  CommentData db ?	    ; Pointer to Comment Data sub-blocks (*)
122
; Terminator  db ?          ; Block Terminator (always 0)
123
ends
124
 
125
struct gif.ApplicationExtension ; GIF89a
126
  e		  gif.Extension ; Label = FFh
127
  BlockSize	  db ?		; Size of Extension Block (always 0Bh)
128
  Identifier	  db 8 dup(?)	; Application Identifier
129
  AuthentCode	  db 3 dup(?)	; Application Authentication Code
130
  ApplicationData db ?		; Point to Application Data sub-blocks (*)
131
; Terminator      db ?          ; Block Terminator (always 0)
132
ends
133
 
134
;;------------------------------------------------------------------------------------------------;;
135
 
136
struct gif.Image
137
  info gif.ImageDescriptor
138
  gce  gif.GraphicsControlExtension
139
;  lsd  gif.LogicalScreenDescriptor ; saved only in first image
140
ends
141
 
142
gif.Null equ 0x1000