找回密码
 点一下
查看: 1990|回复: 16

BLP相关资料(BLP1)

  [复制链接]
发表于 2007-2-10 18:01:15 | 显示全部楼层 |阅读模式
[codes=cpp]//+-----------------------------------------------------------------------------   
//| Info   
//+-----------------------------------------------------------------------------   
The BLP file format!   
Compiled by Magnus Ostberg (aka Magos)   
[email protected]   
  
  
//+-----------------------------------------------------------------------------   
//| Data types   
//+-----------------------------------------------------------------------------   
CHAR   - 8bit character   
BYTE   - 8bit unsigned integer   
WORD   - 16bit unsigned integer   
DWORD  - 32bit unsigned integer   
FLOAT  - 32bit floating point number   
COLOR  - 32bit color value of type RGBA, one byte per channel   
X[n]   - An n-dimensional vector of type X   
  
  
//+-----------------------------------------------------------------------------   
//| Descriptions   
//+-----------------------------------------------------------------------------   
[X | Y];      - Exactly one of the structures X and Y are present.   
  
X;            - A structure that must be present.   
  
#X            - A flag value, more than one can be combined.   
  
  
//+-----------------------------------------------------------------------------   
//| Notes   
//+-----------------------------------------------------------------------------   
- A full mipmap chain must be present. The last mipmap must be 1x1 (no larger).   
  If an image is 32x8 the mipmap chain must be 32x8, 16x4, 8x2, 4x1, 2x1, 1x1.   
  Sizes not of powers of 2 seems to work fine too, the same rules for mipmaps   
  still applies. Ex: 24x17, 12x8 (rounded down), 6x4, 3x2, 1x1 (rounded down).   
  
  
//+-----------------------------------------------------------------------------   
//| BLP structure   
//+-----------------------------------------------------------------------------   
struct Blp   
{   
  DWORD 'BLP1';   
  DWORD Compression;                   //0 - Uses JPEG compression   
                                       //1 - Uses palettes (uncompressed)   
  DWORD Flags;                         //#8 - Uses alpha channel (?)   
  DWORD Width;   
  DWORD Height;   
  DWORD PictureType;                   //3 - Uncompressed index list + alpha list   
                                       //4 - Uncompressed index list + alpha list   
                                       //5 - Uncompressed index list   
  DWORD PictureSubType;                //1 - ???   
  DWORD MipMapOffset[16];   
  DWORD MipMapSize[16];   
  
  [BlpJpeg | BlpUncompressed1 | BlpUncompressed2]   
};   
  
  
//+-----------------------------------------------------------------------------   
//| BLP JPEG structure (Compression == 0)   
//+-----------------------------------------------------------------------------   
struct BlpJpeg   
{   
  DWORD JpegHeaderSize;   
  
  BYTE[JpegHeaderSize] JpegHeader;   
  
  struct MipMap[16]   
  {   
    BYTE[???] JpegData;   
  };   
  
  // Up to 16 mipmaps can be stored in a blp image. 2^16 = 65536, so there's   
  // little risk it won't be enough. Each JPEG (JFIF to be more exact) image   
  // is constructed by merging the header with the mipmap (all mipmaps uses   
  // the same header. It seems like Warcraft 3 can handle JPEG header sizes   
  // of 0 (in case you have trouble generating JPEG images using the same   
  // header) however there are other fan tools that does not. Specifying a   
  // low number like 4 will work too as the only shared data are the initial   
  // JPEG markers.   
  //   
  // Each mipmap has a certain size and is located at  a certain offset as   
  // specified in the main blp header. There can be (and sometimes are in   
  // Blizzard's images) unused space between the JPEG header and the JPEG   
  // data. Why this is I don't know!   
  //   
  // The JPEG header of Blizzard's images is usually 624 bytes long. This   
  // may or may not be true for your own generated images depending on how   
  // you generated them.   
  //   
  // The JPEG format is advanced so I won't go into detail here.   
};   
  
  
//+-----------------------------------------------------------------------------   
//| BLP Uncompressed 1 structure (Compression == 1, PictureType == 3 or 4)   
//+-----------------------------------------------------------------------------   
struct BlpUncompressed1   
{   
  COLOR[256] Palette;   
  
  struct MipMap[16]   
  {   
    BYTE IndexList[CurrentWidth * CurrentHeight];   
    BYTE AlphaList[CurrentWidth * CurrentHeight];   
  };   
  
  // CurrentWidth/CurrentHeight is the width/height for the current mipmap.   
  // Mipmap size/offset works the same as explained for JPEGs above.   
  //   
  // Each cell in the index list refers to a location in the palette where   
  // the corresponding RGB value is (the palette is still RGBA, but A is not   
  // used). The alpha list contains the alpha value for the pixel.   
};   
  
  
//+-----------------------------------------------------------------------------   
//| BLP Uncompressed 2 structure (Compression == 1, PictureType == 5)   
//+-----------------------------------------------------------------------------   
struct BlpUncompressed2   
{   
  COLOR[256] Palette;   
  
  struct MipMap[16]   
  {   
    BYTE IndexList[CurrentWidth * CurrentHeight];   
  };   
  
  // CurrentWidth/CurrentHeight is the width/height for the current mipmap.   
  // Mipmap size/offset works the same as explained for JPEGs above.   
  //   
  // Each cell in the index list refers to a location in the palette where   
  // the corresponding RGBA value is. The alpha value is inversed so the real   
  // alpha is "255 - alpha".   
};   [/codes]
 楼主| 发表于 2007-2-10 18:16:52 | 显示全部楼层
总算好了。
可以使用高亮了………………
回复

使用道具 举报

 楼主| 发表于 2007-2-10 18:20:48 | 显示全部楼层
论坛现在启用语法高亮功能,支持79种语言。
使用方法为:
[codes=????]你的代码[/codes]。
所有支持的语言列表如下:
actionscript
ada
apache
applescript
asm
asp
autoit
bash
blitzbasic
bnf
c
caddcl
cadlisp
cfdg
cfm
cpp-qt
cpp
csharp
css-gen.cfg
css
c_mac
d
delphi
diff
div
dos
eiffel
fortran
freebasic
gml
groovy
html4strict
idl
ini
inno
io
java
java5
javascript
latex
lisp
lua
matlab
mirc
mpasm
mysql
nsis
objc
ocaml-brief
ocaml
oobas
oracle8
pascal
perl
php-brief
php
plsql
python
qbasic
reg
robots
ruby
sas
scheme
sdlbasic
smalltalk
smarty
sql
tcl
text
thinbasic
tsql
vb
vbnet
vhdl
visualfoxpro
winbatch
xml
Jass
回复

使用道具 举报

发表于 2007-2-10 18:21:14 | 显示全部楼层
[codes=c]#include

using namespace std;

int main()

{

cout<<"Hello,World!"<

return 0;

} [/codes]
回复

使用道具 举报

 楼主| 发表于 2007-2-10 18:23:26 | 显示全部楼层
要加空格的…………
[codes=特别测试]嗯嗯,其实就是试试看~~[/codes]
回复

使用道具 举报

发表于 2007-2-10 18:26:28 | 显示全部楼层
[codes=jass]
function IsPlayerEnemyCR takes player pPlayer1, player pPlayer2 returns boolean
  return pPlayer1 != pPlayer2
endfunction
[/codes]
回复

使用道具 举报

发表于 2007-2-10 18:35:40 | 显示全部楼层

Re:[测试]BLP相关资料(BLP1)

[codes=java]
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JPanel;

class Decorator extends JComponent{
    public Decorator(JComponent c){
        setLayout(new BorderLayout());
        add("Center",c);
    }
}

class SlashDecorator extends Decorator{
    public SlashDecorator(JComponent c){
        super(c);
    }
    public void paint(Graphics g){
        Dimension size=super.getSize();
        super.paint(g);
        g.drawLine(0,0,size.width-1,size.height-1);
    }
}

class CoolDecorator extends Decorator{
    boolean mouseOver;
    JComponent thisComp;
    public CoolDecorator(JComponent c){
        super(c);
        mouseOver=false;
        thisComp=this;
        c.addMouseListener(new MouseAdapter()
            {
                public void mouseEntered(MouseEvent e){
                    mouseOver=true;
                    thisComp.repaint();
                }
                public void mouseExited(MouseEvent e){
                    mouseOver=false;
                    thisComp.repaint();
                }
            }
        );
    }
    public void paint(Graphics g){
        super.paint(g);
        Dimension size=super.getSize();
        if(!mouseOver) g.setColor(Color.red);
        else g.setColor(Color.blue);
        g.drawRect(0,0,size.width-1,size.height-1);
    }
}
public class ex0 extends JFrame{
    Container content;
    public ex0(){
        super("Slash Button");
        content=this.getContentPane();
        JPanel p=new JPanel();
        p.add(new JButton("CButton"));
        p.add(new CoolDecorator(new JButton("DButton")));
        content.add(p);
        setSize(200,100);
        setVisible(true);
    }
    public static void main(String[] args){
        ex0 e=new ex0();
    }
}
[/codes]
回复

使用道具 举报

 楼主| 发表于 2007-2-10 18:36:07 | 显示全部楼层
错了,是codes
回复

使用道具 举报

发表于 2007-2-10 18:38:21 | 显示全部楼层
555...好强大...
我觉得codes的那个框颜色太淡了
回复

使用道具 举报

 楼主| 发表于 2007-2-10 18:39:13 | 显示全部楼层
那个框没法改,是PW的主题决定的,主题变了,框自然会变。
回复

使用道具 举报

 楼主| 发表于 2007-2-10 18:41:20 | 显示全部楼层
你改成new5风格试试,好一些。

或者要么像jass标签一样,自己做个框。
回复

使用道具 举报

发表于 2007-2-10 19:39:52 | 显示全部楼层
FX无敌!
回复

使用道具 举报

DeadFish 该用户已被删除
发表于 2007-2-10 20:25:54 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复

使用道具 举报

发表于 2007-2-11 02:19:24 | 显示全部楼层
本来想建议这样的,结果偶还没说就出来了。
回复

使用道具 举报

发表于 2007-2-11 10:59:06 | 显示全部楼层
- -!
好吧.偶来解答一下.
其实论坛本身就已经支持这个东东了.
只是没有更新的版本而已.
而且现在也可以用
[php]
[/ php]之类的来使用这些高亮.
只是没有公开而已.
回复

使用道具 举报

 楼主| 发表于 2007-2-11 13:56:13 | 显示全部楼层
引用第14楼amp342007-02-11 10:59发表的:
- -!
好吧.偶来解答一下.
其实论坛本身就已经支持这个东东了.
只是没有更新的版本而已.
而且现在也可以用
.......
我看代码的时候就知道了,jass根本就是用GeShi库来支持的。
但是[php]这样的写法不方便,不统一,升级比较麻烦。而且无法实现4楼的效果。
回复

使用道具 举报

发表于 2007-2-11 13:59:24 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-6-23 09:30 , Processed in 0.030856 second(s), 19 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

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