Page 1 of 1

How to get the size of the image knowing the scale given to it when drawing

Posted: Mon Jun 26, 2023 5:03 pm
by notcl4y
Or vice versa.

Re: How to get the size of the image knowing the scale given to it when drawing

Posted: Mon Jun 26, 2023 5:07 pm
by MrFariator
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

Posted: Mon Jun 26, 2023 5:16 pm
by notcl4y
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.
What about vice versa? Divide these by dimensions?

Re: How to get the size of the image knowing the scale given to it when drawing

Posted: Mon Jun 26, 2023 5:28 pm
by MrFariator
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

Posted: Mon Jun 26, 2023 5:54 pm
by notcl4y
MrFariator 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.
Ok, thanks