mirror of https://github.com/axmolengine/axmol.git
- 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:
parent
55202b978a
commit
d26fa847d8
|
@ -128,7 +128,7 @@ public class Cocos2dxBitmap {
|
||||||
|
|
||||||
if ( shadow ) {
|
if ( shadow ) {
|
||||||
|
|
||||||
int shadowColor = 0xff7d7d7d;
|
int shadowColor = 0x54000000;
|
||||||
paint.setShadowLayer(shadowBlur, shadowDX, shadowDY, shadowColor);
|
paint.setShadowLayer(shadowBlur, shadowDX, shadowDY, shadowColor);
|
||||||
|
|
||||||
bitmapPaddingX = Math.abs(shadowDX);
|
bitmapPaddingX = Math.abs(shadowDX);
|
||||||
|
|
|
@ -365,10 +365,14 @@ static bool _initWithString(const char * pText, cocos2d::Image::ETextAlign eAlig
|
||||||
textOrigingY = startH - shadowStrokePaddingY;
|
textOrigingY = startH - shadowStrokePaddingY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CGRect rect = CGRectMake(textOriginX, textOrigingY, textWidth, textHeight);
|
||||||
|
|
||||||
|
CGContextBeginTransparencyLayerWithRect(context, rect, NULL);
|
||||||
// actually draw the text in the context
|
// actually draw the text in the context
|
||||||
// XXX: ios7 casting
|
// 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
|
// pop the context
|
||||||
UIGraphicsPopContext();
|
UIGraphicsPopContext();
|
||||||
|
|
Loading…
Reference in New Issue