Hello,
my question is kind of similar to this in a way:
https://answers.microsoft.com/en-us/windows/forum/all/regarding-the-object-position-across-different/ab638147-e2c0-41b0-9c61-6e8bd2ac7976
what my problem is:
I program in java and use the "robot" class there to get color info on a certain pixel or click stuff on a given coordinate.
anyways, all stuff there is based on a given cooordinate.
so I wrote my program and the used coordinates were measured (with said Robots .getPixel(x,y) method) depending on the currently chosen resolution of 1920 x 1080 and text scaling of 125%.
anyways, when using said robot class, the pixel positions go from (0,0) (left top corner) to (1535, 861) (bottom right corner).
so "virtual" dimensions of 1536 x 862
so the "initial" length and height of 1920 x 1080 are taken and divided by 125%=1.25, aka the scaling factor.
so far, so good.
however now I wanna use that very same program in a virtual machine, namely virtual box and use windows 10 there as well.
To make things as close to before as possible, I'll also use 125% scaling and try to make basically everything the same.
sadly, for obvious reasons I cant make the resolution to 1920 x 1080 as well
but can only chose the next smallest resolution (1640 x.. or such).
Now I have come to wonder, given a coordinate measured in the previous setup, how can I calculate its new coordinate?
I would asusme that it goes simply via
xnew=xold*newscreenlength/oldscreenlength , in this case xnew=xold*1640/1920
similar thing for the y coordinate.
but thgats jsut a wild guess from me.
I dont know, if when changing resolutions, windows really scalles things as if coordinates were jsut vectors from top left to the wante dpoint and they jsut get strechted or scaled according to the x and y stretching.
or if the behaviour doesnt change that linear at all.
so has anyone confirmed knowledge how these "virtual" coordinates are transformed when switching reolutions, is it really jsut a simple linear stretching or how does it work?