I want to have a crack at remaking blood with the current version of JFDUKE, I am not going to be programming, just changing some files from blood to duke.
anyway my question is how do i do transparency with pictures.
E.G.
http://img89.imageshack.us/my.php?image=bloodshot6zq.jpg
Why does the pink stay there, is it to do with Dukes pal and bloods pal. oh i don't no, please if you could help that would be great.
Awesoken at
If you import the textures into the ART file, use color index 255 as your transparency. If you use external texture files (by defining them in the DEF file), use the alpha channel of PNG, TGA, or GIF for transparency. You cannot use JPG, PCX, or BMP since they do not support transparency.
masterlee at
It is not true that BMP not support transparency. It is only true that many programs that support BMP dosen't support them with transparency.
typedef struct {
DWORD bV5Size;
LONG bV5Width;
LONG bV5Height;
WORD bV5Planes;
WORD bV5BitCount;
DWORD bV5Compression;
DWORD bV5SizeImage;
LONG bV5XPelsPerMeter;
LONG bV5YPelsPerMeter;
DWORD bV5ClrUsed;
DWORD bV5ClrImportant;
DWORD bV5RedMask;
DWORD bV5GreenMask;
DWORD bV5BlueMask;
BMPs support 32bit images - it has a 4th reserved channel - this can be used as transparency. So indirectly it does support transparency and since it is 'reserved' it does suggest why not many applications use it as transparency. Another reason is perhaps that for graphic applications(don't ask me any but I believe scanners can pick up higher ranges) which require higher precision of colour use it for extra percision.
My opinion is, except for the very rare case above, is why don't apps forget its 'reserved' and make it alpha-transparent.
Offtopic - well something to do with transparency:
Why don't web browsers support alpha transparency???
counting_pine at
I believe BMP only officially supports transparency with a V5 header which, IIRC, is the header structure that masterlee has posted. I've never seen a bitmap with such a header, I don't know how to make them, and I don't know of any programs that can.
Normal 32-bit BMPs with the unofficial alpha channel can be found in the wild. You can convert them to and from PNG with bmp2png -A and png2bmp -A (these programs can be found here). There is also an undocumented trick in Windows XP's Paint, where you can load a PNG with transparency, save it as a "24-bit bitmap", and it will save it as a 32-bit BMP with the unofficial alpha channel. Sadly, it doesn't work in reverse.
I think the main problem with accepting it as official is, that it's not unknown for programs to save images without transparency as 32-bit BMPs, and write zeros to the reserved bytes. This results in a completely transparent image.
(I'm not sure, but I think you can only get extra precision in a bitmap if the Compression field is marked as BI_BITFIELDS. Then there's extra information after the header saying what bits are used for which channel)
Well, anyway, I don't think there's any good reason to use BMPs for transparency when PNGs are available, apart from the fact that they're a lot easier to convert to the ICO format.
JonoF at
Raedwulf said
Why don't web browsers support alpha transparency???
For PNG alpha support, Gecko-based browsers do (ie. Mozilla, Firefox, Camino, Epiphany). I believe Opera 6+ does too. Khtml-based browsers do (ie. Konquerer, Safari). Internet Exploder handles 1-bit alpha properly, but a full alpha channel isn't supported, at least until v7 which nobody has yet so we may as well ignore it. I believe none of them support transparent background images that show through to the desktop though.
Jonathon
Raedwulf at
JonoF said
Raedwulf said
For PNG alpha support, Gecko-based browsers do (ie. Mozilla, Firefox, Camino, Epiphany). I believe Opera 6+ does too. Khtml-based browsers do (ie. Konquerer, Safari).
Jonathon
Hey cool :) Thanks, - time to start using firefox :)
---------------------------
I know 32bit bmps work because Steve McMahon on vbAccelerator uses them for VB and I do for VB sometimes too. For VB the LoadPicture function loads the bitmap in memory with the specified number of bits - in this case 32bits. From there you can access alpha-transparency as usual and blit it with the AlphaBlend function from msimg32.dll.