⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 osd_bmpui.c

📁 Sunplus 8202S source code.
💻 C
📖 第 1 页 / 共 3 页
字号:
                }
                pTopLine[iDispLoc+i] = pixel8;
            }

        	if(iFontWidth%8)
			    pos=pos+iFontWidth/8+1;
        	else
        		pos=pos+iFontWidth/8;
      
            if(p_scan==0)
            {
               //draw bottom line
               for (i=0; i<iFontWidth/2; i++) 
               {
                	BYTE c;
			        c=pFont[pos+i/4];
                	pixel8 = pBtmLine[iDispLoc+i];//zhao add 2004-2-27 14:41
	              
                    switch(i%4)
                    {
              			case 0:
    					    curByte=(c&0xc0)>>6;
    					    break;
    				    case 1:
    					    curByte=(c&0x30)>>4;
    	                    break;
    	                case 2:	
    	                    curByte=(c&0x0c)>>2;
                  			break;
                  		case 3:	
                  			curByte=(c&0x03);
                  			break;
          			}
                    for (k=0; k<2; k++) 
                    {          
                    	if ( (1<<k) & curByte ) 
                			pixel8 = (pixel8 & (~( 0x0f<<k*4))) |(fontColor<<(k*4));//zhao add 2004-2-27 14:41
                        else
			  	        {
                            if(bkColor != 0)//if color index is 0, no need to change the vlaue fo pixel8
                        		pixel8 = (pixel8 & (~( 0x0f<<k*4))) | (bkColor<<(k*4));//zhao add 2004-2-27 14:41
                        }
                 	 }

        	        pBtmLine[iDispLoc+i] = pixel8;
                }
            
   		    if(iFontWidth%8)
			    pos=pos+iFontWidth/8+1;
        	else
        		pos=pos+iFontWidth/8;
            
            }
            
            iDispLoc += iRegionWidth;
            

        }//for charactor heigh  
        
         //move to next character and move up to first line of this string
        iDispLoc = iDispLoc + (iFontWidth/2) - (iRegionWidth*iFontHigh);
   
    } // end of while ( (c=((BYTE *)str)[unFontLoc])!='\0' )

}


/* 
 * Fuction:
 *	  osd_draw_repeat_bmp()
 * Description:
 *      draw the bmp repeatly.
 *
 * INPUT:
 *      uiXStart,uiYStart --> the start of bmp, 
 *      uiXWidth,uiYStart --> the width and height of the needed bmp by repeat line bmp
 *      r----> region
 *CREATOR: feeling
 * DATE: 2004-10-28 
 */
void osd_draw_repeat_bmp(UINT16 uiXStart,UINT16 uiYStart,UINT16 uiXWidth,UINT16 uiYHeight,const BYTE* bmp,BYTE r)
{
    
		UINT16 uiXRepeat = 0;
		UINT16 uiYRepeat = 0;
		UINT16 uiCurX;
	    	UINT16 uiCurY;
	    	int i,j;

		//the uiXWidth is the demand width that can be seen on the screen, and bmp[0] is the actual size of bmp
    		//i.e. uiXWidth = 576, bmp[0] = 2, it means the bmp needs to be drawn for 288 times one by one repeatly
		if(uiXWidth % bmp[0])
			uiXRepeat = uiXWidth / bmp[0] + 1;
		else
		uiXRepeat = uiXWidth / bmp[0];

		if(uiYHeight % bmp[1])
			uiYRepeat = uiYHeight / bmp[1] + 1;
		else
		uiYRepeat = uiYHeight / bmp[1];
	
		
		for (j = 0, uiCurY = uiYStart; j < uiYRepeat; j++, uiCurY += bmp[1] )
    		{
        		for (i = 0,uiCurX = uiXStart; i < uiXRepeat; i++, uiCurX += bmp[0] )
        		{
          			// printf("uiCurX = %d\n",uiCurX);
            			osd_draw_bmp(uiCurX, uiCurY, bmp, r);
        		}
    		}
    		           
}

/* 
 * Fuction:
 *	  OSD_LayoutBmp()
 * Description:
 *      draw the bmp defined in g_aOsdBitmapLayout[],  according to the index.
 *	if offset equals to 0 and uiOffsetIndex also equals to 0 , that means draw a single bitmap.

 * INPUT:
 *      uiLayoutBmpIndex -->index of g_aOsdBitmapLayout[]
 * 	 uiOffsetIndex --->> the offset index,such as page or level etc.
 * NOTE:
 *      the postion of the bmp is not fixed ,it can be variable,according to the offset.
*
 *CREATOR: feeling
 * DATE: 2004-07-08 15:12
  *modify: feeling 2004-10-25
 */
void OSD_LayoutBmp(UINT8 uiLayBmpIndex,UINT8 uiOffsetIndex)
{

	const OSD_BITMAP_LAYOUT_S* pLayout = 0;
	const BYTE*	bmp;
	UINT16 uiXPos = 0;
	UINT16 uiYPos = 0;
	
	//select layout bitmap infomation
	switch (full_scrn)
	{
#ifdef OSD_BMP_SOUND
		case SOUND:
		    pLayout =  &g_aOsdSoundBmp[uiLayBmpIndex];
		    break;
#endif
#ifdef OSD_BMP_PROG
		case PROGRAM:
		    pLayout =  &g_aOsdProgBmp[uiLayBmpIndex];
		    break;
#endif
	}
	

	// the actual bmp width and height
	bmp = g_aOsdBitmap[pLayout->uiIndex];

	//the pos of the bitmap according to the uiPage and offset
	uiXPos = pLayout->uiXStart + uiOffsetIndex * pLayout->uiXOffset;
	uiYPos = pLayout ->uiYStart + uiOffsetIndex * pLayout ->uiYOffset;

	
	// draw bmp no need repeat
	if (((pLayout->uiXWidth == 0) && (pLayout->uiYHeight == 0))//have not fill the width and height in array
	    ||((pLayout->uiXWidth == bmp[0]) && (pLayout->uiYHeight == bmp[1])))//fill the width and height in array
	{
		osd_draw_bmp(uiXPos,
            uiYPos, 
            bmp, 
            pLayout->bRegion);
	}		

	//draw bmp need  repeat
	else
	{	
		osd_draw_repeat_bmp(uiXPos, 
		    uiYPos,
            pLayout->uiXWidth,
            pLayout->uiYHeight,
            bmp,
            pLayout->bRegion);		                    
	}//end else
	
}//end Osd_LayoutBmp


/* 
 * Fuction:
 *	  OSD_LayoutLine()
 * Description:
 *      draw the bmp defined in g_aOsdLineLayout[],  according to the index.
 *	if offset equals to 0 and uiOffsetIndex also equals to 0 , that means draw a single line.

 * INPUT:
 *      uiLayoutLineIndex --> index of g_aOsdLineLayout[], 
 *	uiOffsetIndex --->index of the offset, such as page and level etc.
 *
 *CREATOR: feeling
  *DATE: 2004-10-25
 */
void OSD_LayoutLine(UINT16 uiLayLineIndex, UINT8 uiOffsetIndex)
{

	const OSD_LINE_LAYOUT_S* pLayout = 0;
	UINT16 uiXPos = 0;
	UINT16 uiYPos = 0;
	
	//pick out the layout line infomation
	switch (full_scrn)
	{
#ifdef OSD_BMP_SOUND
		case SOUND:
		    pLayout =  &g_aOsdSoundLine[uiLayLineIndex];
		    break;
#endif		    
#ifdef OSD_BMP_PROG
		case PROGRAM:
		    pLayout =  &g_aOsdProgLine[uiLayLineIndex];
		    break;
#endif		    
	}

	uiXPos = pLayout ->uiXStart + uiOffsetIndex * pLayout->uiXOffset;
	uiYPos = pLayout ->uiYStart + uiOffsetIndex * pLayout ->uiYOffset;
	    
	//draw the line according to its info structure
	osd_draw_hline_region(uiXPos, 
	    uiXPos + pLayout->uiXLen, 
	    uiYPos,
	    pLayout->uiColor, 
	    pLayout->uiYLen,
	    pLayout->bRegion);
		
}//end OSD_LayouPosVariableLine

/* 
 * Fuction:
 *	  OSD_LayoutRect()
 * Description:
 *      draw the bmp defined in g_aOsdRectLayout[],  according to the index.
 *
 * INPUT:
 *      uiLayoutRectIndex --> index of g_aOsdRectLayout[], 
 *		uiOffsetIndex ----> the offset index , such as page and level, etc.
*
 *CREATOR: feeling
  *DATE: 2004-10-25
 */
void OSD_LayoutRect(UINT16 uiLayRectIndex, UINT8 uiOffsetIndex)
{

	const OSD_RECT_LAYOUT_S* pLayout = 0;
	
	//pick out the layout line infomation
	switch (full_scrn)
	{
#ifdef OSD_BMP_SOUND
		case SOUND:
		    pLayout =  &g_aOsdSoundRect[uiLayRectIndex];
		    break;
#endif		    
#ifdef OSD_BMP_PROG
		case PROGRAM:
		    pLayout =  &g_aOsdProgRect[uiLayRectIndex];
		    break;
#endif    
	}

	osd_draw_region_rect(pLayout->uiXStart + uiOffsetIndex * pLayout->uiXOffset,
	    pLayout->uiYStart + uiOffsetIndex * pLayout ->uiYOffset,
	    pLayout->uiXWidth,
        pLayout->uiYHeight,
        pLayout->uiBgColor,
        pLayout->bRegion);
		
}//end OSD_LayoutRect




/* 
 * Fuction:
 *	  OSD_LayoutStr()
 * Description:
 *      draw the bmp defined in g_aOsdStrLayout[],  according to the index.
 *		 	  if offset equals to 0 and uiOffsetIndex also equals to 0 , that means draw a single string.

 * INPUT:
 *      uiLayoutStrIndex --> index of g_aOsdStrLayout[], 
 *		str--->the str need to be showed
 *		uiOffsetIndex ----> the offset index , such as page and level, etc.
*
 *CREATOR: feeling
  *DATE: 2004-10-25
 */
void OSD_LayoutStr(const BYTE *str, UINT16 uiLayStrIndex, UINT8 uiOffsetIndex)
{

	const OSD_STR_LAYOUT_S* pLayout = 0;
	
	//pick out the layout line infomation
	switch (full_scrn)
	{
#ifdef OSD_BMP_SOUND
		case SOUND:
		    pLayout =  &g_aOsdSoundStr[uiLayStrIndex];
		    break;
#endif		    
#ifdef OSD_BMP_PROG		
		case PROGRAM:
		    pLayout =  &g_aOsdProgStr[uiLayStrIndex];
		    break;
#endif	    
	}

	osd_Draw_Bmp_RegionString(pLayout->uiXStart + uiOffsetIndex * pLayout->uiXOffset,
	    pLayout->uiYStart + uiOffsetIndex * pLayout ->uiYOffset,
	    str,
	    pLayout->uiFontColor,
	    pLayout->uiBgColor,
	    pLayout->bRegion);
		
}//end OSD_LayoutStr

/* 
 * Fuction:
 *	  OSD_LayoutLittleStr()
 * Description:
 *      draw the string defined in g_aOsdStrLayout[],  according to the index.
 *		 	  if offset equals to 0 and uiOffsetIndex also equals to 0 , that means draw a single string.

 * INPUT:
 *      uiLayoutStrIndex --> index of g_aOsdStrLayout[], 
 *		str--->the str need to be showed
 *		uiOffsetIndex ----> the offset index , such as page and level, etc.
 *
 * Note:Layout little (1/4 size of normal)string
 */

void OSD_LayoutLittleStr(const BYTE *str, UINT16 uiLayStrIndex, UINT8 uiOffsetIndex)
{
	const OSD_STR_LAYOUT_S* pLayout = 0;
	
	//pick out the layout line infomation
	switch (full_scrn)
	{
#ifdef OSD_BMP_SOUND
		case SOUND:
		    pLayout =  &g_aOsdSoundStr[uiLayStrIndex];
		    break;
#endif		    
#ifdef OSD_BMP_PROG		
		case PROGRAM:
		    pLayout =  &g_aOsdProgStr[uiLayStrIndex];
		    break;
#endif	    
	}

    osd_Draw_Bmp_Little_RegionString(pLayout->uiXStart + uiOffsetIndex * pLayout->uiXOffset,
	    pLayout->uiYStart + uiOffsetIndex * pLayout ->uiYOffset,
	    str,
	    pLayout->uiFontColor,
	    pLayout->uiBgColor,
	    pLayout->bRegion);
		
}//end OSD_LayoutStr


#ifdef OSD_BMP_DISPLAY//feeling
void OSD_LayoutBmpDisplay(UINT8 uiLayoutIndex)
{

	const OSD_BITMAP_LAYOUT_S* pLayout = 0;
	
	//select layout bitmap infomation
	pLayout =  &g_aOsdDispBmp[uiLayoutIndex];
	
	//only draw bmp no need repeat
	if ((pLayout->uiXWidth!= 0) 
       	||(pLayout->uiYHeight != 0))
		return;
 
	#ifdef OSD_VARIABLE_TEMP_DISPLAY_BUF
    	osd_draw_bmp(pLayout->uiXStart, pLayout->uiYStart, 
        	     g_aOsdBitmap[pLayout->uiIndex], 
        	     temp_region);
	#else
    	osd_draw_bmp_display(pLayout->uiXStart, pLayout->uiYStart, 
                 g_aOsdBitmap[pLayout->uiIndex], 
                 disp_region);
    #endif 	     

}//end Osd_LayoutBmpDisplay
#endif//#ifdef OSD_BMP_DISPLAY






#endif//ifdef OSD_BMP

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -