Currently, composition sprites seem hard-coded to assume the inner size is 1x1, like shown on the cross in the diagram below:
Image taken from this forum post.
This is problematic as it mandates solid colour in the interior of the rendered sprite. If I want a gradient, for example, I have no way (that I know of) to increase the vertical width or horizontal height of that inner cross. I've searched the stye sheets from base game and numerous mods but not seen any properties for setting the dimensions of that inner cross.
To solve this issue, I'd like an inner_size property adding to composition style sheets. For example, if I wanted my composition to be based on this image (a black button with a red indicator on the left):
I'd set corner_size = {9,4} and inner_size = {1,25} (the horizontal height of the cross would be 25 px, enabling me to get a chunk of gradient that will stretch over the main part of the button when rendered in game).
Note: If no inner_size is specified, it should default to {1,1} for backwards compatibility.
As there is already code to stretch sprites to arbitrary dimensions (eg. how the monolith sprites work) hopefully this request will be feasible. It will make it significantly easier to add subtle gradients to UI elements without resorting to fixed size monolith sprites or clunky grid (table) arrangements of buttons where each button has a monolith grabbed from the source image (yeuch!).
inner_size property for composition sprites
- aubergine18
- Smart Inserter
- Posts: 1264
- Joined: Fri Jul 22, 2016 8:51 pm
- Contact:
inner_size property for composition sprites
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.
- aubergine18
- Smart Inserter
- Posts: 1264
- Joined: Fri Jul 22, 2016 8:51 pm
- Contact:
Re: inner_size property for composition sprites
Another alternative would be to have .width and .height properties on composition sprites. If not specified, they'd be calculated by (2*relevant_corner) + 1 so as to maintain backwards compatibility.
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.