Add shadow, outline, glow filter support for UITextField

This commit is contained in:
Frank.Xu 2014-06-05 19:20:16 +08:00
parent f4d8e396e2
commit 7ece807a63
2 changed files with 34 additions and 0 deletions

View File

@ -336,6 +336,24 @@ void Text::updateTextureRGBA()
{
updateRGBAToRenderer(_labelRenderer);
}
void Text::enableShadow(const Color4B& shadowColor,const Size &offset, int blurRadius) {
_labelRenderer->enableShadow(shadowColor, offset, blurRadius);
}
void Text::enableOutline(const Color4B& outlineColor,int outlineSize) {
if (_type == Type::TTF)
_labelRenderer->enableOutline(outlineColor, outlineSize);
}
void Text::enableGlow(const Color4B& glowColor) {
if (_type == Type::TTF)
_labelRenderer->enableGlow(glowColor);
}
void Text::disableEffect() {
_labelRenderer->disableEffect();
}
Widget* Text::createCloneInstance()
{

View File

@ -158,6 +158,22 @@ public:
TextVAlignment getTextVerticalAlignment();
/**
* Enable shadow for the label
*
* @todo support blur for shadow effect
*/
void enableShadow(const Color4B& shadowColor = Color4B::BLACK,const Size &offset = Size(2,-2), int blurRadius = 0);
/** only support for TTF */
void enableOutline(const Color4B& outlineColor,int outlineSize = -1);
/** only support for TTF */
void enableGlow(const Color4B& glowColor);
/** disable shadow/outline/glow rendering */
void disableEffect();
CC_CONSTRUCTOR_ACCESS:
virtual bool init() override;
virtual bool init(const std::string& textContent,