-
Notifications
You must be signed in to change notification settings - Fork 162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Editor: support loading 8-bit images with Alpha in palette #2657
Editor: support loading 8-bit images with Alpha in palette #2657
Conversation
1. SpriteImportWindow tests if source bitmap may contain alpha even if it's 8-bit. 2. SpriteTool tests input bitmap for alpha, and corrects "useAlphaChannel" and "remapColours" parameters accordingly. 3. AGSNative's CreateBlockFromBitmap() correctly converts input 8-bit bitmaps which palette has ARGB.
I tested this and confirms it works - I was curious if it would impact #1771 but it doesn't. The only thing I noticed in particular is that in the sprite selection, the ones that were transparent alpha 8-bit at import time got the transparent pixels to become magenta, and the ones that are 32-bit regular alpha got actual transparent pixels for the transparent pixels. This is more an observation. I also noticed that while they are 8-bit at import time they get converted to 32-bit - I think this is correct, and expected and this has always been the case before, and only ags4 has the option to keep the original bitness, but I thought I should mention anyway just to confirm this doesn't change. |
I did not notice this, can you clarify the sprite format and import settings? |
Could you attach a image that causes this? I was not able to find how to create such indexed sprites with the graphic software that I'm used to. |
I tried with my own image attached in the masks test issue, here it is again https://github.com/adventuregamestudio/ags/files/9541552/mask_test_3.zip The other one is from Don't Give Up the Cat |
So, these both images are recognized as having no alpha component, that's why they have their transparency turned into "magic pink". AGS only detects an alpha component when the palette contains any color with alpha which is not 0 and not 255. |
It's weird that before #1772 they didn't even import because of these alphas, but that is alright, I think this doesn't change things at all in-game. |
This lets Editor to correctly import 8-bit indexed PNGs that have valid alpha component in its palette.
The previous versions of AGS loaded all PNGs as 32-bit images, which solved this problem, but made it impossible to import 8-bit PNGs as actually 8-bit images.
AGS 3.6.2 imports 8-bit PNGs as 8-bit images, but now has opposite problem: if such image has to be converted to a 32-bit sprite (in 32-bit game), the alpha channel becomes lost. First it does not detect the presence of alpha, secondly the process of converting a 8-bit image to a final sprite does not use alpha component at all.
This PR solves these issues.
EDIT: I am not very good at graphic editors, and could not yet find a way to create or export such images.
So i am attaching a sprite provided by the user who got this problem:
NE-01-SS-000.zip