ITPub博客

首页 > Linux操作系统 > Linux操作系统 > screenshot in Android - 4

screenshot in Android - 4

原创 Linux操作系统 作者:MagicProgram 时间:2012-06-15 12:58:50 0 删除 编辑
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/,如需转载,请注明出处,否则将追究法律责任。

下一篇: modSecurity 安装
请登录后发表评论 登录
全部评论

注册时间:2011-02-24

  • 博文量
    29
  • 访问量
    117815