Example #1
0
__u32 TxtLayer_GetLayerInfo(txtlayer_man_t *ptxtlayer)
{
    __u32                       ret;
    FB                          tmpfb;
    FB                          foucs_FB;
    __layerwincreate_para_t     newlyr_info;

    /*get TxtLayer sceen size*/
    ret = GUI_LyrWinGetScnWindow(ptxtlayer->layer,&ptxtlayer->scnrect);
    if(ret !=0)
    {
        __wrn("layer set sceen window failed,layer handle = %d\n",ptxtlayer->layer);
        return __LINE__;
    }

    /*获取图层的framebuffer相关信息*/
    ret = GUI_LyrWinGetFB(ptxtlayer->layer,&tmpfb);
    if(ret != 0)
    {
        __wrn("layer get framebuffer failed layer handle = %d\n",ptxtlayer->layer);
        return __LINE__;
    }

    /*设置图层的framebuffer信息至txtbuffer结构*/
    ptxtlayer->txtbuffer->buffer                = tmpfb.addr[0];
    ptxtlayer->txtbuffer->layer_format.type     = FB_TYPE_RGB;
    ptxtlayer->txtbuffer->layer_format          = tmpfb.fmt;
    ptxtlayer->txtbuffer->rectsz.width          = tmpfb.size.width;
    ptxtlayer->txtbuffer->rectsz.height         = tmpfb.size.height;
    ptxtlayer->txtbuffer->vrect.x               = 0;
    ptxtlayer->txtbuffer->vrect.y               = 0;

    foucs_FB = tmpfb;
	foucs_FB.size.height                        = ptxtlayer->ptxtbox->item_w * 2;
    foucs_FB.addr[0] = 0;

    ptxtlayer->sec_layer.alpha_en       		= 0;
    ptxtlayer->sec_layer.alpha_val      		= 0;
    ptxtlayer->sec_layer.channel        		= DISP_LAYER_OUTPUT_CHN_DE_CH1;
    ptxtlayer->sec_layer.ck_mode        		= 0;
    ptxtlayer->sec_layer.fb             		= &foucs_FB;
    ptxtlayer->sec_layer.mode           		= DISP_LAYER_WORK_MODE_NORMAL;
    ptxtlayer->sec_layer.pipe           		= 0;
    ptxtlayer->sec_layer.prio           		= 0;
    ptxtlayer->sec_layer.scn_win.x      		= 0;
    ptxtlayer->sec_layer.scn_win.y      		= 0;
    ptxtlayer->sec_layer.scn_win.width  		= 0;
    ptxtlayer->sec_layer.scn_win.height 		= 0;
    ptxtlayer->sec_layer.scn_win.x      		= 0;
    ptxtlayer->sec_layer.scn_win.y      		= 0;
    ptxtlayer->sec_layer.scn_win.width  		= 0;
    ptxtlayer->sec_layer.scn_win.height 		= 0;

    newlyr_info.initsta 						= GUI_LYRWIN_STA_SLEEP;
    newlyr_info.lyrpara 						= &ptxtlayer->sec_layer;
    newlyr_info.name 							= "txtbox sec lyr";

    ptxtlayer->focus_lyr 						= GUI_LyrWinCreate(&newlyr_info);

    /*获取图层的framebuffer相关信息*/
    ret = GUI_LyrWinGetFB(ptxtlayer->focus_lyr,&foucs_FB);
    if(ret != 0)
    {
        __wrn("layer get framebuffer failed layer handle = %d\n",ptxtlayer->layer);
        return __LINE__;
    }

    __HERE__
    ptxtlayer->foucs_FB = foucs_FB.addr[0];
    
    return OK;
}
Example #2
0
static H_LYR StandyWndCreate(const char *file_path)
{
	H_LYR hLyr;
	int rotation;
	FB frameBuf;

	ES_FILE *file = NULL;
	void *file_data = NULL;
	bmp_file_head_t *f_head= NULL;
	__layerwincreate_para_t layerWinCreate;
	__disp_layer_para_t lyrPara;
	__u32 lenth;

	file = eLIBs_fopen(file_path,"rb");
	if(file == NULL){
		__msg("file open fail\n");
		//return NULL;
		goto end;
	}
	f_head = eLIBs_malloc(sizeof(bmp_file_head_t));
	if(f_head==NULL){
  		__msg("file malloc fail\n");
		goto end;
	}
	eLIBs_fread(f_head,1,sizeof(bmp_file_head_t),file);
	if(f_head->bfType[0]!='B'||f_head->bfType[1]!='M'){
		__msg("file isnot bmp\n");
		goto end;
	}
	file_data = eLIBs_malloc(f_head->bfSize);
	eLIBs_fseek(file,0,SEEK_SET);
	lenth = eLIBs_fread(file_data,1,f_head->bfSize,file);
	__msg("lenth==%d\n",lenth);
	rotation = GUI_GetScnDir();
	MwLayerParaInit(&layerWinCreate, &frameBuf, &lyrPara, "Layer", rotation, 1, 320, 240);
	MwFillSize(&frameBuf.size, 320 , 240);
	MwFillRect(&lyrPara.src_win, 0, 0, 320, 240);
	hLyr = GUI_LyrWinCreate(&layerWinCreate);
	if (NULL == hLyr) {
		__msg("Create layer (%s) failed", layerWinCreate.name);
		goto end;
	}
	GUI_LyrWinSel(hLyr); 
	GUI_BMP_Draw(file_data, 0, 0);
	GUI_LyrWinSetSta(hLyr,GUI_LYRWIN_STA_ON);
	eLIBs_fclose(file);
	eLIBs_free(f_head);
	eLIBs_free(file_data);
	return hLyr;
end:
	if(file){
       eLIBs_fclose(file);
	}
	if(f_head){
		eLIBs_free(f_head);
	}
	if(file_data){
		eLIBs_free(file_data);
	}
	return NULL;
}