DrawTracedText abstraction; bug #1029; from Nic, modified

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3081 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
avolkov
2008-10-05 20:07:37 +00:00
parent e97376aca3
commit 1c6e58d98f
5 changed files with 29 additions and 43 deletions
+1
View File
@@ -1,4 +1,5 @@
Changes towards version 0.7: Changes towards version 0.7:
- DrawTracedText abstraction (bug #1029), from Nic
- Experimental support for Symbian S60 3rd edition - Mika & SvdB - Experimental support for Symbian S60 3rd edition - Mika & SvdB
- Pthread support - Mika - Pthread support - Mika
- Content Dirs completely reorganized; 3DO and PC segregation - Coredev - Content Dirs completely reorganized; 3DO and PC segregation - Coredev
+2 -24
View File
@@ -250,30 +250,8 @@ add_text (int status, TEXT *pTextIn)
else else
{ {
// Alien speech // Alien speech
font_DrawTracedText (pText,
// Draw the background by drawing the same text in the CommData.AlienTextFColor, CommData.AlienTextBColor);
// background color one pixel shifted to all 4 directions.
SetContextForeGroundColor (CommData.AlienTextBColor);
--pText->baseline.x;
font_DrawText (pText);
++pText->baseline.x;
--pText->baseline.y;
font_DrawText (pText);
++pText->baseline.x;
++pText->baseline.y;
font_DrawText (pText);
--pText->baseline.x;
++pText->baseline.y;
font_DrawText (pText);
SetContextForeGroundColor (CommData.AlienTextFColor);
--pText->baseline.y;
font_DrawText (pText);
} }
} while (!eol && maxchars); } while (!eol && maxchars);
pText->pStr = pStr; pText->pStr = pStr;
+1 -19
View File
@@ -148,30 +148,12 @@ DoFadeScreen (PRESENTATION_INPUT_STATE* pPIS, const char *Src, BYTE FadeType)
return TRUE; return TRUE;
} }
static void
DrawTracedText (TEXT *pText, COLOR Fore, COLOR Back)
{
SetContextForeGroundColor (Back);
pText->baseline.x--;
font_DrawText (pText);
pText->baseline.x += 2;
font_DrawText (pText);
pText->baseline.x--;
pText->baseline.y--;
font_DrawText (pText);
pText->baseline.y += 2;
font_DrawText (pText);
pText->baseline.y--;
SetContextForeGroundColor (Fore);
font_DrawText (pText);
}
static void static void
DrawTextEffect (TEXT *pText, COLOR Fore, COLOR Back, int Effect) DrawTextEffect (TEXT *pText, COLOR Fore, COLOR Back, int Effect)
{ {
if (Effect == 'T') if (Effect == 'T')
{ {
DrawTracedText (pText, Fore, Back); font_DrawTracedText (pText, Fore, Back);
} }
else else
{ {
+1
View File
@@ -183,6 +183,7 @@ extern void DrawRectangle (RECT *pRect);
extern void DrawFilledRectangle (RECT *pRect); extern void DrawFilledRectangle (RECT *pRect);
extern void DrawLine (LINE *pLine); extern void DrawLine (LINE *pLine);
extern void font_DrawText (TEXT *pText); extern void font_DrawText (TEXT *pText);
extern void font_DrawTracedText (TEXT *pText, COLOR text, COLOR trace);
extern void DrawBatch (PRIMITIVE *pBasePrim, PRIM_LINKS PrimLinks, extern void DrawBatch (PRIMITIVE *pBasePrim, PRIM_LINKS PrimLinks,
BATCH_FLAGS BatchFlags); BATCH_FLAGS BatchFlags);
extern void BatchGraphics (void); extern void BatchGraphics (void);
+24
View File
@@ -62,6 +62,30 @@ font_DrawText (TEXT *lpText)
DrawBatch (&_locPrim, 0, BATCH_SINGLE); DrawBatch (&_locPrim, 0, BATCH_SINGLE);
} }
/* Draw the stroke by drawing the same text in the
* background color one pixel shifted to all 4 directions.
*/
void
font_DrawTracedText (TEXT *pText, COLOR text, COLOR trace)
{
// Preserve current foreground color for full correctness
COLOR oldfg = SetContextForeGroundColor (trace);
pText->baseline.x--;
font_DrawText (pText);
pText->baseline.x += 2;
font_DrawText (pText);
pText->baseline.x--;
pText->baseline.y--;
font_DrawText (pText);
pText->baseline.y += 2;
font_DrawText (pText);
pText->baseline.y--;
SetContextForeGroundColor (text);
font_DrawText (pText);
SetContextForeGroundColor (oldfg);
}
BOOLEAN BOOLEAN
GetContextFontLeading (SIZE *pheight) GetContextFontLeading (SIZE *pheight)
{ {