How to get the size of the image knowing the scale given to it when drawing
How to get the size of the image knowing the scale given to it when drawing
Or vice versa.
Code: Select all
loves_lua = "not so",
wants_to = true
-
- Party member
- Posts: 559
- Joined: Wed Oct 05, 2016 11:53 am
Re: How to get the size of the image knowing the scale given to it when drawing
If you have an image, you can get its dimensions with getDimensions. Multiply these by your scaling factor.
Re: How to get the size of the image knowing the scale given to it when drawing
What about vice versa? Divide these by dimensions?MrFariator wrote: ↑Mon Jun 26, 2023 5:07 pm If you have an image, you can get its dimensions with getDimensions. Multiply these by your scaling factor.
Code: Select all
loves_lua = "not so",
wants_to = true
-
- Party member
- Posts: 559
- Joined: Wed Oct 05, 2016 11:53 am
Re: How to get the size of the image knowing the scale given to it when drawing
If you know the scaling factor used to scale up the images while drawing, then you just divide the dimensions by the scaling factor, yeah. Of course, that assumes that you know the resulting drawn dimensions of the image. This is because getDimensions returns the dimensions of the texture, it won't give you the dimensions the image was last drawn with.
Re: How to get the size of the image knowing the scale given to it when drawing
Ok, thanksMrFariator wrote: ↑Mon Jun 26, 2023 5:28 pm If you know the scaling factor used to scale up the images while drawing, then you just divide the dimensions by the scaling factor, yeah. Of course, that assumes that you know the resulting drawn dimensions of the image. This is because getDimensions returns the dimensions of the texture, it won't give you the dimensions the image was last drawn with.
Code: Select all
loves_lua = "not so",
wants_to = true
Who is online
Users browsing this forum: Bing [Bot] and 2 guests