After several google search, I found the solution to fix it (The second label shown above).
It's simple, just call the blend of the Label to BlendFunc::ALPHA_PREMULTIPLIED.
Code: label->setBlendFunc(BlendFunc::ALPHA_PREMULTIPLIED
Source example:
std::string sysFont = "GillSans";
std::string test1 = "No BlendFunc";
std::string test2 = "ALPHA_PREMULTIPLIED";
Label *label;
Color3B textColor = Color3B(200, 245, 245);
// First Label (Undesired outline)
label = Label::createWithSystemFont(test1, sysFont, 40);
label->setColor(textColor);
label->setPosition(Point(250, 300));
addChild(label);
// Second Label (Fixed outline)
label = Label::createWithSystemFont(test2, sysFont, 40);
label->setColor(textColor);
label->setPosition(Point(250, 200));
label->setBlendFunc(BlendFunc::ALPHA_PREMULTIPLIED);
addChild(label);
No comments:
Post a Comment