Everyone knows that the android device supports free rotation, however, my application just copes the framebuffer and builds jpeg files with solid resolution. The problem is how to transfer the framebuffer matrix into the correct matrix, during the rotation.
Let me give a sketch map for explanation as bellows.
(Aij) (Bmn)
0 1 2 3 4 a 5 0
5 6 7 8 9 ====> b 6 1
a b c d e c 7 2
d 8 3
e 9 4
So we should realign the jpeg matrix Bmn from the original Aij and the key problem is getting the relationship between mn and ij. (which (m, n), (i, j) is the coordinate)
if rotate the screen 90 degree in the time order, then the relationship will be
{i = height - 1 - n; j = m}.
if rotate the screen 180 degree in the time order, then it will be
{i = height - 1 - m; j = width - 1 - n}.
if rotate the screen 270 degree in the time order, then it will be
{i = n; j = width - 1 - m}.
According these rules, you can get the correct jpeg files even rotating devices.
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/25432352/viewspace-732929/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/25432352/viewspace-732929/