Specify size in draw_sprite
Posted: Fri Aug 30, 2024 6:10 pm
I would like to request the ability to pass a specific size (height, width) when calling LuaRendering draw_sprite.
Currently, you can specify a scale, but this only really works if you know the original size of the sprite, which we don't at runtime (unless you are the author of the sprite, and you are confident a mod hasn't messed with it).
What does work: If you use a sprite LuaGuiElement, and specify a height and width on its LuaStyle, and specify resize_to_sprite as false, then it will render the sprite scaled to the size you've declared. Since this is feasible, I have to wonder if the same is feasible with LuaRendering.
How I imagine this might work:
Similar to draw_rectangle, pass in left_top and right_bottom to specify the size of the sprite, as an alternative to draw_sprite's existing target parameter. Perhaps think of this as a request for a draw_rectangle method where you pass in a sprite instead of its existing color/filled parameters.
My gut says this will be impossible for reasons I don't currently understand, but I can't find anywhere that this has specifically been requested before..
Currently, you can specify a scale, but this only really works if you know the original size of the sprite, which we don't at runtime (unless you are the author of the sprite, and you are confident a mod hasn't messed with it).
What does work: If you use a sprite LuaGuiElement, and specify a height and width on its LuaStyle, and specify resize_to_sprite as false, then it will render the sprite scaled to the size you've declared. Since this is feasible, I have to wonder if the same is feasible with LuaRendering.
How I imagine this might work:
Similar to draw_rectangle, pass in left_top and right_bottom to specify the size of the sprite, as an alternative to draw_sprite's existing target parameter. Perhaps think of this as a request for a draw_rectangle method where you pass in a sprite instead of its existing color/filled parameters.
My gut says this will be impossible for reasons I don't currently understand, but I can't find anywhere that this has specifically been requested before..