LixD icon indicating copy to clipboard operation
LixD copied to clipboard

Magic pink won't become transparent on macOS (both Intel and ARM64)

Open SimonN opened this issue 2 years ago • 12 comments

Workaround: Mass-replace the magic pink with proper transparency. You need ImageMagick 7.x installed. Open a shell, navigate to Lix's directory, then run:

find images/ data/images/ -name \*.png -exec magick {} -transparent \#FF00FF {} \;

Originally reported by naymapl in #430:

Lix 0.9.42 builds and runs on Mac mini m1 that runs macOS ARM64. (We had to edit dub.json as in #430.) Some graphics have problems:

  • Lix doesn't replace the magic pink with transparency. This happens in the mouse cursor and it also happens on terrain. This affects physics, the lix will walk over the pink rectangle.
  • Lix doesn't recolor the symbols on the UI buttons. The symbols are light grey, not the expected desaturated light blue.

cameo69 reports that this same bug also manifests on an Intel Mac.

Zrzut ekranu 2022-03-4 o 09 22 48

SimonN avatar Mar 05 '22 15:03 SimonN

@naymapl wrote:

ok. I check source and all png files have this pink layer. Maybye is better to create source png files with real transparent layers ?

That would fix the pink, and give you correct physics. If you want it really fast, you could, in theory, go through the tiles in images/ yourself and replace the pink with full transparency (alpha 0) in all images.

Even replacing pink with transparency in the image files would still leave the wrongly-colored symbols on the buttons, but those aren't as important.

Lix 0.9.42 should, by itself, replace the pink with transparency and recolor the button symbols, but it doesn't. I've already investigated the source roughly: Allegro 5 and the addons are initialized, and I compute the colors with al_map_rgb_f afterwards. This should rule out any endianness issues.

But this is the first time that somebody is running Lix on macOS ARM64. Anything might be the problem. I'll investigate.

SimonN avatar Mar 05 '22 16:03 SimonN

Answer is not so simple :D

mouse l

I prepare file with transparent layer and now have no cursor :D

Zrzut ekranu 2022-03-5 o 17 10 43

naymapl avatar Mar 05 '22 16:03 naymapl

Ok - now is working - I maybye use wrong file name ;)

naymapl avatar Mar 05 '22 16:03 naymapl

Is it any way to make it bulk ? It so many images to make one by one :D

https://graphicdesign.stackexchange.com/questions/16120/batch-replacing-color-with-transparency

I found this but no idea how run this with LixD images.

naymapl avatar Mar 05 '22 16:03 naymapl

Lix images are normal PNGs with alpha. Assuming you have ImageMagick 7.x installed, here's a loop:

find images/ data/images/ -name \*.png -exec magick {} -transparent \#FF00FF {} \;

find -exec \; runs the command (that is in-between exec and \;) per file, and {} becomes the found filename.

Still looking for the problem in Lix or Allegro on macOS ARM64. What I do in Lix should work on all systems. Really makes me wonder...

SimonN avatar Mar 05 '22 16:03 SimonN

Thank you so much - working perfect ;) Now game looks perfect on Apple Silicon macOS. Zrzut ekranu 2022-03-5 o 18 03 23

If you want to test something just let me know.

btw will be nice to create lixd.app with icon for your app, for example with this app:

https://github.com/machinebox/appify

naymapl avatar Mar 05 '22 17:03 naymapl

(Sorry for late reply.)

Great to hear that you can play singleplayer well! I'll keep this workaround in mind then -- the shell loop to recolor all graphics.

The in-game recoloring still fails for the button icons. But the grey button icons (instead of pale blue) aren't a problem for singleplayer playability. You can still tell what's what.

But in multiplayer, you'd have 8 identical-looking player colors instead of 8 different lix colors. This would be more serious, you wouldn't be able to tell apart lix of different players. Thus, I won't close this bug yet.

SimonN avatar Mar 19 '22 21:03 SimonN

Hi, for what it's worth, I have the same problem on an Intel Mac. And I think I cannot win Level 11 "Beneath the Lab" like this because Lemmings are repelled by the pink. Hence no way to get them out of the game :-(

Pasted Graphic 4

Guess I will try changing all graphics as suggested.

cameo69 avatar Jun 03 '22 19:06 cameo69

find images/ data/images/ -name *.png -exec magick {} -transparent #FF00FF {} ;

did the trick. Thank you so much.

image

cameo69 avatar Jun 03 '22 19:06 cameo69

Thanks for the report that this bug manifests on the Intel Mac!

I haven't investigated since March 2022, but it's getting more important again. Lix is largely unplayable on all Macs until we mass-replace the pink with the shell loop, and even then, the UI elements remain unrecolored.

SimonN avatar Jun 04 '22 08:06 SimonN