#include "include.h" #define TRACE_EN 0 #if TRACE_EN #define TRACE(...) printf(__VA_ARGS__) #else #define TRACE(...) #endif compo_symbol_t *compo_symbol_create(compo_form_t *frm, u32 res_addr,u8 radix,u16 x,u16 y,bool hide)// u8 num_cnt,u8 radix,u16 x,u16 y,bool hide) { compo_symbol_t *symbol = compo_create(frm, COMPO_TYPE_SYMBOL); widget_page_t *page = frm->page_body; // symbol->num_cnt = num_cnt-1; //需要进行图像裁剪 widget_image_t *img = widget_image_create(page, res_addr); if (symbol->num_wid == 0) { area_t area = gui_image_get_size(res_addr); symbol->num_wid = area.wid; symbol->num_hei = area.hei / radix; } widget_set_size(img, symbol->num_wid, symbol->num_hei); symbol->img_num = img; //printf("symbol->num_cnt * symbol->num_hei--->%d\n",symbol->num_cnt * symbol->num_hei); // printf("symbol->num_hei--->%d\n",symbol->num_hei); widget_set_pos(symbol->img_num, x, y); widget_set_visible(symbol->img_num, hide); return symbol; } void compo_symbol_set_num(compo_symbol_t *symbol, u8 num_cnt) { symbol->num_cnt = num_cnt-1; widget_image_cut(symbol->img_num, 0, symbol->num_cnt * symbol->num_hei, symbol->num_wid, symbol->num_hei); } void compo_symbol_set_coordinate(compo_symbol_t *symbol, u16 x,u16 y) { widget_set_pos(symbol->img_num, x, y); }