📄 osd_midi.c
字号:
ST_GBPos* GBPos;
BYTE* pTemp;
pTopLine = (BYTE *)(((BYTE *) get_osdbuf_baseptr()) +
(region[number].osd_header[0] + OSD_DATA_OFFSET(region[number].osd_format)) * 32);
pBtmLine = (BYTE *)(((BYTE *) get_osdbuf_baseptr()) +
(region[number].osd_header[1] + OSD_DATA_OFFSET(region[number].osd_format)) * 32);
iDispLoc = (yStart ) * iRegionWidth + xStart;
bDispHalfByte = iDispLoc & 0x01;
iDispLoc = (((yStart - ((yStart) & 0x01)) * iRegionWidth ) + (xStart))>>1;
switch (osd_format)
{
case OSD_FORMAT_4COLOR:
Bperpixel = 2; // 4
shift_num = 2;
break;
case OSD_FORMAT_256COLOR:
Bperpixel = 0; // 1
shift_num = 8;
break;
case OSD_FORMAT_16COLOR:
Bperpixel = 1; // 2
shift_num = 4;
break;
default:
Bperpixel = 1; // 2
shift_num = 4;
break;
}
pTemp = (BYTE *) (LYRIC_FONT_HZ_INDEX);
GBPos = (ST_GBPos *) pTemp;
tempi = 0;
while ((GBPos[tempi].uGBCode != c))
{
if ((GBPos[tempi].uBitmapPos == 0))
return ;
tempi++;
}
pFont = (UINT8 *) (MIDI_OSDFONT_ADDR);
NewFormatFlag = pFont[0];
if (NewFormatFlag != 0xff)
{
fwidth = pFont[0];
fhight = pFont[1];
pFont = GBPos[tempi].uBitmapPos;
disploc = 0;
for (i = 0; i < fhight; i++)
{
if ((i + yStart) & 0x01)
pLine = pBtmLine;
else
pLine = pTopLine;
for (j = 0; j < fwidth; j++)
{
tempi = (j+bDispHalfByte) >> Bperpixel;
if (pFont[((j + disploc) >> 3) + 3] & (0x80 >>
((j + disploc) & 0x07)))
pLine[iDispLoc + tempi] = (pLine[iDispLoc + tempi] <<
shift_num) |
fontcolor;
else
pLine[iDispLoc + tempi] = (pLine[iDispLoc + tempi] <<
shift_num) |
bgcolor;
}
disploc += fwidth ;
if ((i + yStart) & 0x01)
iDispLoc += iRegionWidth;
}
}
else
{
#if 0
switch(FontType)
{
case 0:
fontcolor=bgcolor;
break;
case 1:
FigureColor=bgcolor;
break;
case 2:
// FigureColor = 11;
break;
default:
break;
}
#endif
fhight = (pFont[4] << 8) | pFont[3];
fwidth = (pFont[6] << 8) | pFont[5];
fbit = fwidth * fhight;
pFont = GBPos[tempi].uBitmapPos;
if (fbit & 0x07)
{
p1Font = pFont + (fbit >> 3) + 1;
}
else
{
p1Font = pFont + (fbit >> 3);
}
disploc = 0;
for (i = 0; i < fhight; i++)
{
if ((i + yStart) & 0x01)
pLine = pBtmLine;
else
pLine = pTopLine;
for (j = 0; j < fwidth; j++)
{
CurrentByte = pFont[((j + disploc) >> 3)];
CurrentByte1 = p1Font[((j + disploc) >> 3)];
CurrentBit = CurrentByte & (0x80 >> ((j + disploc) & 0x07));
CurrentBit1 = CurrentByte1 & (0x80 >> ((j + disploc) & 0x07));
tempi = (j+bDispHalfByte) >> Bperpixel;
if (CurrentBit != 0 && CurrentBit1 != 0)
{
pLine[iDispLoc + tempi] |= ((pLine[iDispLoc + tempi] <<
shift_num) & 0xf0) |
fontcolor; //0x02;//
}
else if (CurrentBit == 0 && CurrentBit1 != 0)
{
pLine[iDispLoc + tempi] |= ((pLine[iDispLoc + tempi] <<
shift_num) & 0xf0) |
FigureColor; //0x0b;//
}
else
{
pLine[iDispLoc + tempi] |= ((pLine[iDispLoc + tempi] <<
shift_num) & 0xf0) |
bgcolor; //0x00;//
}
}
disploc += fwidth;
if ((i + yStart) & 0x01)
iDispLoc += iRegionWidth;
}
}
}
#else //#ifdef SUPPORT_ABSTRACT_FONT
/*********************************************************************
// ** function :draw the font bitmap of the GB1 and GB2 ;support the new GB font.
// ** xStart,yStart: the X&Y start position of the coordinate
// ** c: GB code
// ** fontcolor: the font color
// ** bgcolor : the background color of the font
// ** FigureColor: the figure color of the font
// ** FontType : the font type
// ** number: the OSD region NO.
// ** FontBaseNo: the font database NO.
***********************************************************************/
void osd_midi_DrawHZ_Mem(int xStart, int yStart, UINT16 c, BYTE fontcolor,
BYTE bgcolor, BYTE FigureColor, BYTE FontType, BYTE number,
BYTE FontBaseNo)
{
BYTE CurrentByte, CurrentByte1, CurrentBit, CurrentBit1;
BYTE NewFormatFlag = 0,bDispHalfByte; //ByteLow,ByteHi;
BYTE* p1Font, * pFont = (void*) (0), * pFont1;
BYTE* pTopLine, * pBtmLine, * pLine;
BYTE* pGB1Font = (void*) (0), * pGB2Font =(void*) (0);
UINT32 iDispLoc, disploc; //, uiDispHalfByte
int iRegionWidth = region[number].osd_w ; //>>bIsMenuFont;
int osd_format = region[number].osd_format;
unsigned int fwidth = 0,fhight = 0,fbit = 0;
unsigned int i, j, Bperpixel,shift_num,tempi;
int CH = ( c >> 8), CL = (c& 0xFF);
int Hgbcode;
if (p_scan ==1)
{
yStart<<=1;
}
pTopLine = (BYTE *) (((BYTE *) get_osdbuf_baseptr()) +
(region[number].osd_header[0] + OSD_DATA_OFFSET(region[number].osd_format)) * 32);
pBtmLine = (BYTE *)(((BYTE *) get_osdbuf_baseptr()) +
(region[number].osd_header[1] + OSD_DATA_OFFSET(region[number].osd_format)) * 32);
iDispLoc = (yStart ) * iRegionWidth + xStart;
bDispHalfByte = iDispLoc & 0x01;
iDispLoc = (((yStart - ((yStart) & 0x01)) * iRegionWidth ) + (xStart))>>1;
if (FontBaseNo == MIDI_LYRIC_FONTDEBASE)
{
pGB1Font = (BYTE *) (MIDI_OSDFONT_ADDR);
pGB2Font = (UINT8 *) upMidiGB2FontAddr;
}
#ifdef MIDI_MENU_FONT
else if (FontBaseNo == MIDI_MENU_FONTDEBASE)
{
pGB1Font = (BYTE *) (upMenuGB1FontAddr);
pGB2Font = (UINT8 *) upMenuGB2FontAddr;
}
#endif
switch (osd_format)
{
case OSD_FORMAT_4COLOR:
Bperpixel = 2; // 4
shift_num = 2;
break;
case OSD_FORMAT_256COLOR:
Bperpixel = 0; // 1
shift_num = 8;
break;
case OSD_FORMAT_16COLOR:
Bperpixel = 1; // 2
shift_num = 4;
break;
default:
Bperpixel = 1; // 2
shift_num = 4;
break;
}
//get the font bitmap addr
if ((CH >= 0xA1 && CH < 0xD7 && CL >= 0xA1 && CL < 0xFF) ||
(CH == 0xD7 && CL >= 0xA1 && CL < 0xFa))
{
//the following is GB1 font
if (CH > 0xA9)
{
Hgbcode = 0xA7;
}
else
{
Hgbcode = 0xA1;
}
pFont1 = pGB1Font; //(BYTE *)(MIDI_OSDFONT_ADDR);
NewFormatFlag = pFont1[0];
if (NewFormatFlag != 0xff)
{
fwidth = pFont1[0];
fhight = pFont1[1];
fbit = fwidth * fhight;
if (fbit & 0x07)
{
pFont = (BYTE *)
(pGB1Font +
((CH - Hgbcode) * 94 + (CL - 0xA1)) * ((fbit >> 3) + 1)); //MIDI_OSDFONT_ADDR
}
else
{
pFont = (BYTE *)
(pGB1Font +
((CH - Hgbcode) * 94 + (CL - 0xA1)) * (fbit >> 3)); //MIDI_OSDFONT_ADDR
}
}
else
{
fhight = (pFont1[4] << 8) | pFont1[3];
fwidth = (pFont1[6] << 8) | pFont1[5];
fbit = fwidth * fhight;
if (fbit & 0x07)
{
pFont = (BYTE *)
(pGB1Font +
((CH - Hgbcode) * 94 + (CL - 0xA1)) * ((fbit >> 3) + 1) * 2); //MIDI_OSDFONT_ADDR
}
else
{
pFont = (BYTE *)
(pGB1Font +
((CH - Hgbcode) * 94 + (CL - 0xA1)) * (fbit >> 3) * 2); //MIDI_OSDFONT_ADDR
}
}
}
else if (CH >= 0xD8 && CH < 0xF8 && CL >= 0xA1 && CL < 0xFF)
{
pFont1 = (UINT8 *) pGB2Font; //upMidiGB2FontAddr;
NewFormatFlag = pFont1[0];
if (NewFormatFlag != 0xff)
{
fwidth = pFont1[0];
fhight = pFont1[1];
fbit = fwidth * fhight;
if (fbit & 0x07)
{
//upMidiGB2FontAddr
pFont = (BYTE *)
(pGB2Font +
((CH - 0xd8) * 94 + (CL - 0xA1)) * ((fbit >> 3) + 1));
}
else
{
//upMidiGB2FontAddr
pFont = (BYTE *)
(pGB2Font + ((CH - 0xd8) * 94 + (CL - 0xA1)) * (fbit >> 3));
}
}
else
{
fhight = (pFont1[4] << 8) | pFont1[3];
fwidth = (pFont1[6] << 8) | pFont1[5];
fbit = fwidth * fhight;
if (fbit & 0x07)
{
//upMidiGB2FontAddr
pFont = (BYTE *)
(pGB2Font +
((CH - 0xd8) * 94 + (CL - 0xA1)) * ((fbit >> 3) + 1) * 2);
}
else
{
//upMidiGB2FontAddr
pFont = (BYTE *)
(pGB2Font +
((CH - 0xd8) * 94 + (CL - 0xA1)) * (fbit >> 3) * 2);
}
}
}
//draw the GB1 font bitmap
if (NewFormatFlag != 0xff)
{
pFont = pFont + 3;
disploc = 0;
for (i = 0; i < fhight; i++)
{
if (((i + yStart) & 0x01)||(p_scan==1))
pLine = pBtmLine;
else
pLine = pTopLine;
for (j = 0; j < fwidth; j++)
{
tempi = (j+bDispHalfByte) >> Bperpixel;
if (pFont[((j + disploc) >> 3)] & (0x80 >>
((j + disploc) & 0x07)))
{
pLine[iDispLoc + tempi] = (pLine[iDispLoc + tempi] <<
shift_num) |
fontcolor;
}
else
pLine[iDispLoc + tempi] = (pLine[iDispLoc + tempi] <<
shift_num) |
bgcolor;
}
disploc += fwidth ;
if (((i + yStart) & 0x01)||(p_scan ==1))
iDispLoc += iRegionWidth;
}
}
else
{
#if 1
switch (FontType)
{
case 0:
fontcolor = bgcolor;
break;
case 1:
FigureColor = bgcolor;
break;
case 2:
// FigureColor = 11;
break;
case 3:
FigureColor = fontcolor;
break;
default:
break;
}
#endif
// fbit=fwidth*fhight;
pFont = pFont + 10;
if (fbit & 0x07)
{
p1Font = pFont + (fbit >> 3) + 1;
}
else
{
p1Font = pFont + (fbit >> 3);
}
disploc = 0;
for (i = 0; i < fhight; i++)
{
if (((i + yStart) & 0x01)||(p_scan==1))//xlluo 2004
pLine = pBtmLine;
else
pLine = pTopLine;
for (j = 0; j < fwidth; j++)
{
CurrentByte = pFont[((j + disploc) >> 3)];
CurrentByte1 = p1Font[((j + disploc) >> 3)];
CurrentBit = CurrentByte & (0x80 >> ((j + disploc) & 0x07));
CurrentBit1 = CurrentByte1 & (0x80 >> ((j + disploc) & 0x07));
tempi = (j+bDispHalfByte) >> Bperpixel;
{
if (CurrentBit != 0 && CurrentBit1 != 0)
{
pLine[iDispLoc + tempi] = ((pLine[iDispLoc + tempi] <<
shift_num) & 0xf0) |
fontcolor; //0x02;//
}
else if (CurrentBit == 0 && CurrentBit1 != 0)
{
pLine[iDispLoc + tempi] = ((pLine[iDispLoc + tempi] <<
shift_num) & 0xf0) |
FigureColor; //0x0b;//
}
else
{
pLine[iDispLoc + tempi] = ((pLine[iDispLoc + tempi] <<
shift_num) & 0xf0) |
bgcolor; //0x00;//
}
}
}
disploc += fwidth ;
if (((i + yStart) & 0x01)||(p_scan ==1))
iDispLoc += iRegionWidth;
}
}
osd_tog_region(number ,OSD_ON); //ouyang 2004.07.31
}
#endif //end #ifdef SUPPORT_ABSTRACT_FONT
#ifdef MIDI_MENU_FONT
//the following is 30*30 font width for number and alphabet
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -