[id] = LoadIcon(id, filename$[, table])
filename$
into memory and
assigns the identifier id
to it. If you pass Nil in id
, LoadIcon()
will automatically choose an identifier and return it.
In Hollywood, an icon is a collection of the same image in different sizes. By using individually designed images for each size instead of just scaling one and the same image to each size, a better quality is achieved, especially when it comes to smaller image sizes, which look much better when they are specifically designed for their resolution. Additionally, each image inside an icon set can have two different states: normal and selected. Normally, you only ever need the normal state, but on AmigaOS and compatibles the selected state is sometimes used as well. Typical sizes for the individual images within an icon are 16x16, 24x24, 32x32, 48x48, 64x64, 96x96, 128x128, 256x256, and 512x512, but they can also be completely arbitrary. The advantage of having the same image in different sizes in an icon is that Hollywood can choose an appropriate size depending on the screen resolution.
The icon passed in filename$
must be in Hollywood's custom PNG icon format. You
can use SaveIcon() to create such icons. Note that although
Hollywood icons are normal PNG images, they contain additional metadata
which is why you mustn't edit them with your favourite image manipulation
tool because that might lead to the loss of said metadata. Hollywood icons
should only ever be created by using the SaveIcon()
function.
If you don't want to use Hollywood's custom icon format, you can also create icons from brushes or normal images using the CreateIcon() function or the @ICON preprocessor command. Those commands also have the advantage that you can use vector brushes, which can be losslessly scaled to any size, leading to a perfectly crisp look in all kinds of different resolutions.
The third argument is optional. It is a table that can be used to set further options for the loading operation. The following fields of the table can be used:
Loader:
Adapter:
UserTags:
This command is also available from the preprocessor: Use @ICON to preload icons.
LoadIcon(1, "test.png")This loads "test.png" as icon 1.