From: <av...@us...> - 2008-10-05 20:07:39
|
Revision: 3081 http://sc2.svn.sourceforge.net/sc2/?rev=3081&view=rev Author: avolkov Date: 2008-10-05 20:07:37 +0000 (Sun, 05 Oct 2008) Log Message: ----------- DrawTracedText abstraction; bug #1029; from Nic, modified Modified Paths: -------------- trunk/sc2/ChangeLog trunk/sc2/src/sc2code/comm.c trunk/sc2/src/sc2code/intro.c trunk/sc2/src/sc2code/libs/gfxlib.h trunk/sc2/src/sc2code/libs/graphics/font.c Modified: trunk/sc2/ChangeLog =================================================================== --- trunk/sc2/ChangeLog 2008-10-05 19:27:26 UTC (rev 3080) +++ trunk/sc2/ChangeLog 2008-10-05 20:07:37 UTC (rev 3081) @@ -1,4 +1,5 @@ Changes towards version 0.7: +- DrawTracedText abstraction (bug #1029), from Nic - Experimental support for Symbian S60 3rd edition - Mika & SvdB - Pthread support - Mika - Content Dirs completely reorganized; 3DO and PC segregation - Coredev Modified: trunk/sc2/src/sc2code/comm.c =================================================================== --- trunk/sc2/src/sc2code/comm.c 2008-10-05 19:27:26 UTC (rev 3080) +++ trunk/sc2/src/sc2code/comm.c 2008-10-05 20:07:37 UTC (rev 3081) @@ -250,30 +250,8 @@ else { // Alien speech - - // Draw the background by drawing the same text in the - // 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); + font_DrawTracedText (pText, + CommData.AlienTextFColor, CommData.AlienTextBColor); } } while (!eol && maxchars); pText->pStr = pStr; Modified: trunk/sc2/src/sc2code/intro.c =================================================================== --- trunk/sc2/src/sc2code/intro.c 2008-10-05 19:27:26 UTC (rev 3080) +++ trunk/sc2/src/sc2code/intro.c 2008-10-05 20:07:37 UTC (rev 3081) @@ -149,29 +149,11 @@ } 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 DrawTextEffect (TEXT *pText, COLOR Fore, COLOR Back, int Effect) { if (Effect == 'T') { - DrawTracedText (pText, Fore, Back); + font_DrawTracedText (pText, Fore, Back); } else { Modified: trunk/sc2/src/sc2code/libs/gfxlib.h =================================================================== --- trunk/sc2/src/sc2code/libs/gfxlib.h 2008-10-05 19:27:26 UTC (rev 3080) +++ trunk/sc2/src/sc2code/libs/gfxlib.h 2008-10-05 20:07:37 UTC (rev 3081) @@ -183,6 +183,7 @@ extern void DrawFilledRectangle (RECT *pRect); extern void DrawLine (LINE *pLine); extern void font_DrawText (TEXT *pText); +extern void font_DrawTracedText (TEXT *pText, COLOR text, COLOR trace); extern void DrawBatch (PRIMITIVE *pBasePrim, PRIM_LINKS PrimLinks, BATCH_FLAGS BatchFlags); extern void BatchGraphics (void); Modified: trunk/sc2/src/sc2code/libs/graphics/font.c =================================================================== --- trunk/sc2/src/sc2code/libs/graphics/font.c 2008-10-05 19:27:26 UTC (rev 3080) +++ trunk/sc2/src/sc2code/libs/graphics/font.c 2008-10-05 20:07:37 UTC (rev 3081) @@ -62,6 +62,30 @@ 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 GetContextFontLeading (SIZE *pheight) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |