找回密码
 注册
搜索
查看: 1496|回复: 6

[讨论] MTK图片中心旋转疑问

[复制链接]
发表于 2011-6-26 16:15:13 | 显示全部楼层 |阅读模式
求教怎么把图片根据任意一个角度以中心旋转呢?类似指南针转盘。
发表于 2011-6-28 18:49:42 | 显示全部楼层
http://www.52rd.com/Blog/Detail_RD.Blog_kingrain_21916.html
点评回复

使用道具 举报

发表于 2011-6-28 15:42:25 | 显示全部楼层
高人多呀。[em02][em02]
点评回复

使用道具 举报

发表于 2011-6-28 12:52:21 | 显示全部楼层
收藏保存,学习了。
点评回复

使用道具 举报

发表于 2011-6-28 12:31:39 | 显示全部楼层
学习下!~~
点评回复

使用道具 举报

发表于 2011-6-28 09:31:08 | 显示全部楼层
void gdi_image_Rotate_Slope(double x,double y ,double dx ,double dy ,U16 IMAGE_ID,double cosn,double sinn)
{
S32 i,
j,
n,
imge_width,
imge_width2,
imge_height,
imge_height2,
transit_layer_buff_size1,
transit_layer_buff_size2;
U16* transit_layer_buff_ptr1,
* transit_layer_buff_ptr2;
U16 a,r,g,b;
gdi_handle      transit_layer1,transit_layer2,last_active_layer;
S32 j2,i2;
double wb,x0,y0,x1,y1,u,v;

gdi_layer_multi_layer_enable();

gdi_image_get_dimension_id(IMAGE_ID,&imge_width,&imge_height);
transit_layer_buff_size1=((imge_width)*(imge_height)*16)>>3;
transit_layer_buff_ptr1=(U16*)mmi_frm_scrmem_alloc(transit_layer_buff_size1);
gdi_layer_create_using_outside_memory(0,0,imge_width,imge_height,&transit_layer1,(PU8)transit_layer_buff_ptr1,transit_layer_buff_size1);
gdi_layer_push_and_set_active(transit_layer1);
gdi_layer_clear(GDI_COLOR_BLUE);
gdi_layer_set_source_key(TRUE, GDI_COLOR_BLUE);
gdi_image_draw_id(0,0,IMAGE_ID);
gdi_layer_pop_and_restore_active();

imge_width2=240;
imge_height2=320;
transit_layer_buff_size2=(imge_width2*imge_height2*16)>>3;
transit_layer_buff_ptr2=(U16*)mmi_frm_scrmem_alloc(transit_layer_buff_size2);
gdi_layer_create_using_outside_memory(0,0,imge_width2,imge_height2,&transit_layer2,(PU8)transit_layer_buff_ptr2,transit_layer_buff_size2);
gdi_layer_push_and_set_active(transit_layer2);
gdi_layer_clear(GDI_COLOR_BLUE);
gdi_layer_set_source_key(TRUE, GDI_COLOR_BLUE);


for(i=0;i<imge_height2;i++)
{
for(j=0;j<imge_width2;j++)
   {
   x0=((double)j-x)*cosn+((double)i-y)*sinn+dx;
   y0=((double)i-y)*cosn-((double)j-x)*sinn+dy;
   //x0=(j-x)*cosn+(i-y)*sinn;
   //y0=imge_height+(i-y)*cosn-(j-x)*sinn;
   j2=(S32)x0;
   i2=(S32)y0;

   if((i2<(imge_height-1))&&(j2<(imge_width-1))&&(i2>0)&&(j2>0))
    {

    v=y0-i2;
    u=x0-j2;
    if(u>0.5)
     j2++;
    if(v>0.5)
     i2++;
    *(transit_layer_buff_ptr2+(i)*imge_width2+j) = *(transit_layer_buff_ptr1+i2*imge_width+j2);

   }
   }
}

gdi_layer_pop_and_restore_active();
gdi_layer_get_active(&last_active_layer);
gdi_layer_flatten(last_active_layer,transit_layer2,NULL,NULL);
//gdi_layer_set_blt_layer(last_active_layer,transit_layer2,NULL,NULL);
gdi_layer_free(transit_layer1);
gdi_layer_free(transit_layer2);
mmi_frm_scrmem_free(transit_layer_buff_ptr1);
mmi_frm_scrmem_free(transit_layer_buff_ptr2);
gdi_layer_multi_layer_disable();
}
点评回复

使用道具 举报

发表于 2011-6-27 12:50:55 | 显示全部楼层
关注学习下!
点评回复

使用道具 举报

高级模式
B Color Image Link Quote Code Smilies

本版积分规则

Archiver|手机版|小黑屋|52RD我爱研发网 ( 沪ICP备2022007804号-2 )

GMT+8, 2024-12-26 22:15 , Processed in 0.051424 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表