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

📄 osd_midi.c

📁 Sunplus 8202S source code.
💻 C
📖 第 1 页 / 共 4 页
字号:
               if (c1 >= 0xe1 && c1 <= 0xfa)
                    x1 += pabc_Width[c1 - 0xe1];//+margin;
                else if ((c1 >= 0xc1) && (c1 <= 0xda))
                    x1 += pABC_Width[c1 - 0xc1];//+margin;
                else if ((c1 > 0xaf) && (c1 < 0xba))
                {
                    x1 += pNum_Width[c1 - 0xb0] + margin;
                }
                else
                {
                    x1 += uOtherWidth;  //OTHER_FONT_WIDTH
                }
            }
            else
            {
                x1 += (uFontWidth) + margin;        //LYRIC_FONT_WIDTH
            }
        }
 #ifdef SUPPORT_GB_FONTBASE3
        else if (iRes == 3)
        {
            {
                if (((endXEdge - x1) < (uFontWidth))||((iRegionWidth - x1) < (uFontWidth)))  //LYRIC_FONT_WIDTH
                {
                    //                  ulLineTotalColumns[(cLineDisp^1)] = x1;
                 //   printf("ulLineTotalColumns ==%d\n", x1);
                    break;   //width is not enough break
                }
            }        
            draw_midi_bitmap_HZnew(gb3pos,x1, y1<<1, Fontcolor, Bgcolor,FigureColor, FontType, regNum);
            x1 += (uFontWidth) + margin;        //LYRIC_FONT_WIDTH
        }    
#endif
        else
        {
            printf(" show sp ");
            if (((endXEdge - x1) < (uOtherWidth))||((iRegionWidth - x1) < (uOtherWidth)))  // LYRIC_FONT_WIDTH
                break;   //width is not enough break
#ifdef SUPPORT_SANJING_WIDESAPCE                //xlluo for sj space 04-10-15
            Osd_Clear_Rect(x1,  yy, uOtherWidth+3,FontHeight,Bgcolor,regNum);
            x1 += uOtherWidth; //OTHER_FONT_WIDTH
#else
            if ((c == ' ') && (*(p - 1) != ' '))
            {
                Osd_Clear_Rect(x1,  yy, uOtherWidth+3,FontHeight,Bgcolor,regNum);
                x1 += uOtherWidth; //OTHER_FONT_WIDTH
            }
#endif
        }
        printf(" x1 is %d\n",x1);
        p++;
    }
    osd_tog_region(regNum, OSD_ON);
    return x1;
}
#endif
//*************************************************
//***clear the Rect region
// only for OSD_FORMAT_16COLOR 
//***int xx, int yy,:the position
//***int xlen, int ylen: the x&y length 
//***BYTE colour: the color that fill in the osd region
//***BYTE regNum:the region NO.
//*************************************************
void Osd_Clear_Rect(int xx, int yy, int xlen, int ylen, BYTE colour,
    BYTE regNum)
{
    BYTE* pTopLine, * pBtmLine, * pLine;
    BYTE colbyte;//bDispHalfByte;
    UINT32 iDispLoc;
    int i, j;
    int iRegionWidth = region[regNum].osd_w;

    if (p_scan ==1)
    {
        yy<<=1;
        ylen<<=1;
    }
    
    pTopLine = (BYTE *) (((BYTE *) get_osdbuf_baseptr()) +
        (region[regNum].osd_header[0] + OSD_DATA_OFFSET(region[regNum].osd_format)) * 32);
    pBtmLine = (BYTE *)(((BYTE *) get_osdbuf_baseptr()) +
        (region[regNum].osd_header[1] + OSD_DATA_OFFSET(region[regNum].osd_format)) * 32);

    iDispLoc = (((yy - ((yy) & 0x01)) * iRegionWidth ) + (xx))>>1;

    colbyte =(BYTE)(((colour & 0x0f) << 4) | (colour & 0x0f));
    for (j = 0; j < ylen; j++)
    {
        if ((j + yy) & 0x01)
            pLine = pBtmLine;
        else
            pLine = pTopLine;
        for (i = 0; i < xlen; i++) //print one point per time
        {
           if (i & 0x01)
            {
                pLine[iDispLoc + (i >> 1)] = colbyte;//&0x0f;
            }
        }
        if ((j + yy) & 0x01)
            iDispLoc += iRegionWidth;
    }
}


/*******************************
    // clear a line of lyric 
    //BYTE Ystart :clear line y position
    //BYTE regNum OSD Number
    //
    //for height = 40
    //support the 16 color
********************************/
void ClearOSDStrLine(UINT16 fwidth, UINT16 Xstart, UINT16 Ystart, BYTE regNum)
{
    Osd_Clear_Rect(Xstart,Ystart,fwidth,(LYRIC_FONT_HIGHT),0,regNum);
}



/*******************************************
//draw vertline and the font bitmap  reverse video
//int xx :the x position
//int yy :the y position
//short height :font hight
//BYTE columns :pels num for rev
//only for the 16 colors
********************************************/
void Disp_one_vertline(int xx, int yy, UINT16 height, UINT16 columns,
    BYTE regNum)
{
    int i, j, k;
    BYTE* pTopLine, * pBtmLine, * pLine;
    UINT32 iDispLoc, uiDispHalfByte,bDispHalfByte;
    int iRegionWidth = region[regNum].osd_w;
    UINT16 high = height;
    UINT16 width = columns;

    pTopLine = (BYTE *)((BYTE *) get_osdbuf_baseptr() +
        region[regNum].osd_header[0] * 32 +
        OSD_DATA_OFFSET(region[regNum].osd_format) * 32);
    pBtmLine = (BYTE *)((BYTE *) get_osdbuf_baseptr() +
        region[regNum].osd_header[1] * 32 +
        OSD_DATA_OFFSET(region[regNum].osd_format) * 32);

    if (p_scan ==1)
    {    
        yy<<=1;
    }
    uiDispHalfByte = (((yy) * iRegionWidth) + (xx));
    iDispLoc = (((yy - ((yy) & 0x01)) * iRegionWidth) + (xx)) >> 1;

    for (i = 0; i < high; i++)
    {
        if ((i + yy) & 0x01)
            pLine = pBtmLine;
        else
            pLine = pTopLine;
        bDispHalfByte = (uiDispHalfByte) & 0x01;

        for (j = 0; j < width; j++)
        {
            k = (((xx) & 0x01) + j) >> 1;
            bDispHalfByte ^= 1;
            if (bDispHalfByte == 0)
            {
                if ((pLine[k + iDispLoc] & 0x0f) == LyricFigureColor) 
                    pLine[k + iDispLoc] = (pLine[k + iDispLoc] & 0xf0) |
                        LyricFontcolor; 
                else if ((pLine[k + iDispLoc] & 0x0f) == LyricFontcolor)
                    pLine[k + iDispLoc] = (pLine[k + iDispLoc] & 0xf0) |
                        LyricRevcolour;
            }
            else
            {
                if ((pLine[k + iDispLoc] & 0xf0) == (LyricFigureColor << 4)) 
                    pLine[k + iDispLoc] = (pLine[k + iDispLoc] & 0x0f) |
                        (LyricFontcolor << 4); 
                else if ((pLine[k + iDispLoc] & 0xf0) == (LyricFontcolor << 4))
                    pLine[k + iDispLoc] = (pLine[k + iDispLoc] & 0x0f) |
                        (LyricRevcolour << 4);
            }
        }
        if (((i + yy) & 0x01)||(p_scan ==1))
            iDispLoc += iRegionWidth;
    }
    osd_tog_region(REGION3, OSD_ON);
}



void osd_Clear_Region(BYTE reg, BYTE bkColor)
{
    Osd_Clear_Rect(0,0,region[reg].osd_w<<1,region[reg].osd_h,bkColor,reg);
}


#ifdef MIDI_MULTI_MENU
//***************************//
//updown == 0,display 凹//
//updown == 1,display 凸//
//updown > 1 ,normal display//
//**************************//
#define ARC_REGION_COLOUR_GROUND    (0)
#define ARC_REGION_COLOUR_FOUNT       (13)
#define ARC_REGION_COLOUR_EDGE         (13)

void midi_menu_draw_arc_region(int xStart, int yStart, int xLen, int yLen,
    BYTE regNum, BYTE Enable)
{
    BYTE* pTopLine, * pBtmLine, * pLine, radius;
    UINT32 iDispLoc;
    int i, j;
    int Region;
    int iRegionWidth = region[regNum].osd_w;
    BYTE cground, cfount, cedge, curColour, cfount1;

    cground = cfount = cedge = curColour = cfount1 =0;
    Region = regNum;

    if (p_scan ==1)
    {
        yStart<<=1;
        yLen<<=1;
    }
    
    pTopLine = (BYTE *)
        (((BYTE *) get_osdbuf_baseptr()) +
        (region[regNum].osd_header[0] + OSD_DATA_OFFSET(region[regNum].osd_format)) * 32);
    pBtmLine = (BYTE *)
        (((BYTE *) get_osdbuf_baseptr()) +
        (region[regNum].osd_header[1] + OSD_DATA_OFFSET(region[regNum].osd_format)) * 32);

    radius = sizeof(arc_tableLT[0]);
    //    printf("RADIUS ==%d\n",radius);

    iDispLoc = ((yStart - ((yStart) & 0x01)) * iRegionWidth / 2) +
        (xStart / 2);
    if (Enable)
    {
        cground = ARC_REGION_COLOUR_GROUND;
        cfount = ARC_REGION_COLOUR_FOUNT;
        cfount1 = 0x2;
        cedge = ARC_REGION_COLOUR_EDGE;
    }
    for (j = 0; j < yLen; j++)
    {
        if ((j + yStart) & 0x01)
            pLine = pBtmLine;
        else
            pLine = pTopLine;

        if (Enable)
        {
            for (i = 0; i < xLen; i++) //print one point per time
            {
                if ((i < radius) && (j < radius))//draw left-top corner
                {
                    if ((arc_tableLT[j][i] == 0))
                        curColour = cground;
                    else if ((arc_tableLT[j][i] == 1))
                        curColour = cedge;
                    else if ((arc_tableLT[j][i] == 2))
                        curColour = cfount;
                    else if ((arc_tableLT[j][i] == 3))
                        curColour = cfount1;
                }
                else if ((i >= xLen - radius) && (j < radius))//draw right-top corner
                {
                    if ((arc_tableRT[j][i - xLen + radius] == 0))
                        curColour = cground;
                    else if ((arc_tableRT[j][i - xLen + radius] == 1))
                        curColour = cedge;
                    else if ((arc_tableRT[j][i - xLen + radius] == 2))
                        curColour = cfount;
                }
                else if ((i < radius) && (j >= yLen - radius))//draw left-bottom corner
                {
                    if ((arc_tableLB[j - yLen + radius][i] == 0))
                        curColour = cground;
                    else if ((arc_tableLB[j - yLen + radius][i] == 1))
                        curColour = cedge;
                    else if ((arc_tableLB[j - yLen + radius][i] == 2))
                        curColour = cfount;
                }
                else if ((j >= yLen - radius) && (i >= xLen - radius))//draw right-bottom corner
                {
                    if (arc_tableRB[j - yLen + radius][i - xLen + radius] == 0)
                        curColour = cground;
                    else if (arc_tableRB[j - yLen + radius][i - xLen + radius] ==
                        1)
                        curColour = cedge;
                    else if (arc_tableRB[j - yLen + radius][i - xLen + radius] ==
                        2)
                        curColour = cfount;
                }
                else
                    curColour = cfount;//cfount;
                if (i & 0x01)
                {
                    pLine[iDispLoc + (i >> 1)] |= curColour & 0x0f;
                }
                else
                {
                    pLine[iDispLoc + (i >> 1)] |= (curColour << 4) & 0xf0;
                }
            }
        }
        else
        {
            for (i = 0; i < xLen; i++) //print one point per time
            {
                pLine[iDispLoc + (i >> 1)] = 0;
            }
        }
        if ((j + yStart) & 0x01)
            iDispLoc += iRegionWidth;
    }

    //    timeout_osd[Region] = 0;
    osd_tog_region(Region, OSD_ON);
}


void Midi_Draw_Rect(int xx, int yy, UINT16 xLen, UINT16 yLen, BYTE BgColor,
    BYTE FrontC, BYTE FigC, BYTE regNum)
{
    int i, j, k;
    BYTE* pTopLine, * pBtmLine, * pLine;
    UINT32 iDispLoc, uiDispHalfByte;
    int iRegionWidth = region[regNum].osd_w;
    UINT16 high = yLen;
    UINT16 width = xLen;

    if (p_scan ==1)
    {
        yy<<=1;
        yLen<<=1;
    }

    pTopLine = (BYTE *)
        ((BYTE *) get_osdbuf_baseptr() +
        region[regNum].osd_header[0] * 32 +
        OSD_DATA_OFFSET(region[regNum].osd_format) * 32);
    pBtmLine = (BYTE *)
        ((BYTE *) get_osdbuf_baseptr() +
        region[regNum].osd_header[1] * 32 +
        OSD_DATA_OFFSET(region[regNum].osd_format) * 32);
    uiDispHalfByte = (((yy - ((yy) & 0x01)) * iRegionWidth) + (xx));
    iDispLoc = (uiDispHalfByte) >> 1;

    for (i = 0; i < high; i++)
    {
        if (((i + yy) & 0x01)||(p_scan ==1))
            pLine = pBtmLine;
        else
            pLine = pTopLine;
        uiDispHalfByte = (xx) & 0x01;

        for (j = 0; j < width; j++)
        {
            k = (((xx) & 0x01) + j) >> 1;
            uiDispHalfByte ^= 1;
            if (uiDispHalfByte == 1)
            {
                if ((pLine[k + iDispLoc] & 0x0f) == MENU_BACKGROUND_COLOR)
                    pLine[k + iDispLoc] = (pLine[k + iDispLoc] & 0xf0) |
                        BgColor;
                else if ((pLine[k + iDispLoc] & 0x0f) == MENU_LINE_COLOR)
                    pLine[k + iDispLoc] = (pLine[k + iDispLoc] & 0xf0) |
                        BgColor;
            }
            else
            {
                if ((pLine[k + iDispLoc] & 0xf0) == (MENU_BACKGROUND_COLOR << 4))
                    pLine[k + iDispLoc] = (pLine[k + iDispLoc] & 0x0f) |
                        (BgColor << 4);
                else if ((pLine[k + iDispLoc] & 0xf0) == (MENU_LINE_COLOR << 4))
                    pLine[k + iDispLoc] = (pLine[k + iDispLoc] & 0x0f) |
                        (BgColor << 4);
            }
        }
        if (((i + yy) & 0x01)||(p_scan ==1))
            iDispLoc += iRegionWidth;
    }
    osd_tog_region(regNum, OSD_ON);
}

#endif  //end #ifdef MIDI_MULTI_MENU

#endif  //end #ifdef SUPPORT_OSDLYRIC

//xlluo 04-6-14
#ifdef   SUPPORT_SCANMODE_SWITCH
void MIDI_MoveRegion(BYTE r,UINT16 x,UINT16 y,UINT16 h,UINT16 w)
{
    UINT16* pOSDHeader1 = (UINT16*)(get_osdbuf_baseptr() + region[r].osd_header[0] * 32);
    UINT16* pOSDHeader2 = (UINT16*)(get_osdbuf_baseptr() + region[r].osd_header[1] * 32);   
    UINT16 nCol, nRow;
    UINT16 nHig,nWid;

 if (p_scan)//ouyang 20040930
    {
       y<<=1;
       h<<=2;
    }
    
    nRow = y & 0x3ff; 
    nCol = x & 0x3ff;
    nHig = h&0x3ff;
    nWid =w&0x3ff;

    wbe16(pOSDHeader1 + 4, nRow);
    wbe16(pOSDHeader2 + 4, nRow);
    wbe16(pOSDHeader1 + 5, nCol);
    wbe16(pOSDHeader2 + 5, nCol);
    
  /*  wbe16(pOSDHeader1 + 2, nHig);
    wbe16(pOSDHeader2 + 2, nHig);
    wbe16(pOSDHeader1 + 3, nWid);
    wbe16(pOSDHeader2 + 3, nWid);*/

}

//xlluo add for clean the sysmesssage
void CleanSysMessage(BYTE regnum)
{
    printf("CleanSysMessage \n");
     osd_tog_region(regnum,OSD_OFF);
     memset(osdbuf,0,sizeof(osdbuf));
     memset(osd_buf,0,sizeof(osd_buf));
     memset(RegionValStr[regnum],0,14);
}
#endif











⌨️ 快捷键说明

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