Query about icon scaling

Place to get help with not working mods / modding interface.
User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2529
Joined: Fri Nov 06, 2015 7:41 pm

Query about icon scaling

Post by Deadlock989 »

This is a quirk (seems to me) with scaling for layered icons, just wanted to know if this is working as intended or if it could be a feature request or even a bug.

If you do something like this:

Code: Select all

		itemcopy.icons = {
			{
				icon = "__whatever__/path-to-something.png",
				scale = 0.75,
				shift = {0, -3},
			},
			{
				icon = "__whatever__/path-to-something.png",
				scale = 0.75,
				shift = {0, 0},
			},
			{
				icon = "__whatever__/path-to-something.png",
				scale = 0.75,
				shift = {0, 3},
			},
		}
then the icon is rendered as if all three scales were 1. It's as though the scale for every layer after the first is actually based on the scale of the first layer. If the first layer is scaled to 0.5 then it still fills the 32x32 "window" for the icon and all the scales of the successive layers are rendered in whatever proportion they have to 0.5.

Use case: I'm auto-generating icons based on existing icons. I want three of them scaled down slightly, with different offsets. They have to be scaled down because icons exist which fill the available space, so they need to be shrunk slightly for the offset. To make this work, I have to insert a completely transparent .png as the first layer with a scale of 1, adding CPU and maybe GPU overhead. This might be insignificant but the icons concerned are for things which appear on belts, so there could be literally thousands of them on-screen at any one time.

Does this seem odd to anyone else?
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Query about icon scaling

Post by eradicator »

Icons are aways scaled to the intended size. That is 32 for in-world, 128 for technology etcpp. Regardless of what the "actual" size of the bitmap is. Scale doesn't have anything to do with it. If you made a fresh icon of size 16, and specified as icon_size = 16, it would still have the same size as all other items in the world. I actuall sometimes use entity sprites as item icons if i don't want to make a seperate icon.
Post Reply

Return to “Modding help”