Page 1 of 1

Property to shrink an entire icon

Posted: Thu Jun 25, 2020 6:06 am
by kirazy
Currently the behavior of the scale function within IconSpecification is slightly unintuitive. If you have a 64 pixel icon, for example, and you want to scale it to 85% of its normal size, setting 0.85 as the scale will 'cause it to "zoom in", instead of shrink. It appears that the icon has a fixed render window in the GUI and on the various entities that icons display on (e.g. assembling machine recipes in alt-view).

Inserting a transparent layer that is 64 px and scale = 1, and then rescaling the other layers to 0.85 to achieve the shrunk look produces some side effects:
- In alt-view, the icon gets larger
- The icon shadow that is generated in the GUI is based on the first layer, and since it's empty, there's no shadow.

Rather than having to make a reduced-size icon for every entity that I would like to shrink, I would greatly appreciate some sort of way to shrink an icon in code relative to it's frame in alt-view and in the GUI.

An icon_scale, as it were.

So that I can make this:
mini-electric-mining-drill-icon-base.png
mini-electric-mining-drill-icon-base.png (12.98 KiB) Viewed 479 times
From this:
electric-mining-drill-icon-base.png
electric-mining-drill-icon-base.png (15.39 KiB) Viewed 479 times
By specifying icon_scale = 0.85, instead of having to make a whole new file for every possible permutation.

Edit: Ideally this could be something set (or not set?) for each IconSpecification within an icons definition. So draw a layer at 0.85 scale, and then a layer over that at 1.0 scale.