If I load a PNG with 1bit transparency set, it's not made transparent in-game, it's rendered on a black background.
Can this be fixed please?
(fixed) 1bit transparency in PNGs doesn't work
Moderator: Sophia
Forum rules
Please read the Forum rules and policies before posting.
Please read the Forum rules and policies before posting.
- Sophia
- Concise and Honest
- Posts: 4306
- Joined: Thu Sep 12, 2002 9:50 pm
- Location: Nowhere in particular
- Contact:
Re: Bug: 1bit transparency in PNGs doesn't work
I'll admit a large part of why this doesn't work probably has to do with the fact that I don't have a clue what you're talking about. 
The library should be converting all of that stuff to an alpha channel at the same time as it internally converts it to Allegro's internal 32-bit format. If it's not working right it's a bug in code I didn't write.

The library should be converting all of that stuff to an alpha channel at the same time as it internally converts it to Allegro's internal 32-bit format. If it's not working right it's a bug in code I didn't write.

- Gambit37
- Should eat more pies
- Posts: 13766
- Joined: Wed May 31, 2000 1:57 pm
- Location: Location, Location
- Contact:
Re: Bug: 1bit transparency in PNGs doesn't work
1bit transparency -- you know, when you make a single colour in a 256 colour image the transparent colour? It's like having power pink behind your image, but in the PNG it saves it as "transparent".
- Sophia
- Concise and Honest
- Posts: 4306
- Joined: Thu Sep 12, 2002 9:50 pm
- Location: Nowhere in particular
- Contact:
Re: Bug: 1bit transparency in PNGs doesn't work
Ok. This should be getting promoted to a full alpha channel at the same time that the image gets converted to the internal 32 bit format.
If it's not.. hmm.
Are you doing anything fancy to load it, or just dsb_get_bitmap?
If it's not.. hmm.

Are you doing anything fancy to load it, or just dsb_get_bitmap?
- Gambit37
- Should eat more pies
- Posts: 13766
- Joined: Wed May 31, 2000 1:57 pm
- Location: Location, Location
- Contact:
Re: Bug: 1bit transparency in PNGs doesn't work
It's just dsb_get_bitmap(). Regular 32-bit PNGs work fine, by the way. Do you want me to send you the PNG for testing?
Re: Bug: 1bit transparency in PNGs doesn't work
Gambit, do you work with 256 colours (only)?
why not use regular 32-bit PNGs?
why not use regular 32-bit PNGs?
- Gambit37
- Should eat more pies
- Posts: 13766
- Joined: Wed May 31, 2000 1:57 pm
- Location: Location, Location
- Contact:
Re: Bug: 1bit transparency in PNGs doesn't work
I work with what ever is appropriate for the image in question. A lot of images simply don't need to be 32-bit (well, technically 24-bit colour + an 8bit alpha channel). You can often downsample to adaptive 256 colour palettes for most images without losing noticeable quality.
8bit PNGs are much, much smaller on disk than 32-bit images too, so will make for a much smaller download. (Of course, you could argue that zipping a 32-bit image makes the same saving as converting to 8bit and that's probably true, but I'd rather have smaller files to begin with, I just find it more efficient all round. )
The custom dungeon I'm developing uses old-school pixellated graphics, so I mostly don't need to use full alpha channels -- which is why 8bit PNGs with 1bit alpha is sufficient. I could of course put power pink in all my images, but I've already generated hundreds without power pink and don't really wanna go back and do it all again...
8bit PNGs are much, much smaller on disk than 32-bit images too, so will make for a much smaller download. (Of course, you could argue that zipping a 32-bit image makes the same saving as converting to 8bit and that's probably true, but I'd rather have smaller files to begin with, I just find it more efficient all round. )
The custom dungeon I'm developing uses old-school pixellated graphics, so I mostly don't need to use full alpha channels -- which is why 8bit PNGs with 1bit alpha is sufficient. I could of course put power pink in all my images, but I've already generated hundreds without power pink and don't really wanna go back and do it all again...
- Sophia
- Concise and Honest
- Posts: 4306
- Joined: Thu Sep 12, 2002 9:50 pm
- Location: Nowhere in particular
- Contact:
Re: (fixed) 1bit transparency in PNGs doesn't work
Fixed now.
For the sake of efficiency, DSB's drawing routines will try to mask by power pink or alpha channel, never both. The decision which to do is made when the image is loaded. The 1 bit ones were being sent down the power pink pipe by mistake because they didn't have a "proper" 8 bit alpha value.
For the sake of efficiency, DSB's drawing routines will try to mask by power pink or alpha channel, never both. The decision which to do is made when the image is loaded. The 1 bit ones were being sent down the power pink pipe by mistake because they didn't have a "proper" 8 bit alpha value.