/* 缩放PictureBox部件的图片浏览区域 */ LCUI_API int PictureBox_ZoomViewArea( LCUI_Widget *widget, double scale ) { LCUI_Graph buff, temp; LCUI_PictureBox *pic_box; pic_box = Widget_GetPrivData(widget); if(!Graph_IsValid(pic_box->image)) { return -1; } Graph_Init(&buff); Graph_Init(&temp); /* 有效范围为2%~2000% */ if(scale < 0.02) { scale = 0.02; } if(scale > 20) { scale = 20; } if(pic_box->size_mode != SIZE_MODE_ZOOM && pic_box->size_mode != SIZE_MODE_BLOCK_ZOOM) { pic_box->size_mode = SIZE_MODE_ZOOM; /* 改为缩放模式 */ } pic_box->scale = scale; Update_BuffGraph(widget); Update_ReadBox(widget); Widget_Draw(widget); Widget_Refresh(widget); return 0; }
int Zoom_PictureBox_View_Area(LCUI_Widget *widget, float scale) /* 功能:缩放PictureBox部件的图片浏览区域 */ { LCUI_Graph buff, temp; LCUI_PictureBox *pic_box; pic_box = Get_Widget_PrivData(widget); if(!Graph_Valid(pic_box->image)) { return -1; } Graph_Init(&buff); Graph_Init(&temp); /* 有效范围为2%~2000% */ if(scale < 0.02) { scale = 0.02; } if(scale > 20) { scale = 20; } if(pic_box->size_mode != SIZE_MODE_ZOOM && pic_box->size_mode != SIZE_MODE_BLOCK_ZOOM) { pic_box->size_mode = SIZE_MODE_ZOOM; /* 改为缩放模式 */ } pic_box->scale = scale; Update_BuffGraph(widget); Update_ReadBox(widget); Draw_Widget(widget); Refresh_Widget(widget); return 0; }