19 May 2024, 12:44 | #1 |
Registered User
Join Date: Apr 2017
Location: Germany
Posts: 31
|
Wrong aspect ratio for Circle[f]?
Hello.
Sorry, maybe a trivial question. I'm drawing some Circles on a Lo and Hires screen. On Lores it seems like it's almost a circle with correct aspect ratio. But on Hires it seems to be more off. So I suppose Circle doesn't calculate the right aspect ratio on its own depending on the screen. Do I have to do it? How? Cheers |
19 May 2024, 21:40 | #2 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,413
|
Yes, that's correct. The Circle command assumes a 1:1 pixel aspect, so drawing a 20px radius circle will result in a circle 40px wide and 40px tall on the bitmap. A bitmap knows nothing about the aspect ratio of the current screenmode, since it's an independent object by itself so you have to calculate that yourself. If you haven't opened the screen yourself, you can query the size of it using ScreenWidth and ScreenHeight.
Handling it is relatively easy though: once you know the current screen dimensions you can check if it's roughly a 1:2 (hires) or a 1:1 (lores) screen. If it's a lores screen, just draw the circle with the desired radius: Circle xpos, ypos, 20, #pen If it's a hires screen, use the extra parameter to set separate radii for the X and Y axes, with the X radius twice the Y radius: Circle xpos, ypos, 40, 20, #pen |
19 May 2024, 22:51 | #3 |
Registered User
Join Date: Apr 2017
Location: Germany
Posts: 31
|
OK, cool, thanks.
So is the radio something like: ScreenWidth / ScreenHeight * radius ? |
20 May 2024, 02:13 | #4 |
Registered User
Join Date: Feb 2016
Location: Homeless
Posts: 67
|
No, not exactly.
The radio is for audio broadcasts. The ratio is ScreenWidth / ScreenHeight, not including the radius. |
20 May 2024, 10:48 | #5 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,413
|
I see what you're getting at, and the second radius will be something like that, yes. But I would suggest doing it differently because slight variations in screen size will cause slight variations in your circle. And with such low resolutions, often it looks better to have symmetry than perfect X:Y ratios. So I would check if the width of the screen was more than 2* the height, and then make the X radius 2* the Y radius. If the width of the screen is less than 2* the height I would make the X and Y radius the same.
|
07 June 2024, 16:39 | #6 |
Banana
Join Date: Jul 2016
Location: Darmstadt
Posts: 1,217
|
Then you can use a simple left-shift to multiply by 2 and make it much quicker than a multiplication
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Aspect ratio - why circle is not circle? | rotacak | support.WinUAE | 10 | 16 February 2019 22:46 |
Aspect ratio wrong? | Leandro Jardim | support.WinUAE | 2 | 24 September 2013 10:13 |
Wrong aspect ratio | Leandro Jardim | support.WinUAE | 5 | 24 September 2013 04:41 |
Always blurry chars - wrong aspect ratio? | 1988 | support.WinUAE | 26 | 07 July 2011 16:36 |
iGame screenshot aspect ratio wrong? | emuola | support.Apps | 3 | 16 September 2010 05:53 |
|
|