|
楼主 |
发表于 2009-9-24 16:26:44
|
显示全部楼层
代码传上来,以备后人学习,呵呵
[em16][em16]
void mmi_test_pen_move_hdlr(mmi_pen_point_struct point)
{
DrawCate888PenState((S8 *)"Pen Move",point);
if(isImgPress==MMI_TRUE)
{
S16 offsetMoveX;
S16 offsetMoveY;
static mmi_pen_point_struct penMovePOS; //记录上次检测到move时pen的坐标
static mmi_pen_point_struct imgCurrPOS; //记录上次图片的坐标
penMovePOS.x=penDownPos.x;
penMovePOS.y=penDownPos.y;
imgCurrPOS.x=imgOriginalPos.x;
imgCurrPOS.y=imgOriginalPos.y;
offsetMoveX=point.x-penMovePOS.x; //当前检测到MOVE的坐标与上次检测到MOVE坐标差
offsetMoveY=point.y-penMovePOS.y; //即是图片需要的偏移量
penMovePOS.x=point.x;
penMovePOS.y=point.y;
imgCurrPOS.x+=offsetMoveX;
imgCurrPOS.y+=offsetMoveY;
gdi_layer_set_active(my_layer);
gui_push_clip();//推进层
//gdi_draw_solid_rect(imgCurrPOS.x-offsetMoveX,imgCurrPOS.y-offsetMoveY,imgCurrPOS.x-offsetMoveX+imgW,imgCurrPOS.y-offsetMoveY+imgH,GDI_COLOR_TRANSPARENT);
gdi_draw_solid_rect(0,0,UI_device_width-1,UI_device_height-1,GDI_COLOR_TRANSPARENT);
gdi_image_draw_id(imgCurrPOS.x,imgCurrPOS.y, IMG_TEST_RED_FLOWER);
gui_pop_clip();//推出层
gdi_layer_get_base_handle(&base_layer);
gdi_layer_set_active(base_layer);
gdi_layer_set_blt_layer(base_layer,my_layer,NULL,NULL);
gui_BLT_double_buffer(0,0,UI_device_width-1,UI_device_height-1);
//gui_BLT_double_buffer(0,0,UI_device_width-1,50);
}
} |
|