请选择 进入手机版 | 继续访问电脑版

 找回密码
 点一下
查看: 2744|回复: 1

BLP FileType

  [复制链接]
发表于 2010-2-25 09:27:17 | 显示全部楼层 |阅读模式
BLP的一篇技术文档
对会C C++ C# Java 的想开发BLP View、Convert的人来说很有用
编程盲 E文盲们请无视了


The BLP file contain the JPEG header and the JPEG raw data separated.
BLP stands for "Blip" file which I guess is a "BLIzzard Picture".
There are two types of BLPs:
- JPG-BLPs: use JPG compression
- Paletted BLPs: use palettes and 1 or 2 bytes per pixel depending

The general format of JPG-BLPs:


Code:



  1. Header:
  2. char[4]: file ID ("BLP1")
  3. int: 0 for JPG-BLP, 1 for Paletted
  4. int: 0x00000008 = has alpha, 0x00000000 = no alpha
  5. int: image width
  6. int: image height
  7. int: flag for alpha channel and team colors (usually 3, 4 or 5), 3 and 4 means color and alpha information for paletted files,
  8. 5 means only color information, if >=5 on 'unit' textures, it won't show the team color.
  9. int: always 0x00000001, if 0x00000000 the model that uses this texture will be messy.
  10. int[16]: mipmap offset (offset from the begining of the file)
  11. int[16]: mipmap size (size of mipmaps)
复制代码



Header:char[4]: file ID ("BLP1")int: 0 for JPG-BLP, 1 for Palettedint: 0x00000008 = has alpha, 0x00000000 = no alphaint: image widthint: image heightint: flag for alpha channel and team colors (usually 3, 4 or 5), 3 and 4 means color and alpha information for paletted files,5 means only color information, if >=5 on 'unit' textures, it won't show the team color.int: always 0x00000001, if 0x00000000 the model that uses this texture will be messy.int[16]: mipmap offset (offset from the begining of the file)int[16]: mipmap size (size of mipmaps)


If it's a JPG-BLP we go on with:
  1. int: jpg header size (header size) "h" (usually 0x00000270)
  2. byte[h]: header
复制代码
followed by 0 bytes until the begining of the jpeg data, we can safely erase these 0 bytes if we fix the mipmap offset specified above
byte[16, mipmap size]: starting from each of the 16 mipmap offset addresses we read 'mipmap size' bytes raw jpeg data till the end of the file, having the header and the mipmap data we can process the picture like ordinary JPG files

If it's a paletted BLP we go here:
byte[4, 255]: the BGRA palette defining 256 colors by their BGRA values, each 1 byte
byte[width x height]: the ColorIndex of each pixel from top left to bottom right, ColorIndex refers to the above defined color palette
byte[width x height]: the AlphaIndex of each pixel on a standard greyscale palette for the alpha channel, where 0 is fully transparent and 255 is opaque,
if the picturetype flag is set to 5, the image doesn't have an alpha channel, so this section will be omitted

More detailed blp specs by Magos: http://magos.thejefffiles.com/War3ModelEditor/

评分

参与人数 1威望 +56 收起 理由
alexries + 56 传送门失效

查看全部评分

发表于 2010-2-25 11:27:48 | 显示全部楼层
尊敬的用户:您输入的域名有误或站点访问失败,请尝试刷新或使用以下服务功能。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 点一下

本版积分规则

Archiver|移动端|小黑屋|地精研究院

GMT+8, 2024-4-19 01:16 , Processed in 0.137417 second(s), 19 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表