//////////////////////////////////////////////////////////////////////////////// #include "System/SysCommon.h" #include "WiFiIpc/nvtwifi.h" #include "UIDateImprint.h" #include "UIDateImprintID.h" #include "Mode/UIMode.h" #include "PhotoFastCapDateImprint.h" #include "UIAppPhoto.h" #include "GxVideoFile.h" #include #include "kwrap/type.h" #include "vf_gfx.h" #include "PhotoFastCapDateImprint.h" #include "vendor_isp.h" #include "UIApp/MovieStamp/MovieStamp.h" #define THIS_DBGLVL 2 // 0=FATAL, 1=ERR, 2=WRN, 3=UNIT, 4=FUNC, 5=IND, 6=MSG, 7=VALUE, 8=USER /////////////////////////////////////////////////////////////////////////////// #define __MODULE__ PhotoFastCapDateImprint #define __DBGLVL__ ((THIS_DBGLVL>=PRJ_DBG_LVL)?THIS_DBGLVL:PRJ_DBG_LVL) #define __DBGFLT__ "*" //*=All, [mark]=CustomClass #include #include "UIInfo/UIInfo.h" #include "sf_battery.h" #include "sf_mcu.h" #if PHOTO_STAMP_ISP_STATUS == DISABLE char StampStr[256] = {0}; static char* PhotoFast_InitStrBuf(void) { char *dateStr = NULL; INT16 cTemper = 0; INT16 fTemper = 0; UINT8 temperStr[16] = {0}; UIMenuStoreInfo *puiPara = sf_ui_para_get(); DateTime_Load(); switch (UI_GetData(FL_DATE_STAMP)) { case DATEIMPRINT_DATE: dateStr = DateTime_MakeYMD(); break; case DATEIMPRINT_DATE_TIME: default: if(SF_CAM_MODE_VIDEO2 == puiPara->CamMode){ dateStr = sf_get_date_time_make_ymdhms(); } else { dateStr = DateTime_MakeYMDHMS(); } break; } sf_stamp_temperature_get(&fTemper, &cTemper); snprintf((char *)temperStr, sizeof(temperStr), "%d%c%cF %d%c%cC", fTemper, 0xC2, 0xB0, cTemper, 0xC2, 0xB0); printf("[%s:%d]temperStr=%s\n", __FUNCTION__, __LINE__, temperStr); snprintf((char *)StampStr, sizeof(StampStr), "%s %s", temperStr, dateStr); printf("[%s:%d]StampStr=%s\n", __FUNCTION__, __LINE__, StampStr); return StampStr; } /************************************************************************* * Important!! * * check font resource is in the lds ************************************************************************/ void PhotoFast_SelStampFont(UINT32 uiImageWidth, char **font, UINT32 *ScaleFactor) { #if defined(_UI_STYLE_LVGL_) lv_plugin_res_id red_id; if(uiImageWidth >=1920) { red_id = LV_USER_CFG_STAMP_FONT_ID_LARGE; } else if(uiImageWidth >=1080) { red_id = LV_USER_CFG_STAMP_FONT_ID_MEDIUM; } else if(uiImageWidth >=640) { red_id = LV_USER_CFG_STAMP_FONT_ID_SMALL; } else if(uiImageWidth >=320) { red_id = LV_USER_CFG_STAMP_FONT_ID_SMALL; } else { red_id = LV_USER_CFG_STAMP_FONT_ID_XS; } printf("[%s:%d]uiImageWidth=%d,stamp font id=%d\n", __FUNCTION__, __LINE__, uiImageWidth, red_id); // DBG_DUMP("**** red_id = %lu\n", red_id); *font = (char *) lv_plugin_get_font(red_id)->font; #else if (uiImageWidth >= 3840) { *font = (char *)gDateStampFontTbl56x96; *ScaleFactor = 65536; } else if(uiImageWidth >=3600) { *font = (char *)&gDateStampFontTbl56x96; *ScaleFactor = 65536*95/100; } else if(uiImageWidth >=3200) { *font = (char *)&gDateStampFontTbl56x96; *ScaleFactor = 65536*90/100; } else if(uiImageWidth >=2880) { *font = (char *)&gDateStampFontTbl42x72; *ScaleFactor = 65536; } else if(uiImageWidth >=1920) { *font = (char *)&gDateStampFontTbl36x60; *ScaleFactor = 65536; } else if(uiImageWidth >=1080) { *font = (char *)&gDateStampFontTbl26x44; *ScaleFactor = 65536; } else if(uiImageWidth >=640) { *font = (char *)&gDateStampFontTbl12x20; *ScaleFactor = 65536; } else if(uiImageWidth >=320) { *font = (char *)&gDateStampFontTbl10x16; *ScaleFactor = 65536; } else { *font = (char *)&gDateStampFontTbl10x16; *ScaleFactor = 65536/3; } #endif } #endif #if defined(_UI_STYLE_LVGL_) #include "UIApp/lv_user_font_conv/lv_user_font_conv.h" /* YUV color key */ #define CKEY_Y 0x0 #define CKEY_U 0x80 #define CKEY_V 0x80 #define CKEY ((CKEY_Y & 0xFF) | ((CKEY_U & 0xFF) << 8) | ((CKEY_V & 0xFF) << 16)) #define LV_USER_FONT_CONV_ALIGN_W 8 #define LV_USER_FONT_CONV_ALIGN_H 2 #define IMG_ID LV_PLUGIN_IMG_ID_ICON_ADAS_CAL_M #define STRING "Novatek Hunting Camera Demo" #define FONT LV_USER_CFG_STAMP_FONT_ID_MEDIUM typedef struct { lv_user_font_conv_draw_cfg draw_cfg; lv_user_font_conv_mem_cfg mem_cfg; lv_user_font_conv_calc_buffer_size_result buff_size; } PhotoFastCapDateImprint_Info; char photo_aesteam[128]={0}; extern UINT16 IRSHTTER; //extern UINT32 Cap_cnt; extern UINT32 ae_preset_exp; extern UINT32 ae_preset_iso; //static PhotoFastCapDateImprint_Info stamp_img = {0}; static PhotoFastCapDateImprint_Info stamp_text = {0}; static void* stamp_pri_va = 0; static UINT32 stamp_pri_pa = 0; void PhotoStamp_get_isp_status_jpg(UINT32 id, char* Buf, UINT32 BufLen) { AET_STATUS_INFO ae_status = {0}; AWBT_STATUS awb_status = {0}; IQT_WDR_PARAM wdr = {0}; //IQT_3DNR_PARAM nr_3d = {0}; //IQT_DEFOG_PARAM defog = {0}; id = 0; ae_status.id = id; if(vendor_isp_init()== HD_ERR_NG) DBG_ERR("init error\r\n"); vendor_isp_get_ae(AET_ITEM_STATUS, &ae_status); awb_status.id = id; vendor_isp_get_awb(AWBT_ITEM_STATUS, &awb_status); wdr.id = id; vendor_isp_get_iq(IQT_ITEM_WDR_PARAM, &wdr); //nr_3d.id= id; //vendor_isp_get_iq(IQT_ITEM_3DNR_PARAM, &nr_3d); //defog.id = id; //vendor_isp_get_iq(IQT_ITEM_DEFOG_PARAM, &defog); struct tm Curr_gsDateTime ={0}; Curr_gsDateTime = hwclock_get_time(TIME_ID_CURRENT); //sprintf(strStampDateTime, "%04d/%02d/%02d %02d:%02d:%02d", Curr_gsDateTime.tm_year, Curr_gsDateTime.tm_mon, Curr_gsDateTime.tm_mday, Curr_gsDateTime.tm_hour, Curr_gsDateTime.tm_min, Curr_gsDateTime.tm_sec); #if 1 //snprintf(Buf, BufLen, "%d %d %3d %4d %4d %4d %4d %d %4d %4d %4d %4d %04d/%02d/%02d %02d:%02d:%02d %d%c", //snprintf(Buf, BufLen, "6 %d %d %3d %4d %4d %d %d %d %4d %4d %4d %4d %4d%c",// %d%c", /*snprintf(Buf, BufLen, "%d %d %3d %4d %4d %d %d %d %4d %4d %4d %4d %4d%c %04d/%02d/%02d %02d:%02d:%02d", (INT)(ae_status.status_info.iso_gain[0]), (INT)(ae_status.status_info.expotime[0]), (INT)(ae_status.status_info.lv/100000), (INT)(ae_status.status_info.lum), (INT)(ae_status.status_info.expect_lum), (INT)(ae_status.status_info.overexp_adj), (INT)(ae_status.status_info.overexp_cnt), (INT)(wdr.wdr.enable), (INT)(awb_status.status.cur_r_gain), (INT)(awb_status.status.cur_g_gain), (INT)(awb_status.status.cur_b_gain), (INT)(awb_status.status.cur_ct), (INT)(IRSHTTER), Curr_gsDateTime.tm_year, Curr_gsDateTime.tm_mon, Curr_gsDateTime.tm_mday, Curr_gsDateTime.tm_hour, Curr_gsDateTime.tm_min, Curr_gsDateTime.tm_sec, //(INT)(Init_Adc), //(INT)(nr_3d._3dnr.enable), '\0' );*/ //DBG_DUMP("isp Buf=%s\r\n",Buf); snprintf(Buf, BufLen, "%d %d %3d %d %d %3d %3d %3d %4d %d %d %d %d %02d/%02d %02d:%02d:%02d", (INT)(ae_status.status_info.state_adj), (INT)(ae_status.status_info.lum), (INT)(ae_status.status_info.expect_lum), (INT)(ae_status.status_info.iso_gain[0]), (INT)(ae_status.status_info.expotime[0]), (INT)(ae_status.status_info.lv/100000), (INT)(awb_status.status.cur_r_gain), (INT)(awb_status.status.cur_b_gain), (INT)(awb_status.status.cur_ct), IRSHTTER, 0, /* Cap_cnt,*/ ae_preset_exp, ae_preset_iso, //Curr_gsDateTime.tm_year, Curr_gsDateTime.tm_mon, Curr_gsDateTime.tm_mday, Curr_gsDateTime.tm_hour, Curr_gsDateTime.tm_min, Curr_gsDateTime.tm_sec); DBG_IND("%s:%d Buf=%s\r\n",__FUNCTION__,__LINE__,Buf); #endif vendor_isp_uninit(); return; } void PhotoStamp_get_isp_status(UINT32 id, char* Buf, UINT32 BufLen) { AET_STATUS_INFO ae_status = {0}; AWBT_STATUS awb_status = {0}; IQT_WDR_PARAM wdr = {0}; //IQT_3DNR_PARAM nr_3d = {0}; //IQT_DEFOG_PARAM defog = {0}; id = 0; ae_status.id = id; if(vendor_isp_init()== HD_ERR_NG) DBG_ERR("init error\r\n"); vendor_isp_get_ae(AET_ITEM_STATUS, &ae_status); awb_status.id = id; vendor_isp_get_awb(AWBT_ITEM_STATUS, &awb_status); wdr.id = id; vendor_isp_get_iq(IQT_ITEM_WDR_PARAM, &wdr); //nr_3d.id= id; //vendor_isp_get_iq(IQT_ITEM_3DNR_PARAM, &nr_3d); //defog.id = id; //vendor_isp_get_iq(IQT_ITEM_DEFOG_PARAM, &defog); struct tm Curr_gsDateTime ={0}; Curr_gsDateTime = hwclock_get_time(TIME_ID_CURRENT); //sprintf(strStampDateTime, "%04d/%02d/%02d %02d:%02d:%02d", Curr_gsDateTime.tm_year, Curr_gsDateTime.tm_mon, Curr_gsDateTime.tm_mday, Curr_gsDateTime.tm_hour, Curr_gsDateTime.tm_min, Curr_gsDateTime.tm_sec); #if 1 //snprintf(Buf, BufLen, "%d %d %3d %4d %4d %4d %4d %d %4d %4d %4d %4d %04d/%02d/%02d %02d:%02d:%02d %d%c", //snprintf(Buf, BufLen, "6 %d %d %3d %4d %4d %d %d %d %4d %4d %4d %4d %4d%c",// %d%c", /*snprintf(Buf, BufLen, "%d %d %3d %4d %4d %d %d %d %4d %4d %4d %4d %4d%c %04d/%02d/%02d %02d:%02d:%02d", (INT)(ae_status.status_info.iso_gain[0]), (INT)(ae_status.status_info.expotime[0]), (INT)(ae_status.status_info.lv/100000), (INT)(ae_status.status_info.lum), (INT)(ae_status.status_info.expect_lum), (INT)(ae_status.status_info.overexp_adj), (INT)(ae_status.status_info.overexp_cnt), (INT)(wdr.wdr.enable), (INT)(awb_status.status.cur_r_gain), (INT)(awb_status.status.cur_g_gain), (INT)(awb_status.status.cur_b_gain), (INT)(awb_status.status.cur_ct), (INT)(IRSHTTER), Curr_gsDateTime.tm_year, Curr_gsDateTime.tm_mon, Curr_gsDateTime.tm_mday, Curr_gsDateTime.tm_hour, Curr_gsDateTime.tm_min, Curr_gsDateTime.tm_sec, //(INT)(Init_Adc), //(INT)(nr_3d._3dnr.enable), '\0' );*/ //DBG_DUMP("isp Buf=%s\r\n",Buf); snprintf(Buf, BufLen, "ae_adj:%d cur_lum:%d target_lum:%3d iso:%d exp:%d lv:%3d awbrg:%3d awbbg:%3d ct:%4d adc:%d aecnt:%d preae_exp:%d preae_iso:%d %04d/%02d/%02d %02d:%02d:%02d", (INT)(ae_status.status_info.state_adj), (INT)(ae_status.status_info.lum), (INT)(ae_status.status_info.expect_lum), (INT)(ae_status.status_info.iso_gain[0]), (INT)(ae_status.status_info.expotime[0]), (INT)(ae_status.status_info.lv/100000), (INT)(awb_status.status.cur_r_gain), (INT)(awb_status.status.cur_b_gain), (INT)(awb_status.status.cur_ct), IRSHTTER, 0, /* Cap_cnt,*/ ae_preset_exp, ae_preset_iso, Curr_gsDateTime.tm_year, Curr_gsDateTime.tm_mon, Curr_gsDateTime.tm_mday, Curr_gsDateTime.tm_hour, Curr_gsDateTime.tm_min, Curr_gsDateTime.tm_sec); #if SF_HW_TEST == ENABLE sf_set_iso_exp_lv((ae_status.status_info.state_adj), (ae_status.status_info.iso_gain[0]),(ae_status.status_info.expotime[0]), (ae_status.status_info.lv/100000)); #endif DBG_IND("%s:%d Buf=%s\r\n",__FUNCTION__,__LINE__,Buf); #endif vendor_isp_uninit(); return; } void PhotoFastCapDateImprint_InitBuff(void) { HD_RESULT ret; void *va; UINT32 pa; UINT32 size; HD_COMMON_MEM_DDR_ID ddr_id = DDR_ID0; HD_VIDEO_PXLFMT out_fmt = HD_VIDEO_PXLFMT_YUV420; lv_color32_t color32; /****************************************************************************** * Stamp image ******************************************************************************/ // lv_user_font_conv_draw_cfg_init(&stamp_img.draw_cfg); // // stamp_img.draw_cfg.align_w = LV_USER_FONT_CONV_ALIGN_W; // stamp_img.draw_cfg.align_h = LV_USER_FONT_CONV_ALIGN_H; // stamp_img.draw_cfg.fmt = out_fmt; // stamp_img.draw_cfg.mode = LV_USER_FONT_CONV_DRAW_IMG; //#if LV_COLOR_DEPTH == 8 // extern uint32_t palette_define[]; // stamp_img.draw_cfg.img.palette = palette_define; //#else // stamp_img.draw_cfg.img.palette = NULL; //#endif // stamp_img.draw_cfg.img.id = IMG_ID; // // stamp_img.draw_cfg.key_y = CKEY_Y; // stamp_img.draw_cfg.key_u = CKEY_U; // stamp_img.draw_cfg.key_v = CKEY_V; // // lv_user_font_conv_calc_buffer_size(&stamp_img.draw_cfg, &stamp_img.buff_size); /****************************************************************************** * Stamp text ******************************************************************************/ printf("[%s:%d] s\n",__FUNCTION__,__LINE__); #if PHOTO_STAMP_ISP_STATUS == ENABLE memset(photo_aesteam, '\0', sizeof(photo_aesteam)); PhotoStamp_get_isp_status_jpg(0,&photo_aesteam[0],128); #endif lv_user_font_conv_draw_cfg_init(&stamp_text.draw_cfg); stamp_text.draw_cfg.align_w = LV_USER_FONT_CONV_ALIGN_W; stamp_text.draw_cfg.align_h = LV_USER_FONT_CONV_ALIGN_H; stamp_text.draw_cfg.fmt = out_fmt; stamp_text.draw_cfg.mode = LV_USER_FONT_CONV_DRAW_TEXT; stamp_text.draw_cfg.radius = LV_USER_CFG_STAMP_RADIUS; stamp_text.draw_cfg.string.letter_space = LV_USER_CFG_STAMP_LETTER_SPACE; stamp_text.draw_cfg.string.align = LV_USER_CFG_STAMP_TEXT_ALIGN; #if PHOTO_STAMP_ISP_STATUS == ENABLE stamp_text.draw_cfg.string.text = &photo_aesteam[0];// STRING; #else // stamp_text.draw_cfg.string.text = STRING; /* demo string */ stamp_text.draw_cfg.string.text = PhotoFast_InitStrBuf(); DBG_DUMP("stamp_text.draw_cfg.string.text = %s\n", stamp_text.draw_cfg.string.text); #endif /* Important, check font is in the lds, calculate max buffer size */ stamp_text.draw_cfg.string.font = (lv_font_t *)lv_plugin_get_font(LV_USER_CFG_STAMP_FONT_ID_LARGE)->font; stamp_text.draw_cfg.ext_w = LV_USER_CFG_STAMP_EXT_WIDTH; stamp_text.draw_cfg.ext_h = LV_USER_CFG_STAMP_EXT_HEIGHT; stamp_text.draw_cfg.border.width = LV_USER_CFG_STAMP_BORDER_WIDTH; /* text color */ color32.full = LV_USER_CFG_STAMP_COLOR_TEXT; stamp_text.draw_cfg.string.color = LV_COLOR_MAKE(color32.ch.red, color32.ch.green, color32.ch.blue); stamp_text.draw_cfg.string.opa = LV_COLOR_GET_A32(color32); /* bg color */ color32.full = LV_USER_CFG_STAMP_COLOR_BACKGROUND; stamp_text.draw_cfg.bg.color = LV_COLOR_MAKE(color32.ch.red, color32.ch.green, color32.ch.blue); stamp_text.draw_cfg.bg.opa = LV_COLOR_GET_A32(color32); /* border color */ color32.full = LV_USER_CFG_STAMP_COLOR_FRAME; stamp_text.draw_cfg.border.color = LV_COLOR_MAKE(color32.ch.red, color32.ch.green, color32.ch.blue); stamp_text.draw_cfg.border.opa = LV_COLOR_GET_A32(color32); stamp_text.draw_cfg.border.width = LV_USER_CFG_STAMP_BORDER_WIDTH; stamp_text.draw_cfg.key_y = CKEY_Y; stamp_text.draw_cfg.key_u = CKEY_U; stamp_text.draw_cfg.key_v = CKEY_V; lv_user_font_conv_calc_buffer_size(&stamp_text.draw_cfg, &stamp_text.buff_size); /* allocate size of the larger one */ // if(stamp_text.buff_size.output_buffer_size > stamp_img.buff_size.output_buffer_size){ // size = stamp_text.buff_size.output_buffer_size; // } // else{ // size = stamp_img.buff_size.output_buffer_size; // } stamp_text.buff_size.output_buffer_size = stamp_text.buff_size.output_buffer_size/4*5; //add alloc buff. size = stamp_text.buff_size.output_buffer_size; ret = hd_common_mem_alloc("stamp_pri", &pa, (void **)&va, size, ddr_id); if (ret != HD_OK) { DBG_ERR("custom_stamp_buffer allocate failed\n\r"); } else { // stamp_img.mem_cfg.output_buffer = va; // stamp_img.mem_cfg.output_buffer_size = stamp_img.buff_size.output_buffer_size; stamp_text.mem_cfg.output_buffer = va; stamp_text.mem_cfg.output_buffer_size = stamp_text.buff_size.output_buffer_size; } stamp_pri_va = va; stamp_pri_pa = pa; } void PhotoFastCapDateImprint_UninitBuff(void) { HD_RESULT ret; if (stamp_pri_va) { ret = hd_common_mem_free(stamp_pri_pa, stamp_pri_va); if (ret != HD_OK) { DBG_ERR("hd_common_mem_free failed!(%d)\n", ret); } stamp_pri_va = 0; stamp_pri_pa = 0; } } void UiDateImprint_DrawBG(UINT32 stamp_height, HD_VIDEO_FRAME* Img) { HD_GFX_DRAW_RECT param = {0}; param.dst_img.dim = Img->dim; param.dst_img.ddr_id = Img->ddr_id; param.dst_img.format = Img->pxlfmt; param.dst_img.lineoffset[0] = Img->loff[0]; param.dst_img.lineoffset[1] = Img->loff[1]; param.dst_img.p_phy_addr[0] = Img->phy_addr[0]; param.dst_img.p_phy_addr[1] = Img->phy_addr[1]; param.color = LV_USER_CFG_STAMP_COLOR_BACKGROUND; /* ARGB format */ param.thickness = 10; param.rect.w = Img->dim.w; //param.rect.h = stamp_height; //printf("[%s:%d]stamp_height=%d\n", __FUNCTION__, __LINE__, stamp_height); param.rect.h = stamp_height/10*12; //50/10*12 = 60 param.rect.x = 0; param.rect.y = Img->dim.h - 58; param.type = HD_GFX_RECT_SOLID; hd_gfx_draw_rect(¶m); } void UiDateImprint_AttachLogo(UINT32 stamp_height, HD_VIDEO_FRAME* Img) { extern const WATERLOGO_BUFFER g_WaterLogo_yuv420_486; HD_RESULT ret; VF_GFX_SCALE param = {0}; UINT32 pa; void* va; UINT32 blk_size = 0; UINT8 ddr_id = DDR_ID0; HD_VIDEO_FRAME logo = {0}; UINT32 lineoff[HD_VIDEO_MAX_PLANE] = {0}; UINT32 addr[HD_VIDEO_MAX_PLANE] = {0}; blk_size = (g_WaterLogo_yuv420_486.uiWidth * g_WaterLogo_yuv420_486.uiHeight * 3) / 2; ret = hd_common_mem_alloc("jack", &pa, (void **)&va, blk_size, ddr_id); if (ret != HD_OK) { DBG_ERR("alloc fail size 0x%x, ddr %d\r\n", blk_size, ddr_id); return; } memcpy(va,(void*) g_WaterLogo_yuv420_486.uiWaterLogoAddr, blk_size); lineoff[0] = g_WaterLogo_yuv420_486.uiWidth; lineoff[1] = g_WaterLogo_yuv420_486.uiWidth; addr[0] = pa; addr[1] = addr[0] + (lineoff[0] * g_WaterLogo_yuv420_486.uiHeight); vf_init_ex(&logo, g_WaterLogo_yuv420_486.uiWidth, g_WaterLogo_yuv420_486.uiHeight, Img->pxlfmt, lineoff, addr); param.quality = HD_GFX_SCALE_QUALITY_NULL; param.src_img = logo; param.src_region.x = 0; param.src_region.y = 0; param.src_region.w = g_WaterLogo_yuv420_486.uiWidth; param.src_region.h = g_WaterLogo_yuv420_486.uiHeight; param.engine = 0; param.dst_img = *Img; param.dst_region.x = 0; param.dst_region.y = Img->dim.h - stamp_height; param.dst_region.w = (g_WaterLogo_yuv420_486.uiWidth / g_WaterLogo_yuv420_486.uiHeight) * stamp_height; param.dst_region.h = stamp_height; vf_gfx_scale(¶m, 1); hd_common_mem_free(pa, va); } void UiDateImprint_AttachICON(UINT32 stamp_height, HD_VIDEO_FRAME* Img, lv_plugin_res_id res_id, bool enable_ckey, UINT32 padding, UINT32* x_curr_ofs) { HD_VIDEO_PXLFMT out_fmt = HD_VIDEO_PXLFMT_YUV420; HD_VIDEO_FRAME src_img; void *va; UINT32 pa; HD_RESULT ret; HD_COMMON_MEM_DDR_ID ddr_id = DDR_ID0; /****************************************************************************** * Stamp image ******************************************************************************/ lv_user_font_conv_draw_cfg draw_cfg = {0}; lv_user_font_conv_calc_buffer_size_result buff_size = {0}; lv_user_font_conv_mem_cfg mem_cfg = {0}; lv_user_font_conv_draw_cfg_init(&draw_cfg); draw_cfg.align_w = LV_USER_FONT_CONV_ALIGN_W; draw_cfg.align_h = LV_USER_FONT_CONV_ALIGN_H; draw_cfg.fmt = out_fmt; draw_cfg.mode = LV_USER_FONT_CONV_DRAW_IMG; #if LV_COLOR_DEPTH == 8 extern uint32_t palette_define[]; draw_cfg.img.palette = palette_define; #else draw_cfg.img.palette = NULL; #endif draw_cfg.img.id = res_id; draw_cfg.enable_ckey = enable_ckey; draw_cfg.key_y = CKEY_Y; draw_cfg.key_u = CKEY_U; draw_cfg.key_v = CKEY_V; lv_user_font_conv_calc_buffer_size(&draw_cfg, &buff_size); ret = hd_common_mem_alloc("stamp_icon", &pa, (void **)&va, buff_size.output_buffer_size, ddr_id); if (ret != HD_OK) { DBG_ERR("custom_stamp_buffer allocate failed\n\r"); } else { mem_cfg.output_buffer = va; mem_cfg.output_buffer_size = buff_size.output_buffer_size; } /*********************************************************** * draw image **********************************************************/ VF_GFX_SCALE param_img = {0}; lv_user_font_conv(&draw_cfg, &mem_cfg); lv_user_font_conv_cfg_to_hd_frame( &draw_cfg, &mem_cfg, buff_size.width, buff_size.height, &src_img ); memset(¶m_img, 0, sizeof(param_img)); param_img.quality = HD_GFX_SCALE_QUALITY_NULL; param_img.src_img = src_img; param_img.src_region.x = 0; param_img.src_region.y = 0; param_img.src_region.w = src_img.dim.w; param_img.src_region.h = src_img.dim.h; param_img.engine = 0; param_img.dst_img = *Img; DBG_IND("[%s:%d]src_img.dim.w=%d,src_img.dim.h=%d\n", __FUNCTION__, __LINE__, src_img.dim.w, src_img.dim.h); param_img.dst_region.w = ((src_img.dim.w / src_img.dim.h) * stamp_height); param_img.dst_region.h = stamp_height; DBG_IND("[%s:%d]param_img.dst_region.w=%d,param_img.dst_region.h=%d\n", __FUNCTION__, __LINE__, param_img.dst_region.w, param_img.dst_region.h); if(res_id == LV_PLUGIN_IMG_ID_ICON_10234_GPS) { param_img.dst_region.x = (*x_curr_ofs - param_img.dst_region.w); } else { param_img.dst_region.x = (*x_curr_ofs - padding - param_img.dst_region.w); } DBG_IND("[%s:%d]param_img.dst_region.x=%d\n", __FUNCTION__, __LINE__, param_img.dst_region.x); param_img.dst_region.y = param_img.dst_img.dim.h - param_img.dst_region.h - 2; vf_gfx_scale(¶m_img, 1); hd_common_mem_free(pa, va); *x_curr_ofs = param_img.dst_region.x; } void UiDateImprint_AttachString(UINT32 stamp_height, HD_VIDEO_FRAME* Img, UINT8* name, bool enable_ckey, UINT32 padding, UINT32* x_curr_ofs) { VF_GFX_SCALE param_img = {0}; HD_VIDEO_FRAME src_img; stamp_text.draw_cfg.string.text = (char *)name; lv_user_font_conv_calc_buffer_size(&stamp_text.draw_cfg, &stamp_text.buff_size); lv_user_font_conv(&stamp_text.draw_cfg, &stamp_text.mem_cfg); lv_user_font_conv_cfg_to_hd_frame( &stamp_text.draw_cfg, &stamp_text.mem_cfg, stamp_text.buff_size.width, stamp_text.buff_size.height, &src_img ); memset(¶m_img, 0, sizeof(param_img)); param_img.quality = HD_GFX_SCALE_QUALITY_NULL; param_img.src_img = src_img; param_img.src_region.x = 0; param_img.src_region.y = 0; param_img.src_region.w = src_img.dim.w; param_img.src_region.h = src_img.dim.h; param_img.engine = 0; param_img.dst_img = *Img; param_img.dst_region.w = (src_img.dim.w / src_img.dim.h) * stamp_height; param_img.dst_region.h = stamp_height; param_img.dst_region.x = (*x_curr_ofs - padding - param_img.dst_region.w); param_img.dst_region.y = param_img.dst_img.dim.h - param_img.dst_region.h; vf_gfx_scale(¶m_img, 1); *x_curr_ofs = param_img.dst_region.x; } void sf_get_gps_info_str(UINT8 *str, UINT8 type) { UINT32 i = 0; UIMenuStoreInfo *puiPara = sf_ui_para_get(); DBG_IND("[%s:%d]puiPara->GpsSwitch=%d,puiPara->Latitude:%s,puiPara->Longitude:%s\n", __FUNCTION__, __LINE__, puiPara->GpsSwitch, puiPara->Latitude, puiPara->Longitude); if(puiPara->GpsSwitch == SF_ON) { if((puiPara->Latitude[0] == '\0') || (puiPara->Longitude[0] == '\0')) { str[0] = '\0'; } else if(type == 1) { str[i++] = puiPara->Latitude[9]; str[i++] = puiPara->Latitude[0]; str[i++] = puiPara->Latitude[1]; str[i++] = 0xC2; str[i++] = 0xB0; str[i++] = puiPara->Latitude[2]; str[i++] = puiPara->Latitude[3]; str[i++] = 0x27; // ' str[i++] = puiPara->Latitude[5]; str[i++] = puiPara->Latitude[6]; str[i++] = 0x22; // " str[i++] = ' '; str[i++] = puiPara->Longitude[10]; str[i++] = puiPara->Longitude[0]; str[i++] = puiPara->Longitude[1]; str[i++] = puiPara->Longitude[2]; str[i++] = 0xC2; str[i++] = 0xB0; str[i++] = puiPara->Longitude[3]; str[i++] = puiPara->Longitude[4]; str[i++] = 0x27; // ' str[i++] = puiPara->Longitude[6]; str[i++] = puiPara->Longitude[7]; str[i++] = 0x22; // " str[i++] = '\0'; } else if(type == 2) { str[i++] = puiPara->Latitude[9]; str[i++] = puiPara->Latitude[0]; str[i++] = puiPara->Latitude[1]; str[i++] = 0x2A; str[i++] = puiPara->Latitude[2]; str[i++] = puiPara->Latitude[3]; str[i++] = 0x27; // ' str[i++] = puiPara->Latitude[5]; str[i++] = puiPara->Latitude[6]; str[i++] = 0x22; // " str[i++] = ' '; str[i++] = puiPara->Longitude[10]; str[i++] = puiPara->Longitude[0]; str[i++] = puiPara->Longitude[1]; str[i++] = puiPara->Longitude[2]; str[i++] = 0x2A; str[i++] = puiPara->Longitude[3]; str[i++] = puiPara->Longitude[4]; str[i++] = 0x27; // ' str[i++] = puiPara->Longitude[6]; str[i++] = puiPara->Longitude[7]; str[i++] = 0x22; // " str[i++] = '\0'; } else if(type == 3) { str[i++] = puiPara->Latitude[9]; str[i++] = puiPara->Latitude[0]; str[i++] = puiPara->Latitude[1]; str[i++] = '.'; str[i++] = puiPara->Latitude[2]; str[i++] = puiPara->Latitude[3]; str[i++] = '.'; str[i++] = puiPara->Latitude[5]; str[i++] = puiPara->Latitude[6]; str[i++] = '-'; str[i++] = puiPara->Longitude[10]; str[i++] = puiPara->Longitude[0]; str[i++] = puiPara->Longitude[1]; str[i++] = puiPara->Longitude[2]; str[i++] = '.'; str[i++] = puiPara->Longitude[3]; str[i++] = puiPara->Longitude[4]; str[i++] = '.'; str[i++] = puiPara->Longitude[6]; str[i++] = puiPara->Longitude[7]; str[i++] = '\0'; } } else { str[0] = '\0'; } DBG_IND("[%s:%d]str:%s\n", __FUNCTION__, __LINE__, str); return; } INT32 PhotoFastCapDateImprint_GenYuvData(HD_VIDEO_FRAME *pDstImg) { HD_VIDEO_FRAME src_img; VF_GFX_COPY param_text = {0}; UINT32 padding = 0; UINT32 x_curr_ofs = 0; /* start from date stamp */ UINT8 customString[32] = {0}; INT32 year = 0, month = 0, day = 0; UINT8 moonday = 0; UINT8 batValue = 0; UIMenuStoreInfo *puiPara = sf_ui_para_get(); if(puiPara->StampSwitch == 0) { return E_OK; } /* select font by image width */ #if PHOTO_STAMP_ISP_STATUS == DISABLE UINT32 ScaleFactor; /* not used , for backward capability*/ PhotoFast_SelStampFont(pDstImg->dim.w, (char**)&(stamp_text.draw_cfg.string.font), &ScaleFactor); stamp_text.draw_cfg.string.text = PhotoFast_InitStrBuf(); #else stamp_text.draw_cfg.string.font = (lv_font_t *) lv_plugin_get_font(FONT)->font; #endif lv_user_font_conv_calc_buffer_size(&stamp_text.draw_cfg, &stamp_text.buff_size); lv_user_font_conv(&stamp_text.draw_cfg, &stamp_text.mem_cfg); lv_user_font_conv_cfg_to_hd_frame( &stamp_text.draw_cfg, &stamp_text.mem_cfg, stamp_text.buff_size.width, stamp_text.buff_size.height, &src_img ); //draw background UiDateImprint_DrawBG(src_img.dim.h, pDstImg); memset(¶m_text, 0, sizeof(param_text)); param_text.src_img = src_img; param_text.src_region.x = 0; param_text.src_region.y = 0; param_text.src_region.w = src_img.dim.w; param_text.src_region.h = src_img.dim.h; param_text.dst_img = *pDstImg; param_text.dst_pos.x = pDstImg->dim.w - src_img.dim.w - src_img.dim.h/2; param_text.dst_pos.y = pDstImg->dim.h - src_img.dim.h; param_text.alpha = 255; param_text.colorkey = CKEY; param_text.engine = 0; vf_gfx_copy(¶m_text); padding = src_img.dim.h; x_curr_ofs = param_text.dst_pos.x; //logo stamp UiDateImprint_AttachLogo(src_img.dim.h, pDstImg); //moon stamp year = DateTime_Get(DATETIME_YEAR); month = DateTime_Get(DATETIME_MONTH); day = DateTime_Get(DATETIME_DAY); DBG_IND("[%s:%d]get date time:%04d %02d %02d\n", __FUNCTION__, __LINE__, year, month, day); moonday = (sf_solar_to_Lunar(year, month, day)) - 1; UiDateImprint_AttachICON(src_img.dim.h, pDstImg, LV_PLUGIN_IMG_ID_ICON_10200_MOON + moonday, true, padding, &x_curr_ofs); //battery stamp batValue = sf_battery_level_get(); if(batValue < SF_BATT_LEVEL_1) { batValue = 1; } batValue -= 1; UiDateImprint_AttachICON(src_img.dim.h, pDstImg, LV_PLUGIN_IMG_ID_ICON_10230_BATTERT + batValue, true, padding, &x_curr_ofs); DBG_IND("[%s:%d]moonday=%d,batValue=%d\n", __FUNCTION__, __LINE__, moonday, batValue); //camid stamp if((puiPara->CamNameSwitch == SF_CAMID_ON) && (puiPara->CamNameStr[0] != '\0')) { snprintf((char *)customString, sizeof(customString), "%s", puiPara->CamNameStr); DBG_IND("[%s:%d]customString=%s\n", __FUNCTION__, __LINE__, customString); //sprintf(customString, "Cam1"); UiDateImprint_AttachString(src_img.dim.h, pDstImg, customString, true, padding, &x_curr_ofs); } //gps stamp //sprintf((char *)puiPara->Latitude, "3458.3100N"); //sprintf((char *)puiPara->Longitude, "12294.4200E"); sf_get_gps_info_str(customString, 1); if(0/*(puiPara->GpsSwitch == SF_ON) && (customString[0] != '\0')*/) { if(customString[0] != '\0') { //snprintf((char *)customString, sizeof(customString), "N22%c%c34'57\" E113%c%c55'19\"", 0xC2, 0xB0, 0xC2, 0xB0); DBG_IND("[%s:%d]customString=%s\n", __FUNCTION__, __LINE__, customString); UiDateImprint_AttachString(src_img.dim.h, pDstImg, customString, true, padding, &x_curr_ofs); } UiDateImprint_AttachICON(src_img.dim.h, pDstImg, LV_PLUGIN_IMG_ID_ICON_10234_GPS, true, padding, &x_curr_ofs); } return E_OK; } INT32 PhotoFastCapDateImprint_GenYuvData2(HD_VIDEO_FRAME *pDstImg) { HD_VIDEO_FRAME src_img; // VF_GFX_COPY param_img = {0}, VF_GFX_COPY param_text = {0}; UINT32 target_ofs_x, target_ofs_y; // lv_user_font_conv(&stamp_img.draw_cfg, &stamp_img.mem_cfg); // // lv_user_font_conv_cfg_to_hd_frame( // &stamp_img.draw_cfg, // &stamp_img.mem_cfg, // stamp_img.buff_size.width, // stamp_img.buff_size.height, // &src_img // ); // // memset(¶m_img, 0, sizeof(param_img)); // param_img.src_img = src_img; // param_img.src_region.x = 0; // param_img.src_region.y = 0; // param_img.src_region.w = src_img.dim.w; // param_img.src_region.h = src_img.dim.h; // param_img.dst_img = *pDstImg; // param_img.dst_pos.x = 0; // param_img.dst_pos.y = 0; // param_img.alpha = 255; // param_img.colorkey = CKEY; // param_img.engine = 0; // vf_gfx_copy(¶m_img); /* select font by image width */ #if PHOTO_STAMP_ISP_STATUS == DISABLE UINT32 ScaleFactor; /* not used , for backward capability*/ PhotoFast_SelStampFont(pDstImg->dim.w, (char**)&(stamp_text.draw_cfg.string.font), &ScaleFactor); stamp_text.draw_cfg.string.text = PhotoFast_InitStrBuf(); #else stamp_text.draw_cfg.string.font = (lv_font_t *) lv_plugin_get_font(FONT)->font; #endif lv_user_font_conv_calc_buffer_size(&stamp_text.draw_cfg, &stamp_text.buff_size); lv_user_font_conv(&stamp_text.draw_cfg, &stamp_text.mem_cfg); lv_user_font_conv_cfg_to_hd_frame( &stamp_text.draw_cfg, &stamp_text.mem_cfg, stamp_text.buff_size.width, stamp_text.buff_size.height, &src_img ); memset(¶m_text, 0, sizeof(param_text)); param_text.src_img = src_img; param_text.src_region.x = 0; param_text.src_region.y = 0; param_text.src_region.w = src_img.dim.w; param_text.src_region.h = src_img.dim.h; param_text.dst_img = *pDstImg; target_ofs_x = param_text.src_img.dim.w + param_text.src_img.dim.h; target_ofs_y = param_text.src_img.dim.h + param_text.src_img.dim.h; /********************************************************** * bounds checking **********************************************************/ if(param_text.dst_img.dim.w >= target_ofs_x){ param_text.dst_pos.x = param_text.dst_img.dim.w - target_ofs_x; } else if(param_text.dst_img.dim.w >= param_text.src_img.dim.w){ param_text.dst_pos.x = param_text.dst_img.dim.w - param_text.src_img.dim.w; } else{ DBG_WRN("stamp width(%lu) exceed slice width\n", target_ofs_x); return E_OK; } if(param_text.dst_img.dim.h >= target_ofs_y){ param_text.dst_pos.y = param_text.dst_img.dim.h - target_ofs_y; } else if(param_text.dst_img.dim.h >= param_text.src_img.dim.h){ param_text.dst_pos.y = param_text.dst_img.dim.h - param_text.src_img.dim.h; } else{ DBG_WRN("stamp height + padding (%lu) exceed slice height\n", target_ofs_y); return E_OK; } param_text.alpha = 255; param_text.colorkey = CKEY; param_text.engine = 0; vf_gfx_copy(¶m_text); return E_OK; } #else #include "FontConv/FontConv.h" #include "gximage/gximage.h" #include "UIApp/MovieStamp/DateStampFontTbl56x96.h" #include "UIApp/MovieStamp/DateStampFontTbl42x72.h" #include "UIApp/MovieStamp/DateStampFontTbl36x60.h" #include "UIApp/MovieStamp/DateStampFontTbl26x44.h" #include "UIApp/MovieStamp/DateStampFontTbl20x44.h" #include "UIApp/MovieStamp/DateStampFontTbl18x30.h" #include "UIApp/MovieStamp/DateStampFontTbl12x20.h" #include "UIApp/MovieStamp/DateStampFontTbl10x16.h" #include "UIApp/MovieStamp/MovieStamp.h" #include "UIWnd/SPORTCAM/Resource/UIResource.h" #include "UIWnd/SPORTCAM/UIInfo/DateTimeInfo.h" #include "UIWnd/SPORTCAM/UIInfo/UIInfo.h" #include "UIWnd/SPORTCAM/UIInfo/UIPhotoInfo.h" #include "UIWnd/SPORTCAM/UIInfo/UIPhotoMapping.h" #define DATE_COLOR_TRANSPARENT 0x008080C0 #define DATE_COLOR_WHITE 0x008080FF #define DATE_COLOR_BLACK 0x00808000 #define DATE_COLOR_ORANGED 0x00CC2D93 #define DATE_COLOR_RED 0x00F05A45 #define DATE_COLOR_YELLOW 0x007F80C0 //Primary Image and Screennail image. Customized string and icon stamped sample. extern const PALETTE_ITEM gDemoKit_Palette_Palette_custom_photo[256]; static UINT32 g_custom_stamp_va_addr = 0; static UINT32 g_custom_stamp_pa_addr = 0; static char g_custtom_stamp_str_buf[64] = {0}; static FONT_CONV_IN g_PhotoFastIndexColorToYuvIn; // use font data structure static FONT_CONV_OUT g_PhotoFastIndexColorToYuvOut; // use font data structure static FONT_CONV_IN g_PhotoFastIndexColorToYuvIn2; // use font data structure static FONT_CONV_OUT g_PhotoFastIndexColorToYuvOut2; // use font data structure void PhotoFastCapDateImprint_InitBuff(void) { UINT32 u32BufSize = 0;; HD_RESULT hd_ret; HD_COMMON_MEM_DDR_ID ddr_id = DDR_ID0; void *va; UINT32 pa; //Custom stamp buffer u32BufSize = HUNTINGCAP_DATESTAMP_BUF_SIZE; hd_ret = hd_common_mem_alloc("custom_stamp_buffer", &pa, (void **)&va, u32BufSize, ddr_id); if (hd_ret != HD_OK) { DBG_ERR("custom_stamp_buffer allocate failed\n\r"); } else { g_custom_stamp_pa_addr = (UINT32)pa; g_custom_stamp_va_addr = (UINT32)va; } } void PhotoFastCapDateImprint_UninitBuff(void) { HD_RESULT hd_ret; if (g_custom_stamp_va_addr) { hd_ret = hd_common_mem_free((UINT32)g_custom_stamp_pa_addr, (void *)g_custom_stamp_va_addr); if (hd_ret != HD_OK) { DBG_ERR("free g_custom_stamp_va_addr failed! (%d)\r\n", hd_ret); } g_custom_stamp_va_addr = 0; g_custom_stamp_pa_addr = 0; } } static void PhotoFastIndexColorToYuv_OnDrawCB(UINT32 param1,UINT32 param2,UINT32 param3,UINT32 param4) { DC* pTempDC = (DC*)param1; ISIZE ImageSize1;//Logo1 ImageSize1 = IMAGE_GetSize(GxGfx_GetImageID(ICON_BATTERY_CHARGE)); GxGfx_Image(pTempDC, 0, pTempDC->winRect.h - ImageSize1.h, GxGfx_GetImageID(ICON_BATTERY_CHARGE)); } static void PhotoFastIndexColorToYuv_OnDrawCB2(UINT32 param1,UINT32 param2,UINT32 param3,UINT32 param4) { DC* pTempDC = (DC*)param1; ISIZE ImageSize1;//Logo1 ImageSize1 = IMAGE_GetSize(GxGfx_GetImageID(ICON_WIFI_CONNECTED)); GxGfx_Image(pTempDC, (pTempDC->winRect.w-ImageSize1.w)/2, pTempDC->winRect.h - ImageSize1.h, GxGfx_GetImageID(ICON_WIFI_CONNECTED)); } INT32 PhotoFastCapDateImprint_GenYuvData(HD_VIDEO_FRAME *pDstImg) { ISIZE ImageSize1, ImageSize2; IPOINT DstLocation; VF_GFX_COPY param = {0}; HD_RESULT hd_ret; // printf("[%s:%d] s\n",__FUNCTION__,__LINE__); if ((!g_custom_stamp_va_addr) || (!pDstImg)) { DBG_ERR("No stamped buffer or pDstImg is NULL\r\n"); return E_SYS; } g_PhotoFastIndexColorToYuvIn.MemAddr = g_custom_stamp_va_addr; g_PhotoFastIndexColorToYuvIn.MemSize = HUNTINGCAP_DATESTAMP_BUF_SIZE; g_PhotoFastIndexColorToYuvIn.pStr = g_custtom_stamp_str_buf; g_PhotoFastIndexColorToYuvIn.ciSolid = DATE_COLOR_RED; //DATE_COLOR_WHITE; g_PhotoFastIndexColorToYuvIn.ciFrame = DATE_COLOR_TRANSPARENT; g_PhotoFastIndexColorToYuvIn.ciTransparet = DATE_COLOR_TRANSPARENT; g_PhotoFastIndexColorToYuvIn.Format = HD_VIDEO_PXLFMT_YUV420; g_PhotoFastIndexColorToYuvIn.bEnableSmooth= FALSE; g_PhotoFastIndexColorToYuvIn.pStringCB = PhotoFastIndexColorToYuv_OnDrawCB; g_PhotoFastIndexColorToYuvIn.pPalette = (PALETTE_ITEM*)gDemoKit_Palette_Palette_custom_photo; g_PhotoFastIndexColorToYuvIn.ScaleFactor = 65536; //1.0x g_PhotoFastIndexColorToYuvIn2.MemAddr = g_custom_stamp_va_addr; g_PhotoFastIndexColorToYuvIn2.MemSize = HUNTINGCAP_DATESTAMP_BUF_SIZE; g_PhotoFastIndexColorToYuvIn2.pStr = g_custtom_stamp_str_buf; g_PhotoFastIndexColorToYuvIn2.ciSolid = DATE_COLOR_RED; g_PhotoFastIndexColorToYuvIn2.ciFrame = DATE_COLOR_TRANSPARENT; g_PhotoFastIndexColorToYuvIn2.ciTransparet = DATE_COLOR_TRANSPARENT; g_PhotoFastIndexColorToYuvIn2.Format = HD_VIDEO_PXLFMT_YUV420; g_PhotoFastIndexColorToYuvIn2.bEnableSmooth= FALSE; g_PhotoFastIndexColorToYuvIn2.pStringCB = PhotoFastIndexColorToYuv_OnDrawCB2; g_PhotoFastIndexColorToYuvIn2.pPalette = (PALETTE_ITEM*)gDemoKit_Palette_Palette_custom_photo; g_PhotoFastIndexColorToYuvIn2.ScaleFactor = 65536; //1.0x switch (pDstImg->dim.w) { case 4032: //12M ImageSize1 = IMAGE_GetSize(GxGfx_GetImageID(ICON_BATTERY_CHARGE)); g_PhotoFastIndexColorToYuvIn.StampSize.w = pDstImg->dim.w; g_PhotoFastIndexColorToYuvIn.StampSize.h = ImageSize1.h; //Bottom image bar ImageSize2 = IMAGE_GetSize(GxGfx_GetImageID(ICON_WIFI_CONNECTED)); g_PhotoFastIndexColorToYuvIn2.StampSize.w = ImageSize2.w; g_PhotoFastIndexColorToYuvIn2.StampSize.h = ImageSize2.h; //according to max icon height break; case 3648: //10M ImageSize1 = IMAGE_GetSize(GxGfx_GetImageID(ICON_BATTERY_CHARGE)); g_PhotoFastIndexColorToYuvIn.StampSize.w = pDstImg->dim.w; g_PhotoFastIndexColorToYuvIn.StampSize.h = ImageSize1.h; //Bottom image bar ImageSize2 = IMAGE_GetSize(GxGfx_GetImageID(ICON_WIFI_CONNECTED)); g_PhotoFastIndexColorToYuvIn2.StampSize.w = ImageSize2.w; g_PhotoFastIndexColorToYuvIn2.StampSize.h = ImageSize2.h; //according to max icon height break; case 3264: //8M ImageSize1 = IMAGE_GetSize(GxGfx_GetImageID(ICON_BATTERY_CHARGE)); g_PhotoFastIndexColorToYuvIn.StampSize.w = pDstImg->dim.w; g_PhotoFastIndexColorToYuvIn.StampSize.h = ImageSize1.h; //Bottom image bar ImageSize2 = IMAGE_GetSize(GxGfx_GetImageID(ICON_WIFI_CONNECTED)); g_PhotoFastIndexColorToYuvIn2.StampSize.w = ImageSize2.w; g_PhotoFastIndexColorToYuvIn2.StampSize.h = ImageSize2.h; //according to max icon height break; case 2592: //5M ImageSize1 = IMAGE_GetSize(GxGfx_GetImageID(ICON_BATTERY_CHARGE)); g_PhotoFastIndexColorToYuvIn.StampSize.w = pDstImg->dim.w; g_PhotoFastIndexColorToYuvIn.StampSize.h = ImageSize1.h; //Bottom image bar ImageSize2 = IMAGE_GetSize(GxGfx_GetImageID(ICON_WIFI_CONNECTED)); g_PhotoFastIndexColorToYuvIn2.StampSize.w = ImageSize2.w; g_PhotoFastIndexColorToYuvIn2.StampSize.h = ImageSize2.h; //according to max icon height break; case 2048: //3M ImageSize1 = IMAGE_GetSize(GxGfx_GetImageID(ICON_BATTERY_CHARGE)); g_PhotoFastIndexColorToYuvIn.StampSize.w = pDstImg->dim.w; g_PhotoFastIndexColorToYuvIn.StampSize.h = ImageSize1.h; //Bottom image bar ImageSize2 = IMAGE_GetSize(GxGfx_GetImageID(ICON_WIFI_CONNECTED)); g_PhotoFastIndexColorToYuvIn2.StampSize.w = ImageSize2.w; g_PhotoFastIndexColorToYuvIn2.StampSize.h = ImageSize2.h; //according to max icon height break; case 640: // VGA (screennail) ImageSize1 = IMAGE_GetSize(GxGfx_GetImageID(ICON_BATTERY_CHARGE)); g_PhotoFastIndexColorToYuvIn.StampSize.w = pDstImg->dim.w; g_PhotoFastIndexColorToYuvIn.StampSize.h = ImageSize1.h; //Bottom image bar ImageSize2 = IMAGE_GetSize(GxGfx_GetImageID(ICON_WIFI_CONNECTED)); g_PhotoFastIndexColorToYuvIn2.StampSize.w = ImageSize2.w; g_PhotoFastIndexColorToYuvIn2.StampSize.h = ImageSize2.h; //according to max icon height break; default: ImageSize1 = IMAGE_GetSize(GxGfx_GetImageID(ICON_BATTERY_CHARGE)); g_PhotoFastIndexColorToYuvIn.StampSize.w = pDstImg->dim.w; g_PhotoFastIndexColorToYuvIn.StampSize.h = ImageSize1.h; //Bottom image bar ImageSize2 = IMAGE_GetSize(GxGfx_GetImageID(ICON_WIFI_CONNECTED)); g_PhotoFastIndexColorToYuvIn2.StampSize.w = ImageSize2.w; g_PhotoFastIndexColorToYuvIn2.StampSize.h = ImageSize2.h; //according to max icon height break; } FontConv(&g_PhotoFastIndexColorToYuvIn,&g_PhotoFastIndexColorToYuvOut); DstLocation.x = 0; DstLocation.y = pDstImg->dim.h - g_PhotoFastIndexColorToYuvIn.StampSize.h; param.src_img = g_PhotoFastIndexColorToYuvOut.GenImg; param.src_region.x = 0; param.src_region.y = 0; param.src_region.w = g_PhotoFastIndexColorToYuvOut.GenImg.dim.w; param.src_region.h = g_PhotoFastIndexColorToYuvOut.GenImg.dim.h; param.dst_img = *pDstImg; param.dst_pos.x = DstLocation.x; param.dst_pos.y = DstLocation.y; param.alpha = 255; param.colorkey = 0; param.engine = GXIMG_CP_ENG1; hd_ret = vf_gfx_copy(¶m); memset(¶m, 0, sizeof(VF_GFX_COPY)); FontConv(&g_PhotoFastIndexColorToYuvIn2,&g_PhotoFastIndexColorToYuvOut2); DstLocation.x = 0; DstLocation.y = pDstImg->dim.h - g_PhotoFastIndexColorToYuvIn2.StampSize.h*3; param.src_img = g_PhotoFastIndexColorToYuvOut2.GenImg; param.src_region.x = 0; param.src_region.y = 0; param.src_region.w = g_PhotoFastIndexColorToYuvOut2.GenImg.loff[HD_VIDEO_PINDEX_Y]; param.src_region.h = g_PhotoFastIndexColorToYuvOut2.GenImg.dim.h; param.dst_img = *pDstImg; param.dst_pos.x = DstLocation.x; param.dst_pos.y = DstLocation.y; param.alpha = 255; param.colorkey = 0; param.engine = GXIMG_CP_ENG1; hd_ret = vf_gfx_copy(¶m); // printf("[%s:%d] e\n",__FUNCTION__,__LINE__); if (hd_ret != HD_OK) { return E_SYS; } return E_OK; } #endif