As we know, the resolution of VGA is 640×480 and the aspect ratio is 4:3. But if I want to get the resolution about the 16:9 aspect ratio on VGA level, how to calculate it?
Is there any rule to get the right value?
In general, the way to figure out the aspect is like this:
ClippedWidth = ScreenWidth
ClippedHeight = 9 * ScreenWidth / 16
For VGA, that comes out at 640 x 360
.
If it were to come out larger than the actual screen height then you need to reverse the formula:
ClippedWidth = 16 * ScreenHeight / 9
ClippedHeight = ScreenHeight
Note that I have assumed you are trying to fit 16:9 data into 4:3. It's easy to go the other way. In fact, you don't even need the aspect:
ClippedHeight = SourceHeight * ScreenWidth / SourceWidth
or
ClippedWidth = SourceWidth * ScreenHeight / SourceHeight
In all cases, these calculations maintain the concept of square pixels.