Ejemplo n.º 1
0
void OSD_DrawBitmapCell(PBITMAP pCtrl,UINT8 bStyleIdx,UINT32 nCmdDraw)
{
	lpVSCR  	pVscr;
	struct OSDRect	*objframe;	
	ID_RSC		RscId;
	PWINSTYLE  	lpWinSty;
	UINT32		fgColor;
	OBJECTINFO	RscLibInfo;
	UINT8 		bAlign,hAligin,vAlign;
	UINT16 		x,y,w,h;

	objframe	= &pCtrl->head.frame;	
	lpWinSty 	= g_osd_rsc_info.osd_get_win_style(bStyleIdx);
	fgColor		= lpWinSty->wFgIdx;
	RscId 		= LIB_ICON;
	bAlign 		= pCtrl->bAlign;

	pVscr = OSD_DrawObjectFrame(objframe,bStyleIdx);

	// for 16bit color mode. use bg color to draw the trans color, not use fg color.
	if(OSD_ColorModeIs16bit(pVscr->bColorMode)) 
		fgColor = lpWinSty->wBgIdx;
		
	if(pCtrl->wIconID)
	{

		g_osd_rsc_info.osd_get_obj_info(RscId, pCtrl->wIconID, &RscLibInfo);
		w = RscLibInfo.m_objAttr.m_wActualWidth;
		h = RscLibInfo.m_objAttr.m_wHeight;
		hAligin = GET_HALIGN(bAlign);
		vAlign  = GET_VALIGN(bAlign);
		if(hAligin==C_ALIGN_LEFT)
			x = objframe->uLeft + pCtrl->bX;
		else if(hAligin==C_ALIGN_RIGHT)
			x = objframe->uLeft + objframe->uWidth - pCtrl->bX - w;
		else
		{
			if(w < (objframe->uWidth - (pCtrl->bX<<1) ) )
				x = objframe->uLeft + ((objframe->uWidth - w)>>1);
			else
				x = objframe->uLeft + pCtrl->bX;				
		}
Ejemplo n.º 2
0
void OSD_DrawProgressBarCell(PPROGRESS_BAR b,UINT8 bStyleIdx,UINT32 nCmdDraw)
{ 
	PGUI_VSCR		pVscr;
	INT16 	wLeft, wDig,wDigWidth,wDigHeight,wCount;
	GUI_RECT	r,iconrect;
	GUI_RECT MidRect;
	PWINSTYLE  	lpWinSty;
	UINT32 pbarstyle;
	UINT16 wIconWidth,wIconHeight;
	INT32 start_pos,end_pos,page_width,reverse;
	
	wIconWidth = 0;
	wIconHeight = 0;
	lpWinSty = g_gui_rscfunc.osd_get_win_style(bStyleIdx);
	if(OSD_GetUpdateType(nCmdDraw) == C_UPDATE_CONTENT)
		pbarstyle = (UINT32)(~0);
	else
		pbarstyle = bStyleIdx;
	
	OSD_SetRect2(&r, &b->head.frame);
	if(OSD_GetAttrSlave(b))
		pVscr=OSD_DrawSlaveFrame(&r, bStyleIdx);
	else
		pVscr=OSD_DrawObjectFrame(&r, pbarstyle);
	OSD_ProgressBarGetMidRect(b,&MidRect);
	OSD_DrawStyleRect(&MidRect, b->wTickBg, pVscr);//ERR_LIBGE,b->wTickBg is a style not color
	
	if(!OSD_ProgressBarCheckValid(b))//check data 
		return;

	if((GetProgressBarStyle(b) & PROGRESSBAR_HORI_NORMAL)||(GetProgressBarStyle(b) & PROGRESSBAR_HORI_REVERSE))
	{
		if(b->bX==0)//analog bar
		{
			if(b->nPos<b->nMin)
				wDigWidth = 0;
			else
				wDigWidth = MidRect.uWidth*(b->nPos-b->nMin)/(b->nMax-b->nMin);

			if(GetProgressBarStyle(b)&PROGRESSBAR_HORI_NORMAL)
				OSD_SetRect(&iconrect,MidRect.uStartX,MidRect.uStartY,wDigWidth,MidRect.uHeight);
			else //reverse type
				OSD_SetRect(&iconrect,MidRect.uStartX+MidRect.uWidth-wDigWidth,MidRect.uStartY,wDigWidth,MidRect.uHeight);

			OSD_DrawProgressBarTick(b, &iconrect, lpWinSty->wBgIdx, pVscr);
		}
		else//digital bar
		{
			INT32 i ;
			if((b->nBlocks-1)*b->bX>=MidRect.uWidth)// Interval width is too large
				return;
			wDig = MidRect.uWidth/b->nBlocks;//wDig is the total tick width
			if(wDig<=1)
				return;
			wDigWidth = (MidRect.uWidth-(b->nBlocks-1)*b->bX)/b->nBlocks;//wDigWidth is the width for Foreback winstyle draw
			if(wDigWidth==0)
				wDigWidth =1;//at least is 1
			wCount = b->nMax-b->nMin;
			if(GetProgressBarStyle(b)&PROGRESSBAR_HORI_NORMAL)
			{
				for(i = b->nMin,wLeft=MidRect.uStartX; (i < b->nPos)&&(wLeft<MidRect.uStartX+MidRect.uWidth); wLeft += wDig, i += wCount/b->nBlocks)
				{/*i += wCount/b->nBlocks may cause divisibility problem,So we should assure right blocks,nMax,nMin value when using digital bar*/
					if(wLeft+wDigWidth-wDig>MidRect.uStartX+MidRect.uWidth)
						OSD_SetRect(&iconrect,wLeft,MidRect.uStartY,MidRect.uStartX+MidRect.uWidth-wLeft,MidRect.uHeight);
					else if (wLeft+wDigWidth>MidRect.uStartX+MidRect.uWidth)
						OSD_SetRect(&iconrect,wLeft,MidRect.uStartY,MidRect.uStartX+MidRect.uWidth-wLeft,MidRect.uHeight);
					else
						OSD_SetRect(&iconrect,wLeft,MidRect.uStartY,wDigWidth,MidRect.uHeight);

					OSD_DrawProgressBarTick(b, &iconrect, lpWinSty->wBgIdx, pVscr);
				}
			}
			else//PROGRESSBAR_HORI_REVERSE
			{
				wLeft = MidRect.uStartX+MidRect.uWidth-wDig;
				for(i = b->nMin,wLeft=MidRect.uStartX+MidRect.uWidth-wDig; (i < b->nPos)&&(wLeft >MidRect.uStartX); wLeft -= wDig, i += wCount/b->nBlocks)
				{
					if(wLeft+wDigWidth-wDig<MidRect.uStartX)
						OSD_SetRect(&iconrect,MidRect.uStartX,MidRect.uStartY,wLeft-MidRect.uStartX,MidRect.uHeight);
					else if (wLeft-wDigWidth<MidRect.uStartX)
						OSD_SetRect(&iconrect,MidRect.uStartX,MidRect.uStartY,wLeft-MidRect.uStartX,MidRect.uHeight);
					else
						OSD_SetRect(&iconrect,wLeft,MidRect.uStartY,wDigWidth,MidRect.uHeight);

					OSD_DrawProgressBarTick(b, &iconrect, lpWinSty->wBgIdx, pVscr);
				}
			}
		}
	}
	else
	{
		if(b->bY==0)//analog bar
		{
			if(b->nPos<b->nMin)
				wDigHeight = 0;
			else
				wDigHeight = MidRect.uHeight*(b->nPos-b->nMin)/(b->nMax-b->nMin);
			if(GetProgressBarStyle(b)&PROGRESSBAR_VERT_NORMAL)
				OSD_SetRect(&iconrect,MidRect.uStartX,MidRect.uStartY,MidRect.uWidth,wDigHeight);
			else
				OSD_SetRect(&iconrect,MidRect.uStartX,MidRect.uStartY+MidRect.uHeight-wDigHeight,MidRect.uWidth,wDigHeight);				

			OSD_DrawProgressBarTick(b, &iconrect, lpWinSty->wBgIdx, pVscr);
		}
		else//digital bar
		{
			INT32 i ;
			INT32 wRectTop;
			if((b->nBlocks-1)*b->bY>=MidRect.uHeight)//Interval width is too large
				return;
			wDig = MidRect.uHeight/b->nBlocks;
			if(wDig<=1)
				return;
			wDigHeight = (MidRect.uHeight-(b->nBlocks-1)*b->bY)/b->nBlocks;
			if(wDigHeight==0)
				wDigHeight=1;
			wCount = b->nMax-b->nMin;
			if(GetProgressBarStyle(b)&PROGRESSBAR_VERT_NORMAL)
			{
				for(i = b->nMin,wRectTop=MidRect.uStartY; (i < b->nPos)&&(wRectTop<MidRect.uStartY+MidRect.uHeight); wRectTop += wDig, i += wCount/b->nBlocks)
				{
					if(wRectTop+wDig-wDigHeight>MidRect.uStartY+MidRect.uHeight)
						OSD_SetRect(&iconrect,MidRect.uStartX,wRectTop,MidRect.uWidth,MidRect.uStartY+MidRect.uHeight-wRectTop);
					else if (wRectTop+wDigHeight>MidRect.uStartY+MidRect.uHeight)
						OSD_SetRect(&iconrect,MidRect.uStartX,wRectTop,MidRect.uWidth,MidRect.uStartY+MidRect.uHeight-wRectTop);
					else
						OSD_SetRect(&iconrect,MidRect.uStartX,wRectTop,MidRect.uWidth,wDigHeight);
					OSD_DrawProgressBarTick(b, &iconrect, lpWinSty->wBgIdx, pVscr);
				}
			}
			else
			{
				for(i = b->nMin,wRectTop=MidRect.uStartY+MidRect.uHeight-wDig; (i < b->nPos)&&(wRectTop>MidRect.uStartY); wRectTop -= wDig, i += wCount/b->nBlocks)
				{
					if(wRectTop+wDigHeight-wDig<MidRect.uStartY)
						OSD_SetRect(&iconrect,MidRect.uStartX,MidRect.uStartY,MidRect.uWidth,wRectTop-MidRect.uStartY);
					else if(wRectTop-wDigHeight<MidRect.uStartY)
						OSD_SetRect(&iconrect,MidRect.uStartX,MidRect.uStartY,MidRect.uWidth,wRectTop-MidRect.uStartY);
					else
						OSD_SetRect(&iconrect,MidRect.uStartX,wRectTop,MidRect.uWidth,wDigHeight);
					OSD_DrawProgressBarTick(b, &iconrect, lpWinSty->wBgIdx, pVscr);
				}
			}
		}
	}
}
Ejemplo n.º 3
0
// private
void OSD_DrawMultiTextCell(PMULTI_TEXT pCtrl, UINT8 bStyleIdx,UINT32 nCmdDraw)
{
	lpVSCR 		pVscr;
	struct OSDRect *objframe;	
	//ID_RSC		RscId;
	PWINSTYLE  	lpWinSty;
	UINT32		bgColor;
	UINT8 			bAlign,hAligin,vAlign;
	OBJECTINFO	RscLibInfo;
	struct OSDRect r;

	PTEXT_CONTENT pText;
	UINT16 width,height,left,right,bottom;
	INT16  lidx;
	UINT32 i,k;
	UINT8 *pStr,*pDrawStr;
	UINT16  wc;
	UINT16 wordlen,wordw,wordh,maxW,maxH,charw,charh;
	UINT8 font;
	UINT16 ox,oy,x,y,l,t;
	mtxtinfo_t mtxtinfo;
	UINT32 bNewLine;
	BOOL reverse_flag;
#ifdef BIDIRECTIONAL_OSD_STYLE
	UINT16 lineCount = 1;
	BOOL mirror_flag = g_osd_rsc_info.osd_get_mirror_flag();
#endif
	
	objframe	= &pCtrl->head.frame;
	font        = pCtrl->head.bFont;
	lpWinSty 	= g_osd_rsc_info.osd_get_win_style(bStyleIdx);
	bgColor     = lpWinSty->wBgIdx;
	bAlign 		= pCtrl->bAlign;
	hAligin     = GET_HALIGN(bAlign);
	vAlign      = GET_VALIGN(bAlign);
	
	pVscr = OSD_DrawObjectFrame(objframe,bStyleIdx);
	if(pVscr->lpbScr != NULL)
		bgColor = C_NOSHOW;
    
	r = *objframe;
	r.uLeft += pCtrl->rcText.uLeft;
	r.uTop  += pCtrl->rcText.uTop;
	r.uWidth    = pCtrl->rcText.uWidth;
	r.uHeight   = pCtrl->rcText.uHeight;
	width  = r.uWidth;
	height = r.uHeight;

GET_MULTITEXT_INFOR:
	mtxtinfo.topline_idx = (UINT8)pCtrl->nLine;
	mtxtinfo.topline_pstr = NULL;
	OSD_GetMTextInfor(pCtrl,&mtxtinfo);
	if(mtxtinfo.topline_pstr == NULL && pCtrl->nLine!=0)
	{
		pCtrl->nLine = 0;
		goto GET_MULTITEXT_INFOR;
	}
	if(mtxtinfo.topline_pstr == NULL)
		return;


	ox = 0;
	if(mtxtinfo.total_lines == 1)
	{
		maxW = OSD_MultiFontLibStrMaxHW(mtxtinfo.topline_pstr,font,&maxW,&maxH,0);
		if(maxW<width)
		{
			if(hAligin==C_ALIGN_RIGHT)
				ox = width - maxW;
			else if(hAligin == C_ALIGN_CENTER)
				ox = (width - maxW)>>1;
		}        
	}
Ejemplo n.º 4
0
void OSD_DrawMultiTextCell(PMULTI_TEXT pCtrl, UINT8 bStyleIdx,UINT32 nCmdDraw)
{
	PGUI_VSCR 		pVscr;
	PGUI_RECT objframe;	
	PWINSTYLE  	lpWinSty;
	UINT32		mtxtstyle,bgColor;
	UINT8 			bAlign,hAligin,vAlign;
	OBJECTINFO	RscLibInfo;
	GUI_RECT r;

	PTEXT_CONTENT pText;
	UINT16 width,height,left,right,bottom;
	INT16  lidx;
	UINT32 i,k;
	UINT8 *pStr,*pDrawStr;
	UINT16  wc;
	UINT16 wordlen,wordw,wordh,maxW,maxH,charw,charh;
	UINT8 font;
	UINT16 ox,oy,x,y,l,t;
	mtxtinfo_t mtxtinfo;
	UINT32 bNewLine;
	BOOL reverse_flag;
    
	if(OSD_GetUpdateType(nCmdDraw) == C_UPDATE_CONTENT)
		mtxtstyle = (UINT32)(~0);
	else
		mtxtstyle = bStyleIdx;
	objframe	= &pCtrl->head.frame;
	lpWinSty 	= g_gui_rscfunc.osd_get_win_style(bStyleIdx);
	bgColor     = lpWinSty->wBgIdx;
	bAlign 		= pCtrl->bAlign;
	hAligin     = GET_HALIGN(bAlign);
	vAlign      = GET_VALIGN(bAlign);
	
	if(OSD_GetAttrSlave(pCtrl))
	{
		font  = ((pCtrl->head.bFont) |C_FONT_SLVMASK);
		pVscr = OSD_DrawSlaveFrame(objframe,bStyleIdx);
	}
	else
	{
		font  = pCtrl->head.bFont;
		pVscr = OSD_DrawObjectFrame(objframe,mtxtstyle);
	}
    
	r = *objframe;
	r.uStartX += pCtrl->rcText.uStartX;
	r.uStartY  += pCtrl->rcText.uStartY;
	r.uWidth    = pCtrl->rcText.uWidth;
	r.uHeight   = pCtrl->rcText.uHeight;
	width  = r.uWidth;
	height = r.uHeight;

	GET_MULTITEXT_INFOR:
	mtxtinfo.topline_idx = (UINT8)pCtrl->nLine;
	mtxtinfo.topline_pstr = NULL;
	OSD_GetMTextInfor(pCtrl,&mtxtinfo);
	if(mtxtinfo.topline_pstr == NULL && pCtrl->nLine!=0)
	{
		pCtrl->nLine = 0;
		goto GET_MULTITEXT_INFOR;
	}
	if(mtxtinfo.topline_pstr == NULL)
	return;

	ox = 0;
	if(mtxtinfo.total_lines == 1)
	{
		maxW = OSD_MultiFontLibStrMaxHW(mtxtinfo.topline_pstr,font,&maxW,&maxH,0);
		if(maxW<width)
		{
			if(hAligin==C_ALIGN_RIGHT)
				ox = width - maxW;
			else if(hAligin == C_ALIGN_CENTER)
				ox = (width - maxW)>>1;
		}        
	}
Ejemplo n.º 5
0
static void win_zoom_draw_tv_zoom_rect(void)
{
    struct Rect tv_src_rect,tv_dest_rect;
    char str[30];
    int n;
    POBJECT_HEAD obj;
    
    struct OSDRect osd_dest_rect,osd_src_rect;    
    VSCR vscr;
    CONTAINER* win;

    win = &g_win_zoom;

	obj = (POBJECT_HEAD)(&g_win_zoom);	
    //OSD_DrawObjectFrame(&obj->frame,ZOOM_WIN_SH_IDX);
    //OSD_DrawObject(obj, C_UPDATE_ALL);


    get_tv_osd_src(&tv_src_rect,&osd_src_rect);   


	sprintf(str,"ZOOM   X%02d",zoom_int_scales[zoom_times]);
    OSD_SetTextFieldContent(&win_zoom_title,STRING_ANSI,(UINT32)str);
    OSD_DrawObject( (POBJECT_HEAD)&win_zoom_title, C_UPDATE_ALL);

#if 1

    OSD_SetRect(&osd_dest_rect, TV_R_L, TV_R_T, TV_R_W, TV_R_H);
	OSD_DrawObjectFrame(&osd_dest_rect,ZOOM_BIGRECT_SH_IDX);
	 

    if(osd_src_rect.uLeft>TV_R_L)
        OSD_DrawObject((POBJECT_HEAD)&win_zoom_larrow, C_UPDATE_ALL);
	
    if(osd_src_rect.uTop>TV_R_T)
        OSD_DrawObject((POBJECT_HEAD)&win_zoom_tarrow, C_UPDATE_ALL);
	
    if( (osd_src_rect.uLeft + osd_src_rect.uWidth)< (TV_R_L + TV_R_W) )
        OSD_DrawObject((POBJECT_HEAD)&win_zoom_rarrow, C_UPDATE_ALL);
	
    if( (osd_src_rect.uTop + osd_src_rect.uHeight) < (TV_R_T + TV_R_H) )
        OSD_DrawObject((POBJECT_HEAD)&win_zoom_darrow, C_UPDATE_ALL);

	OSD_DrawObjectFrame(&osd_src_rect,ZOOM_SMALLRECT_SH_IDX);
	
    obj = (POBJECT_HEAD)&win_zoom_bmp;
    OSD_SetRect(&obj->frame, TV_R_L + osd_center_pos.uX - ZOOM_BMP_W/2 , TV_R_T + osd_center_pos.uY - ZOOM_BMP_H/2, ZOOM_BMP_W, ZOOM_BMP_H);
    OSD_DrawObject(obj, C_UPDATE_ALL);

    
    tv_dest_rect.uStartX    = TV_DEST_L;
    tv_dest_rect.uStartY    = TV_DEST_T;
    tv_dest_rect.uWidth     = TV_DEST_W;
    tv_dest_rect.uHeight    = TV_DEST_H;
    
#if 0
    if(zoom_times==0)
    {
        tv_dest_rect.uStartX = TV_FULL_DEST_L;
        tv_dest_rect.uStartY = TV_FULL_DEST_T;
        tv_dest_rect.uWidth  = TV_FULL_DEST_W;
        tv_dest_rect.uHeight = TV_FULL_DEST_H;
    }

    if(zoom_times==0)
        //OSD_SetRect(&tv_dest_rect, TV_FULL_DEST_L,TV_FULL_DEST_T, TV_FULL_DEST_W, TV_FULL_DEST_H);
    {
        tv_src_rect.uStartX = TV_FULL_SRC_L;
        tv_src_rect.uStartY = TV_FULL_SRC_T;
        tv_src_rect.uWidth  = TV_FULL_SRC_W;
        tv_src_rect.uHeight = TV_FULL_SRC_H;
    }
#endif

    if (tv_src_rect.uStartX % 16)
	{
		tv_src_rect.uStartX &= 0xfff0;
	}
	if (tv_src_rect.uWidth % 16)
	{
		tv_src_rect.uWidth += 15;
		tv_src_rect.uWidth &= 0xfff0;
	}
    
    vpo_zoom(g_vpo_dev,&tv_src_rect,&tv_dest_rect);
#ifdef DUAL_VIDEO_OUTPUT    
	vpo_zoom(g_sd_vpo_dev,&tv_src_rect,&tv_dest_rect);
#endif
#endif	
        
}