Skip to content
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

Maelstrom icns converted to PNG/BMP are just mask #70

Closed
erichelgeson opened this issue Apr 3, 2023 · 4 comments
Closed

Maelstrom icns converted to PNG/BMP are just mask #70

erichelgeson opened this issue Apr 3, 2023 · 4 comments

Comments

@erichelgeson
Copy link

erichelgeson commented Apr 3, 2023

Using Maelstrom_1.4.3_f.zip https://macintoshgarden.org/games/maelstrom-13-original

Screenshot 2023-04-03 at 9 24 23 AM

The image behind is the .icns file showing the color image and the mask. The foreground img is the converted bmp (or png) - which is just the mask.

Using resource_dasm --image-format=bmp --icon-family-format=image,icns --filename-format="%f:%T:%i" archive/Maelstrom_1.4.3_f/ Maelstrom_1.4.3_f/rsrc/

@fuzziqersoftware
Copy link
Owner

This is correct behavior, though it's admittedly a bit confusing. Each icon family (set of ICN#, icl8, ics8, and ics# resources with the same ID) is being packaged up into each .icns file, but each .bmp file contains only one resource. In Maelstrom 1.4.3, all the ICN# and ics# resources are indeed white masks, which the .bmp files reflect - the .icns files represent what happens when those masks are combined with the icl8 and ics8 resources.

@erichelgeson
Copy link
Author

Why is the result of combining the actual icon and the mask, a mask? Shouldn't it be the icon with a transparency?

Is there a way to work around this and dump the non-mask icons to a png/bmp?

I don't fully grasp how all these resources work yet, I appreciate your help.

@fuzziqersoftware
Copy link
Owner

Here's how icons worked in classic Mac OS:

  • Each ICN# resource contains a single monochrome image along with an alpha mask. In Maelstrom, the image parts of these resources are entirely white, but the mask parts contain the actual shape of the sprite.
  • Each icl8 resource contains a single 8-bit color image, but no mask. Classic Mac OS uses the mask from the ICN# resource with the same ID as the icl8 resource when drawing the icon.
  • The process is the same with ics# and ics8 resources - only the image dimensions are different.

resource_dasm does the same thing as classic Mac OS - for ICN# resources, it renders the monochrome image from the ICN# and applies the transparency mask from the ICN#. For Maelstrom, this results in a white silhouette of the sprite because that's what the ICN# actually contains. For icl8 resources, resource_dasm renders the 8-bit image, then looks up the ICN# with the same ID (if it exists) and applies the mask from that resource. If you want to extract all the sprite images with correct transparency, it should suffice to export only the icl8 resources. (It looks like Ambrosia never intended to support monochrome graphics in Maelstrom, and only added ICN# resources because it was the easiest way to draw icons from icl8 resources with transparency.)

@erichelgeson
Copy link
Author

Thanks for the detailed answer and work around - worked great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants