programming forums Java Java JSRs Mobile Certification Databases Caching Books Engineering OS Languages Paradigms IDEs Build Tools Frameworks Products This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Sheriffs:
Saloon Keepers:
Bartenders:

# Screen size conversions?

Tempora Telora
Ranch Hand
Posts: 83
Hello all,

I was wondering if anyone knows the screen size conversion between 1024 x 1028 all permutatations to 800-600?

I am sure there is a utility or some post somewhere but i cannot find it.

I have a screen position on 1024x1028 (example 612, 314) and i need to find that same position on 800x600 and so forth.

Thanks,
Randy

Eric Daly
Ranch Hand
Posts: 143
I don't exactly understand your question, but I think I know what you mean. You have a coordinate on the 1024x1028 screen and you want to know how to find where that coordinate lies if you changed to an 800x600 screen? I believe it's all just ratios. Usually you have an even ratio, like 1024x768, which is the same screen ratio (width / height) as 800x600. The screen is 4x3 and then you just have more pixels on the one screen. However, you say you have a screen that is 1024x1028, that's pretty much a perfect square. And you want to convert that to 800x600, which means you'll definitely be stretching the new screen to fit in the square, otherwise you'd have to cut off the left and right side and lose some of your screen data which you don't want.
Anyhow, my advice is to write your own little conversion utility, it's really easy to do. All you have to do is take the screen position on screen 1, your example was (612, 314). To find the new x coordinate, take 612 divided by the total width which is 1024. You get about 0.598. Now multiply that by the new width which is 800. That's 478.125. Now round (don't just truncate, round up or down accordingly). So your new x coordinate is 478. It's the same thing with the y coordinate. 314 / 1028 = 0.305 * 600 = 183.268 So your new y coordinate is 183.
I'm sure you can write a utility for that, it's very simple. Also if you want to just test this out, get some graph paper or just draw your own couple of graphs, and do the same thing, using smaller numbers. Try maybe drawing out "screen 1" that is 20x21 units, and then "screen 2" that is 16x12. Take some random coordinates and map them using your new algorithm, and see if they end up in the same spots.
If you are actually using this to change your screen size, you may or may not want to stretch the screen, which would take a little more work, but remember it's all ratios, and I really don't think it would take that much more work to figure out.
I hope that helps you. Good luck.

Tempora Telora
Ranch Hand
Posts: 83
Yea that is what I have ended up doing. THOUGH on one of the conversions I am one pixel off. This was just because of a rounding issue.

thanks,

Randy