4void FM_PutStringAA(word rgn, dword x, dword y, dword maxX,
char *str, dword fcolor, dword bcolor,
tFontData *FontData,
byte bDot,
byte align,
float AntiAliasFactor)
16 int width = 0, newstrlen;
19 dword LastBackgroundPixel = 0;
20 byte LastForegroundPixel = 0;
27 if(!str || !str[0] || !FontData || !FontData->
pFontData || (maxX <= x))
35 strncpy(newstr, str,
sizeof(newstr));
36 newstr[
sizeof(newstr) - 1] =
'\0';
47 p = &newstr[strlen(newstr) - 1];
50 newstrlen = strlen(newstr);
61 }
while((XEnd > (
int)maxX) && (width != 0) && (newstrlen > 0));
70 p = &newstr[strlen(newstr) - 1];
75 newstrlen = strlen(newstr);
86 }
while((XEnd > (
int)maxX) && (width != 0) && (newstrlen > 0));
87 strcat(newstr,
"...");
101 newstrlen = strlen(newstr);
111 }
while((XEnd > (
int)maxX) && (width != 0) && (newstrlen > 0));
112 DeleteAt(newstr, 0, (
int)(p - newstr));
138 SaveBoxX = x + ((maxX - XEnd) >> 1);
144 SaveBoxX = maxX - (XEnd - x);
153 if(bcolor & 0xff000000)
155 TAP_Osd_FillBox(rgn, x, y, maxX - x + 1, YEnd - y + 1, bcolor);
159 PixelData = (dword*) TAP_Osd_SaveBox(rgn, SaveBoxX, y, XEnd - x + 1, YEnd - y + 1);
163 StrLen = strlen(newstr);
164 for(i = 0; i < StrLen; i++)
175 for(
Y = 0;
Y < CH;
Y++)
177 CY = (XEnd - x + 1) *
Y;
178 for(
X = 0;
X < CW;
X++)
182 Grey = *FontBitmap++;
186 if(compressed_font && (Grey == 0x00 || Grey == 0xff))
187 repcnt = *FontBitmap++ - 1;
196 PixelData[CX +
X + CY] = fcolor;
201 if(bcolor & 0xff000000)
207 if((LastForegroundPixel != Grey) || (LastBackgroundPixel != PixelData[CX +
X + CY]))
209 LastBackgroundPixel = PixelData[CX +
X + CY];
210 LastForegroundPixel = Grey;
211 LastPixel = (fcolor & 0xff000000) |
FM_AlphaBlendRGB(Grey, fcolor, LastBackgroundPixel, AntiAliasFactor);
214 PixelData[CX +
X + CY] = LastPixel;
224 TAP_Osd_RestoreBox(rgn, SaveBoxX, y, XEnd - x + 1, YEnd - y + 1, PixelData);
225 TAP_MemFree(PixelData);
byte FM_CharToIndex(byte Char)
bool FM_isValidCharacter(byte Char)
void FM_InitAlphaLUT(dword fgColor, dword bgColor, float AntiAliasFactor)
dword FM_AlphaBlendRGB(byte Alpha, dword FG, dword BG, float AntiAliasFactor)
dword FM_GetStringHeight(char *Text, tFontData *FontData)
dword FM_GetStringWidth(char *Text, tFontData *FontData)
void FM_PutStringAA(word rgn, dword x, dword y, dword maxX, char *str, dword fcolor, dword bcolor, tFontData *FontData, byte bDot, byte align, float AntiAliasFactor)
word GetOSDRegionWidth(word Region)
void InsertAt(const char *SourceString, int Pos, char *NewString)
void DeleteAt(char *SourceString, int Pos, int Len)