PNG transparent colour
BlitzPlus Forums/BlitzPlus Programming/PNG transparent colour
| ||
Started this in BlitzMAX by mistake <slaps forehead> - anyhoo, if I load a PNG with a transparent colour set, it just draws those pixels in the PNG as white rather than transparent. Any way around this? |
| ||
You can't do alpha in B+, but you can set a mask color: http://www.blitzbasic.com/bpdocs/command.php?name=MaskImage&ref=2d_cat |
| ||
I answered this *again* but from a BlitzPlus viewpoint in the BlitzMax thread :-) |
| ||
Yes, I know, but that isn't much use when I'm not making the images myself. Bit of a crap oversight on Mark's part to allow loading of PNGs and then ignore the palette transparency, doncher think? |
| ||
1) Make a normal image with a Magenta background 2) save without any transparency info 3) set the mask colour to 255,0,255 4) tada. |
| ||
Er. Wuh? |
| ||
It would be *much* slower to draw with alpha (which is presumably why it was never included). You might find that you get more mileage out of doing 2D-in-3D in BlitzMax or Blitz3D (using hardware acceleration). Of course it will run on less machines that way. |
| ||
I don't want proper 256 level alpha, I'm talking about clutted images which have had one colour nominated as transparent (ie, like GIFs). |
| ||
you never said that these were images that existed already. You need to convert them as per my tip in the MAx thread. Blitz Plus can't read PNG transparency so get over it and convert your images or get BlitzMax. |
| ||
Can BMax do GUI stuff then? If so, that's a tempting proposition. |
| ||
yes, but you have to buy the GUI module. |
| ||
Poot. :P |
| ||
I think the gui module is free to b+ users. |
| ||
Yeah, appears to be for a limited time only, however it's still $80 for BMAX and I don't think I can get work to pay for it. Also, it depend how well supported it's going to be - Blitz Plus and it's updates don't exactly represent a glowing paragon of customer support, do they? |
| ||
I dunno, giving a free maxGUI license if you own B+ seems like pretty good customer support to me. Also, B+ "does exactly what it says on the tin". Its very stable and runs on a wide range of hardware. Regarding support for BlitzMax: it is the future of Blitz, and unlike B+ and BB3D, can be made to do anything that users (or BRL itself) want it to do, because it is an almost completly open system. |
| ||
Dr Dr, I used BlitzPlus for over a year, it's really good and neat BUT it's no longer good enough to make professional games in that portals will accept due to lack of 3D card effects, so I'm using Max now. I have to unlearn all the PLus stuff and learn Max from scratch, wish I'd done that in the first place, but when I bought Plus, Max was ONLY available for Macs!! |
| ||
S'not a game, it's an application. As for giving a "free" version of the GUI stuff, it's only free if you plop down the $80 for BMax first. Just seems to me that B+ was abandoned really rather quickly in the headlong rush to make BMax. |
| ||
B+ was abandoned really rather quickly What? It's been around for 3 years, is still going and still does what it said it would do 3 years ago for only $60. That's $20 per year of use you've got out of it plus the rest of it's life for free. Anyway, are you making all these assumptions based on the fact it doesn't, never has and never will handle transparency? |
| ||
It does handle nominating a transparent colour in an image via maskimage, though, doesn't it? And CLUT'd PNGs can contain a nominated transparent colour, don't they? So why can't B+ make use of this information? |
| ||
Because DirectDraw doesn't? |
| ||
I don't believe that DirectDraw handles PNGs at all, so Mark would have had to use something else to load them anyway, so why ignore the transparent colour information? |
| ||
IIRC Blitz uses the freeimage lib for loading images? so why ignore the transparent colour information? Because that is not how DirectDraw works?An easy fix for you would be to manually read the transparent color info and then set that color as the transparent color when the image is drawn. Make the function once and use it over and over. There is plenty of opensource info on the PNG format that should allow you to do this. |
| ||
Well, thanks to Phil Snart I'm gonna' do that. I can use FreeImage to easy find the index of the transparent colour, although finding the RGB values for said colour is a little more complex. |