Rendering Glow Icons

Discuss any general programming issues here
Post Reply
NathanH
Posts: 107
Joined: Sun Jul 05, 2015 1:29 am
Location: Caldwell, Idaho

Rendering Glow Icons

Post by NathanH »

Hi,
I know little about icons. I'm loading stock OS3.9 icons as brushes to display in a dock. They have borders around them which are different colors between different icons. The only way I've found to get id of them is to use, for example, the Transparency=RGB(170,170,170) option. This works fine for icons with a gray border except for icons that also have gray within the icon itself and does not work at all if a different border color is present. Is there a way to read these thinks from the .info file itself as AmigaOS obviously has no problem rendering the icons without the border? Is there a Hollywood function or settings to render them in the same way that AmigaOS does? I won't know in advance which icon (Glow Icon or .png icon) someone may choose to display. Thanks for your help.

NathanH
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Rendering Glow Icons

Post by airsoftsoftwair »

Hollywood itself doesn't have any inbuilt loaders for Amiga icons so I guess those icons are loaded via datatypes. Since all OS 3.x icon formats are palette-based it's not easily possible to do what you want because Hollywood doesn't allow you to make certain pens transparent as it is required by palette images. It would only be possible if Hollywood had direct icon support. This has been on my to do list for a very long time but I haven't started any work on it yet because of the multitude of different Amiga icon formats...
NathanH
Posts: 107
Joined: Sun Jul 05, 2015 1:29 am
Location: Caldwell, Idaho

Re: Rendering Glow Icons

Post by NathanH »

Thanks for the explanation. Look forward to such functionality.

Nathan
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Rendering Glow Icons

Post by airsoftsoftwair »

This is finally supported by the new Iconic plugin. See here: viewtopic.php?f=19&t=3478
amyren
Posts: 352
Joined: Thu May 02, 2019 11:53 am

Re: Rendering Glow Icons

Post by amyren »

Just did a quick test saving some icons
I used two 128x128 png images for the icon.

The script below will cause an error message when saving as a powericon:
Error in line 7 (icon128.hws): Error saving icon!

Code: Select all

@REQUIRE "iconic"
CreateIcon(1, {{Image = "128_1.png", Type = #FILE, SelImage = "128_2.png", Type = #FILE}})
SaveIcon(1, "plain.info")
SaveIcon(1, "Aos.info", #ICNFMT_AMIGAOS)
SaveIcon(1, "MosPNG.info", #ICNFMT_PNG)
SaveIcon(1, "Aos35.info", #ICNFMT_AMIGAOS35)
SaveIcon(1, "Power.info", #ICNFMT_NEWICON)
Saving it in OS35 format gives the best overall result.
This is how the resulting icons look in AmigaOS 3.9
Image

On AmiKit, the AmigaOS and PowerIcon will look distorted, other icons look the same as the image.
On MorphOS the AmigaOS and PowerIcon will not show any image at all. Other icons look like on OS39.
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Rendering Glow Icons

Post by airsoftsoftwair »

Can you provide the files used in your MCVE so that I can try it here?
amyren
Posts: 352
Joined: Thu May 02, 2019 11:53 am

Re: Rendering Glow Icons

Post by amyren »

airsoftsoftwair wrote: Sat Feb 05, 2022 9:52 pm Can you provide the files used in your MCVE so that I can try it here?
Sure, here are those two images.
Image

Image
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Rendering Glow Icons

Post by airsoftsoftwair »

Well, lots of things in this report could've been by answered by RTFM.

First off, you seem to be confusing PowerIcons and NewIcons. This line

Code: Select all

SaveIcon(1, "Power.info", #ICNFMT_NEWICON)
will save a NewIcon, not a PowerIcon. Thus, NewIcon format rules apply. From the manual: (relevant parts highlighted for you)
- NewIcons: This is a palette-based icon format and in contrast to classic
AmigaOS icons, the palette is stored inside the icon so that icons appear in
the correct colors independent of the Workbench's palette. NewIcons support a
transparent pen, the maximum icon size is 93x93 pixels and the maximum color
depth is 8-bit, i.e. 256 colors. NewIcons also contain a 4-color fallback icon
that will be shown on Amiga systems that don't support NewIcons. Icons have
two different states (normal and selected).
Your image is 180x180, hence SaveIcon() will fail.
On AmiKit, the AmigaOS and PowerIcon will look distorted, other icons look the same as the image.
Once again you seem to be confusing PowerIcons here. Concerning the strange look of the AmigaOS icon, let me quote from the documentation again:
Note that all icon formats have their peculiarities. For example, classic
AmigaOS icons must be palette-based and the palette isn't stored in the icon
file. So if you try to save an icon that only contains 32-bit true colour image
data with alpha channel as a classic AmigaOS icon, Iconic will render the true
colour pixel data down to 4 colours using the Workbench 1.x palette when saving
the icon. This will probably lead to rather unsatisfying results, so for
optimal results you should make sure that the icon you are about to save
contains the pixel data exactly in the format as expected by the respective icon
format.
See the next chapter for an overview of pixel data formats supported by
the individual icon formats supported by Iconic.
So please read the manual more carefully next time. That's what I've written it for after all ;)
amyren
Posts: 352
Joined: Thu May 02, 2019 11:53 am

Re: Rendering Glow Icons

Post by amyren »

airsoftsoftwair wrote: Fri Mar 04, 2022 11:07 pm Well, lots of things in this report could've been by answered by RTFM.
So please read the manual more carefully next time. That's what I've written it for after all ;)
You're right off course.
I have only found that information inside the readme file in the iconic archive, which makes it less accessable than the rest of the documentation.
It would be convinient if it was available from the other docs, or perhaps you plan to implement the iconic functions into the main program later?
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Rendering Glow Icons

Post by airsoftsoftwair »

amyren wrote: Wed Mar 09, 2022 6:45 pm I have only found that information inside the readme file in the iconic archive, which makes it less accessable than the rest of the documentation.
It would be convinient if it was available from the other docs, or perhaps you plan to implement the iconic functions into the main program later?
No, the only reason why Iconic uses merely a readme file is that the documentation is rather short so it's probably not worth going the full-blown PDF/AmigaGuide/HTML/CHM route for it.

Btw, there's one useful discovery in your report, though:
On MorphOS the AmigaOS and PowerIcon will not show any image at all
That's actually a MorphOS bug. I've reported it to the MorphOS team.
Post Reply