I want to get the equivalent pixel location of two different wide resolutions.
Here is an example.
In a 1366x768 resolution, the desired pixel is located in row 120 and column 300. I want to convert it to a lower resolution and get the equivalent of 120x300 point from the original to the converted one.
Use percent.
e.g. 120/1366=60/683
=x ~ 0.0878
and 300/768=25/64
=y ~ 0.3906
. Now simply multiply these percent with your desired resolution.
For example if you have the resolution 800x600
and want this position just multiply.
x = 800 * 0.0878 = 70.24
y = 600 * 0.3906 = 234.36
This works because the position got kindof 'normalized' so that it lays between 0
and 1
. Whatever you multiply this with will have same 'dimensions'. e.g. assume we want the position 400x300
from screen 800x600
in another screen so that it has same ratios. We can do similiar to your problem up there:
x = 400 / 800 = 0.5
y = 300 / 600 = 0.5
To get the position for any other screen we multiply the result from there with the resolution.