加载中…
个人资料
LMCD
LMCD
  • 博客等级:
  • 博客积分:0
  • 博客访问:48,020
  • 关注人气:1
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
相关博文
推荐博文
正文 字体大小:

GIM文件格式结构

(2018-01-23 13:11:36)
标签:

it

分类: 技术
GIM 图像格式
65.MIG GIM的结构
GIM := Header RootBlock
RootBlock := RootHeader (ImageBlock | CommentBlock)+
ImageBlock := ImageHeader (PaletteBlock BitmapBlock | BitmapBlock PaletteBlock)
PaletteBlock := PaletteHeader PaletteData+
BitmapBlock := BitmapHeader BitmapData
每块按4字节对齐文件头
Header 00h
16 String Identifier "MIG.00.1PSP" 00 00 00 00 00 块头
BlockHeader
2 UInt16 BlockType 02 00
块类型
2 UInt16 ? 00 00 / 10 00
4 Int32 BlockLength 70 92 14 00
块大小,包括头、数据和所有子块
4 Int32 ContentLength 10 00 00 00
内容大小,包括头、数据,不包括子块
4 Int32 BaseAddressForData 10 00 00 00
数据基址,相对于块起始地址
根块头
RootHeader 10h
2 UInt16 BlockType2 02 00
2 UInt16 ? 00 00 / 10 00
4 Int32 BlockLength(全文件-10h) 70 92 14 00
4 Int32 ContentLength 10 00 00 00
4 Int32 BaseAddressForData 10 00 00 00 图像块头
ImageHeader 20h
2 UInt16 BlockType3 03 00
2 UInt16 ? 00 00 / 10 00
4 Int32 BlockLength B0 02 02 00
4 Int32 ContentLength 10 00 00 00
4 Int32 BaseAddressForData 10 00 00 00 调色块头
PaletteHeader 30h
2 UInt16 BlockType5 05 00
2 UInt16 ? 00 00 / 10 00
4 Int32 BlockLength 50 04 00 00
4 Int32 ContentLength 50 04 00 00
4 Int32 BaseAddressForData 10 00 00 00
+00h
4 Int32 ? 30 00 00 00
2 UInt16 Type 03 00
0 - B5G6R5
1 - A1B5G5R5
2 - A4B4G4R4
3 - A8B8G8R8
2 UInt16 ? 00 00
2 UInt16 NumColor 00 01
2 UInt16 ? 01 00
2 UInt16 ? 20 00
2 UInt16 ? 10 00
+10h
2 UInt16 ? 01 00
2 UInt16 ? 02 00
4 Int32 ? 00 00 00 00
4 Int32 AddressStart 30 00 00 00
4 Int32 PaletteStart 40 00 00 00
相对于BaseAddressForData
+20h
4 Int32 PaletteEnd 40 04 00 00
4 Int32 ? 00 00 00 00
2 UInt16 ? 02 00
2 UInt16 ? 01 00
2 UInt16 ? 03 00
2 UInt16 NumFrame 01 00
+30h
AddressStart:
(
4 Int32 PaletteAddress 40 00 00 00
指向的调色板数据地址,可以有多帧指向同一块数据
){NumFrame}
PaletteStart:
(
.. .. Color 00 ..
){*}
16字节对齐调色块数据
PaletteData 80h
(
(
4 Int32 RGBA 00 00 00 FF ..
注意:这里不是常用的BGRA排列。
){NumColor}
)+ 位图块
BitmapBlock 480h
2 UInt16 BlockType4 04 00
2 UInt16 ? 00 00 / 10 00
4 Int32 BlockLength 50 FE 01 00
4 Int32 ContentLength 50 FE 01 00
4 Int32 BaseAddressForData 10 00 00 00
+00h
4 Int32 ? 30 00 00 00
2 UInt16 Type 05 00
0 - B5G6R5
1 - A1B5G5R5
2 - A4B4G4R4
3 - A8B8G8R8
4 - Index4
5 - Index8
6 - Index16
7 - Index32
8 - DXT1
9 - DXT3
10 - DXT5
264 - DXT1Ext
265 - DXT3Ext
266 - DXT5Ext
2 UInt16 ? 01 00
2 UInt16 Width E0 01
2 UInt16 Height 10 01
2 UInt16 BitsPerPixel 08 00
2 UInt16 RectangleByteWidth 10 00
绘图小块的字节宽度
对于8bpp的图像,字节宽度为16,表示宽度为16
对于4bpp的图像,字节宽度为16,表示宽度为32
+10h
2 UInt16 RectangleHeight 08 00
2 UInt16 ? 02 00
4 Int32 ? 00 00 00 00
4 Int32 AddressStart 30 00 00 00
4 Int32 BitmapStart 40 00 00 00
相对于BaseAddressForData
+20h
4 Int32 BitmapEnd 40 FE 01 00
4 Int32 ? 00 00 00 00
2 UInt16 ? 01 00
2 UInt16 ? 01 00
2 UInt16 ? 03 00
2 UInt16 NumFrame 01 00
+30h
AddressStart:
(
4 Int32 BitmapAddress 40 00 00 00
指向的位图数据地址
注意位图可能是一个块一个块的,比如16x8的块
块分布,从左到右,从上到下
){NumFrame}
16字节对齐
BitmapStart:
(
.. .. Pixel 00 ..
){*} 注释块
CommentBlock
2 UInt16 BlockType4 FF 00
2 UInt16 ? 00 00 / 10 00
4 Int32 BlockLength 58 00 00 00
4 Int32 ContentLength 58 00 00 00
4 Int32 BaseAddressForData 10 00 00 00
+00h
* String Shift-JIS String

0

阅读 评论 收藏 转载 喜欢 打印举报/Report
  • 评论加载中,请稍候...
发评论

    发评论

    以上网友发言只代表其个人观点,不代表新浪网的观点或立场。

      

    新浪BLOG意见反馈留言板 电话:4000520066 提示音后按1键(按当地市话标准计费) 欢迎批评指正

    新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 会员注册 | 产品答疑

    新浪公司 版权所有