| 1412 | } |
| 1413 | |
| 1414 | void Label::enableGlow(const Color4B& glowColor, float glowRadius) |
| 1415 | { |
| 1416 | if (glowRadius <= 0) |
| 1417 | glowRadius = FontFreeType::DistanceMapSpread / 2.0f; |
| 1418 | |
| 1419 | if (_currentLabelType == LabelType::TTF && (glowRadius > 0 || _currLabelEffect == LabelEffect::GLOW)) |
| 1420 | { |
| 1421 | _glowRadius = glowRadius; |
| 1422 | |
| 1423 | auto config = _fontConfig; |
| 1424 | int mods = 0; |
| 1425 | // Note: axmol only support Glow effect in SDF rendering mode |
| 1426 | if (!_fontConfig.distanceFieldEnabled) |
| 1427 | { |
| 1428 | config.distanceFieldEnabled = true; |
| 1429 | ++mods; |
| 1430 | } |
| 1431 | if (mods) |
| 1432 | { |
| 1433 | setTTFConfig(config); |
| 1434 | _contentDirty = true; |
| 1435 | updateShaderProgram(); |
| 1436 | } |
| 1437 | _currLabelEffect = LabelEffect::GLOW; |
| 1438 | _effectColorF.r = glowColor.r / 255.0f; |
| 1439 | _effectColorF.g = glowColor.g / 255.0f; |
| 1440 | _effectColorF.b = glowColor.b / 255.0f; |
| 1441 | _effectColorF.a = glowColor.a / 255.0f; |
| 1442 | updateShaderProgram(); |
| 1443 | } |
| 1444 | } |
| 1445 | |
| 1446 | void Label::enableOutline(const Color4B& outlineColor, float outlineSize /* = -1 */) |
| 1447 | { |
no outgoing calls