HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

BLP Class

04-29-2003, 09:53 PM#1
Guest
Hey guys, was wondering if anyone knows where I can get the BLP Class mentioned in the Image Extractor II tips? I'd like to be able to display the blps directly from the mpq in Keycraft. I haven't had any luck find the blp specs or how to go about displaying them in VB once I do find them. So any help would be appreciated.

Thanks
Magi
04-29-2003, 09:59 PM#2
Draco
.......wtf?

A .blp? That's a wc3 skin or image used in the game.
04-30-2003, 02:41 AM#3
Guest
Yes blps are blizzard image files. And like I said, the Image Extractor II, says the blp class can be found here, that makes it possible to read a blp file. So I'm just looking for that or anything that might accomplish the same thing.
04-30-2003, 09:53 AM#4
BlacKDicK
Thta´s not possible. DjBnJack lost the source code of it.
04-30-2003, 04:50 PM#5
Starcraftfreak
Quote:
Originally posted by BlacKDicK
Thta´s not possible. DjBnJack lost the source code of it.

Sorry to say that, but if he didn't loose it through a computer crash he's quite stupid. Can't he recreate it? I mean once you figured something out, you can do it more easily.

Edit: Does anyone of you know Biturn. This program can also convert BLP to other formats. Here is the website of Mirex, the programmer of Biturn: http://mirex.mypage.sk.
I found a description of BLP files on his site: http://mirex.mypage.sk/FILES/w3_blp.txt
04-30-2003, 07:26 PM#6
BlacKDicK
Yeah I know the BLP spec Starcraftfreak ( i helped DjBnJack when he was creating the Image extractor). The problem as I said is that he lost the source and I don´t have much time to re-write all the stuff back again ( Im´m back to the College). BTW, thanks for the BLP spec, but I found mine on one of my FTP storage places. And yes, he lost it due to a PC crash, lol....

Quote:
**************************************************
* BLP FILE SPEC
* by BlacKDicK, DjBnJack and Cookie
**************************************************

The *.blp files are 2D picture files used on Blizzard Entertainment Games.
I guess 'blp' stands for "Blizzard Picture". Their main usage is TEXTUREs.
They suport different mip-maps (up to 16).

Those are used on the following Blizzard games:
1) "Warcraft III Reign of Chaos BETA"
2) "Warcraft III Reign of Chaos" (the retail and the demo version)
3) "Frozen Throne BETA"

Some important things:
a) "Warcraft III Reign of Chaos BETA" uses the first version of blp files, also
known as "BLP0".
b) All other games (for now) are using the "BLP1" version.
c) On "Warcraft III Reign of Chaos", they use both JPG-BLPs and Palleted-BLPs.
The JPG-BLPs DO NOT get compressed on Blizzard archive format, "MPQs".
d) On "Frozen Throne BETA" they´re only using Palleted-BLPs, since those get
compressed on the "MPQs".

**************************************************
* BLPHEADER
**************************************************
Signature As String * 4 'BLP0 or BLP1
ImageType As Long '0 for JPGblp, 1 for Paletted
hasAlpha As Long '0x8 = has alpha, 0x0 = no alpha
Width As Long 'Image Width
Height As Long 'Image Height
hasTeamColor As Long 'Got values of 3,4,5 here. If use >=5 on 'unit' textures, it won't show the team color.
isValid As Long 'Always =>0x1, if 0x0 the model that uses this texture will be messy.

**************************************************
* MIPMAPTABLE (Only present if the file is a BLP1
**************************************************
MipmapOffset(15) As Long
MipMapSize(15) As Long

**************************************************
* GENERAL DATA (shared by all mip-maps) *
**************************************************
If it is a JPEG-Blp we get:
JPEGHeaderSize as Long 'The lenght of the JPEGHeaderData.
JPEGHeaderData() as Byte 'The JPEGHeaderData.

If it is a Paletted-Blp, we get:
Palette(255) as RGBA 'RGBA is 4 bytes

**************************************************
* MIP-MAP DATA
**************************************************
If this is a BLP0 file, then we must open a separate mipmap file (*.bxx), where 'xx'
is the mip-map level data. The lenght of the mip-map data is the len of the mip-map
file. For an example, to use a "Level 1" mipmap, the file name would be:
'name of blp file without .blp' + '.b01'

If this is a BLP1 file, then we can grab each mip-map data checking the table above.
Go to the MipMapOffset and read MipMapSize bytes.

Small tip:
Dont ask me why, but on BLP1 files Blizzard added some extra padding bytes between
the JPEGHeader and the first Mip-Map data. Those bytes can be safelly
erased if you fix each MipMappoffset entry on MipMapTable (subtract the ammount of
erased bytes).

**************************************************
* Reading the mip-map data
**************************************************
If it is a JPEG-blp, we need to decompress the mipmap to get a RGBA picture.
Get the JPEGHeaderData + MipMapData and you'll have a JPEG-JFIF file.

If it is a Palleted-blp, we will have 2 bytes for each pixel of the picture:
ImageIndex as byte
AlphaIndex as byte

The ImageIndex reffer to the pallete.
The AlphaIndex reffer to a standard grayscale palette.
05-01-2003, 06:15 PM#7
Guest
Hey thanks,
However, I know this is bad to ask this, but I could really use an example =\. I really don't have that much knowledge of VB, I'm sure I'd be able to get the reading right, using SFmpqapi. But once I have it in memory, then how should I go about displaying it in an imagebox?
05-01-2003, 07:45 PM#8
BlacKDicK
You might need some practice with JPEG decoding and BMP reading using the WINDOWS API. I could do that for you but as I said I´m busy and don´t have time to rewrite it all over again.

You need to read it on the memory using sfmpqapi and then decode the JPEG (if it is a JPEG-BLP) to a buffer. Then you draw this buffer on the imagebox hdc.

If it is a palleted BLP you need to extract the pallete and then go trough each byte of the image and get the matching entry on the pallete. The you draw this buffer on the imagebox hdc.

To decode the JPEG i sugest you to use INTEL IJL.
05-03-2003, 05:59 PM#9
Starcraftfreak
Can you release a sample program using ICL for decoding JPEGs. I wanted to get some at www.intel.com, but these dumb*sses want you to register for every piece of sh!t. I would like to have C++ sources as I know how to "convert" it to Object Pascal (programming language of Borland, available in Delphi). I'd like to program some tools. The community barely needs a new file converter. Maybe I'll try to so something like this as I have more time to program as BlacKDicK.