88 var strSurface, |
88 var strSurface, |
89 resSurface: PSDL_Surface; |
89 resSurface: PSDL_Surface; |
90 dstrect : TSDL_Rect; // destination rectangle for blitting |
90 dstrect : TSDL_Rect; // destination rectangle for blitting |
91 font : THWFont; |
91 font : THWFont; |
92 const |
92 const |
93 //shadowcolor: TSDL_Color = (r:$00; g:$00; b:$00; a:$FF); |
93 shadowcolor: TSDL_Color = (r:$00; g:$00; b:$00; a:$FF); |
94 //shadowcolor: TSDL_Color = (r:$00; g:$00; b:$00; a:$80); |
94 //shadowcolor: TSDL_Color = (r:$00; g:$00; b:$00; a:$80); |
95 shadowint = $80 shl AShift; |
95 shadowint = $80 shl AShift; |
96 begin |
96 begin |
97 |
97 |
98 font:= CheckCJKFont(ansistring(str), fnt16); |
98 font:= CheckCJKFont(ansistring(str), fnt16); |
114 dstrect.w:= cl.Width; |
114 dstrect.w:= cl.Width; |
115 dstrect.h:= ClHeight; |
115 dstrect.h:= ClHeight; |
116 |
116 |
117 // draw background |
117 // draw background |
118 SDL_FillRect(resSurface, @dstrect, shadowint); |
118 SDL_FillRect(resSurface, @dstrect, shadowint); |
119 (* |
|
120 So, using Text/Blended + Shadow/Solid or shadow with shadowcolor alpha of FF seemed to make shadow disappear here. |
|
121 At least, I didn't see any difference, and no changing of the padding offset let me view it. Just disabling it. |
|
122 // prepare destination rectangle for text shadow |
|
123 // start position in texture should have padding; add 1 px as shadow offset |
|
124 dstrect.x:= Padding + 1; |
119 dstrect.x:= Padding + 1; |
125 dstrect.y:= Padding + 1; |
120 dstrect.y:= Padding + 1; |
126 // doesn't matter if .w and .h still include padding, SDL_UpperBlit will clip |
121 // doesn't matter if .w and .h still include padding, SDL_UpperBlit will clip |
127 |
122 |
128 |
123 |
129 // create and blit text shadow |
124 // create and blit text shadow |
130 strSurface:= TTF_RenderUTF8_Blended(Fontz[font].Handle, Str2PChar(str), shadowcolor); |
125 strSurface:= TTF_RenderUTF8_Solid(Fontz[font].Handle, Str2PChar(str), shadowcolor); |
131 SDL_UpperBlit(strSurface, nil, resSurface, @dstrect); |
126 SDL_UpperBlit(strSurface, nil, resSurface, @dstrect); |
132 SDL_FreeSurface(strSurface); |
127 SDL_FreeSurface(strSurface); |
133 *) |
|
134 |
128 |
135 // non-shadow text starts at padding |
129 // non-shadow text starts at padding |
136 dstrect.x:= Padding; |
130 dstrect.x:= Padding; |
137 dstrect.y:= Padding; |
131 dstrect.y:= Padding; |
138 |
132 |