- Fixing shadows for text with stroke in iOS

- Improved text shadows in Android (they look the same as in iOS)
This commit is contained in:
Jaroslaw Lewandowski 2013-07-02 22:45:07 +01:00
parent 55202b978a
commit d26fa847d8
2 changed files with 6 additions and 2 deletions

View File

@ -128,7 +128,7 @@ public class Cocos2dxBitmap {
if ( shadow ) {
int shadowColor = 0xff7d7d7d;
int shadowColor = 0x54000000;
paint.setShadowLayer(shadowBlur, shadowDX, shadowDY, shadowColor);
bitmapPaddingX = Math.abs(shadowDX);

View File

@ -365,10 +365,14 @@ static bool _initWithString(const char * pText, cocos2d::Image::ETextAlign eAlig
textOrigingY = startH - shadowStrokePaddingY;
}
CGRect rect = CGRectMake(textOriginX, textOrigingY, textWidth, textHeight);
CGContextBeginTransparencyLayerWithRect(context, rect, NULL);
// actually draw the text in the context
// XXX: ios7 casting
[str drawInRect:CGRectMake(textOriginX, textOrigingY, textWidth, textHeight) withFont:font lineBreakMode:NSLineBreakByWordWrapping alignment:(NSTextAlignment)align];
[str drawInRect: rect withFont:font lineBreakMode:NSLineBreakByWordWrapping alignment:(NSTextAlignment)align];
CGContextEndTransparencyLayer(context);
// pop the context
UIGraphicsPopContext();