SledgeHammer_999
28th July 2009, 21:18
I don't know if this belongs in this category, but it definitely doesn't belong to programming.
I am developing a software player. I am having trouble keeping the correct picture ratio when the Window is resized. But for simplicity I am going to introduce a case scenario:
Let's assume that I have a monitor that operates in 1440*900pixels. Let's assume that my video's dimensions are 720*480. Let's also assume that we go fullscreen and the video has all the display to its disposal. This is how I calculate the new dimensions.
1.I find the ratio between the dimension of the video: width/height=720/480=1.5
2.I check which video dimension is bigger. In our case the width.
3.I make the biggest dimension equal to the equivalent dimension of the available display area. In our case it is the width. So I make the video width=1440.
4.I use the ratio to calculate the other dimension. So height=width/ratio=1440/1.5=960.
5.Then I check if the newly calculated dimension exceeds the equivalent dimension of the available display area. If it does then I make it equal to that dimension and calculate the other dimension(which is bigger). So here the calculated video height is 960. The height of the display area is 900. So I make the video height=900 and recalculate the video width=height*ratio=900*1.5=1350.
So I end up that my video should be displayed in fullscreen in these dimensions 1350*900. But my concern is that other players(vlc/totem/mpc) use fully the available display width(1440). The height should be(in those players) 960 but it isn't. It is even smaller than that, because I can see black-bars above and below.
So obviously I am missing something in my logic. Can you help me?
I am developing a software player. I am having trouble keeping the correct picture ratio when the Window is resized. But for simplicity I am going to introduce a case scenario:
Let's assume that I have a monitor that operates in 1440*900pixels. Let's assume that my video's dimensions are 720*480. Let's also assume that we go fullscreen and the video has all the display to its disposal. This is how I calculate the new dimensions.
1.I find the ratio between the dimension of the video: width/height=720/480=1.5
2.I check which video dimension is bigger. In our case the width.
3.I make the biggest dimension equal to the equivalent dimension of the available display area. In our case it is the width. So I make the video width=1440.
4.I use the ratio to calculate the other dimension. So height=width/ratio=1440/1.5=960.
5.Then I check if the newly calculated dimension exceeds the equivalent dimension of the available display area. If it does then I make it equal to that dimension and calculate the other dimension(which is bigger). So here the calculated video height is 960. The height of the display area is 900. So I make the video height=900 and recalculate the video width=height*ratio=900*1.5=1350.
So I end up that my video should be displayed in fullscreen in these dimensions 1350*900. But my concern is that other players(vlc/totem/mpc) use fully the available display width(1440). The height should be(in those players) 960 but it isn't. It is even smaller than that, because I can see black-bars above and below.
So obviously I am missing something in my logic. Can you help me?