Types/IconData: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
(link mipmap fff)
(→‎Notes: moved notes from Types/IconSpecification)
Line 48: Line 48:
== Notes ==
== Notes ==


* The rendering order of the individual icons follows the table (array) order: Later added icons (higher index) get drawn on top of previously added icons (lower index).
* Only the first icon layer will display a shadow.
* Only the first icon layer will display a shadow.
* When the final icon is displayed with transparency (e.g. a faded out alert), the icon layer overlap may look undesirable.[https://forums.factorio.com/viewtopic.php?p=575844#p575844]
* The final combination of icons will always be resized in GUI based on the first icon layer's size, but won't be resized when displayed on machines in alt-mode.
* The final combination of icons will always be resized in GUI based on the first icon layer's size, but won't be resized when displayed on machines in alt-mode.
: (example: recipe first icon layer is size 128, scale 1, the icon group will be displayed at resolution /4 to fit the 32px GUI boxes, but will be displayed 4 times as large on buildings)
: (example: recipe first icon layer is size 128, scale 1, the icon group will be displayed at resolution /4 to fit the 32px GUI boxes, but will be displayed 4 times as large on buildings)

Revision as of 10:29, 18 October 2022

Basics

Data of one icon "layer" for the icons property of the Types/IconSpecification.

Mandatory properties

icon

Type: Types/FileName

The path to the icon.

icon_size

Type: Types/SpriteSizeType

Mandatory if icon_size is not specified outside of icons. The size of the square icon, in pixels, e.g. 32 for a 32px by 32px icon.

Optional properties

tint

Type: Types/Color

Default: {r=1, g=1, b=1, a=1} (white)

Tint of the icon.

shift

Type: Types/vector

Default: {0, 0}

Used to offset the icon "layer" from the overall icon.
The shift is applied from the center (so negative shifts are left and up, respectively). Shift uses the unit "pixels after scaling", see #Notes.

scale

Type: Types/double

Default for items/recipes: (32/icon_size)

Default for technologies: (256/icon_size)

When set, specifies the scale of the icon on the GUI scale.
Scale 2 means that the icon will be 2 times bigger on screen (and more pixelated).

icon_mipmaps

Type: Types/uint8

Default: 0

Icons of reduced size will be used at decreased scale. 0 or 1 mipmaps is a single image. The file must contain 1/2 size images with a geometric-ratio, for each mipmap level. Each next level is aligned to the upper-left corner. Example sequence: 128x128@(0,0), 64x64@(128,0), 32x32@(196,0) is 3 mipmaps.
See also Factorio Friday Facts #291 about the visual effects of icon mipmaps.

Notes

  • The rendering order of the individual icons follows the table (array) order: Later added icons (higher index) get drawn on top of previously added icons (lower index).
  • Only the first icon layer will display a shadow.
  • When the final icon is displayed with transparency (e.g. a faded out alert), the icon layer overlap may look undesirable.[1]
  • The final combination of icons will always be resized in GUI based on the first icon layer's size, but won't be resized when displayed on machines in alt-mode.
(example: recipe first icon layer is size 128, scale 1, the icon group will be displayed at resolution /4 to fit the 32px GUI boxes, but will be displayed 4 times as large on buildings)
  • Shift values are based on final size (icon_size * scale) of the first icon.

Examples

{
  icon = "__base__/graphics/icons/fluid/heavy-oil.png",
  icon_size = 64,
  scale = 0.5,
  shift = {4, -8}
}