[ADDED] [SUGGESTION] [TOOLKIT] Allow again transparency=one color in logo

Started by Nepster, March 04, 2016, 06:52:44 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Nepster

Problem: None of my three photo-editing programs seems to be able to produce a kind of transparency that NeoLemmix is able to recognize. Actually I have not even an idea, what kind of transparency I have to look for?

My current solution: Use LemMain and the Toolkit for V1.39 to produce an old .nxp, that I can load in NeoLemmix V1.40. Then I press F7 on the main page to get the correct logo. This is far, far, far too difficult, just to get one .png with the correct settings!

Suggestion: Add an option to the "Other data" menu of the toolkit, to switch from the new transparency mode to the previous one (i.e. having one color set to transparent). When creating the .nxp, the toolkit would automatically transform the old transparency mode into the new one and use the newly created .png in the .nxp.
As NeoLemmix V1.40 already had this transformation feature (in the form of dumping the images when pressing F7), this is hopefully not too difficult to implement.

namida

It wasn't NeoLemmix V1.40n, but rather LemMain, that had that feature.

I'm not sure if you'll understand the details here, but basically - images in MAIN.DAT had 19-bit color values. 6 bits per color (R, G, B), and a 1-bit alpha channel, which defined a pixel as transparent or not. LemMain converted (24-bit RGB 255, 255, 255) to (19-bit ARGB 0, 0, 0, 0).
NeoLemmix and associated tools, when loading from MAIN.DAT, convert the 19-bit RGBA pixels to 32-bit ARGB ones.

Now on the other hand, with PNG files, these are already 32 bit. The order is, I believe, ABGR rather than the ARGB that NeoLemmix (or to be more specific, the graphics library NeoLemmix uses) uses internally, but this is very easily swapped around at runtime. The Flexi Toolkit in fact doesn't even understand a PNG file in any way - it just loads / saves the raw data of the file. Think of it as similar to how, when you zip a file using WinZip / etc, WinZip doesn't know anything about what the file's data means, it only knows the raw binary data that makes up the file. Although I have somewhat been intending to change this eventually, currently the only inside-file data that the Flexi Toolkit has any concept of is SYSTEM.DAT (which it understands completely) and level files (which it knows only some very specific details; specifically where to find the title, the graphic set name, and the music file name).

I don't know if you've used the graphic set tool at all, but that has better support for things like what you're describing. When importing an image, you can either use the image's alpha channel for transparency, or you can manually pick a transparent color. Something like this should probably be added to the Flexi Toolkit, for sure.




In regards to how to actually set a color as transparent, in Paint.NET this is achieved by selecting a region (the "Select by Color" tool comes in handy here, if not starting with a blank slate) and then using the "Delete" option. It can also be achieved by setting the drawing color to one with an alpha (transparency) value of zero, and making sure the color drawing setting is "overwrite" rather than "blend" / "add". Finally, be sure to save it as a 32-bit PNG file - this is a good idea in general, as I'm not entirely sure how well NeoLemmix supports any other bit-depths (I know for sure it doesn't support transparency in less-than-8-bit).

Perhaps if you mention what your graphics programs are, someone familiar with the program you use could also help you with how to have genuinely transparent pixels.

If you can't find that out (or your software doesn't support it), then until some kind of improvement in this regard is made, a quicker workaround than dumping from an old NeoLemmix version would be to import into the graphic set tool, then export again as PNG files (it will save them with proper transparency, even if imported from a picture that doesn't have it). Still far from ideal, but an improvement over the current method.
My projects
2D Lemmings: NeoLemmix (engine) | Lemmings Plus Series (level packs) | Doomsday Lemmings (level pack)
3D Lemmings: Loap (engine) | L3DEdit (level / graphics editor) | L3DUtils (replay / etc utility) | Lemmings Plus 3D (level pack)
Non-Lemmings: Commander Keen: Galaxy Reimagined (a Commander Keen fangame)

Nepster

QuoteFinally, be sure to save it as a 32-bit PNG file - this is a good idea in general, as I'm not entirely sure how well NeoLemmix supports any other bit-depths.
This was very good advice. Just loading my 24-bit png.-files and saving them as 32-bit solved my problem completely, though there might have been more going on the background that I am unaware of.

QuoteI don't know if you've used the graphic set tool at all, but that has better support for things like what you're describing. When importing an image, you can either use the image's alpha channel for transparency, or you can manually pick a transparent color. Something like this should probably be added to the Flexi Toolkit, for sure.
No, I haven't used the graphic set tool at all.
But seeing that one of my graphics programs (PhotoFiltre) seems unable to save pngs in 32-bit, adding a little bit more support for 24-bit png-images seems useful. So yes, it would be nice to have something like the graphic set tool's options in the Flexi Toolkit as well.

namida

Well, as I mentioned, there's nothing I can do about this player side. The libraries used for PNG loading just don't seem to allow transparent colors in any useful way, apart from by a hardcoded "color X = transparent" which I'm reluctant to implement.

Now the good news is, the Toolkit side isn't so hopeless. I added code very similar to what the graphic set tool does, so when importing an image file (and yes, I said "image file", not "PNG file", as this change also adds the capability to import BMPs or GIFs as well; they'll be converted to PNG by the toolkit), you can choose whether to use its alpha channel for transparency, or instead pick a transparent color. Picking a transparent color is done by selecting the "Transparent color" option on the new import dialog, then clicking any pixel in the image that's of the color you want to use as transparent (default, if one were to click "Transparent color" but not pick any color from the image, is death magenta (ie: RGB 255, 0, 255)).

Do note that this only works when importing images via the toolkit. It won't work for images manually placed in the project folder (of course, you can place them there, open the toolkit, then re-import them from the project folder itself).

Hope this makes it easier for you in the future. :)

EDIT: Closing this topic and moving it to the "Closed" section. Any further suggestions (or bugs with the feature), please open a new topic. Note that "support it for files manually added to the directory" is not likely to happen in the near future, in particular due to with anything other than 32-bit PNGs (and maybe GIFs?) needing to manually select a transparent color.
My projects
2D Lemmings: NeoLemmix (engine) | Lemmings Plus Series (level packs) | Doomsday Lemmings (level pack)
3D Lemmings: Loap (engine) | L3DEdit (level / graphics editor) | L3DUtils (replay / etc utility) | Lemmings Plus 3D (level pack)
Non-Lemmings: Commander Keen: Galaxy Reimagined (a Commander Keen fangame)