FontEffect.cpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #include "../../Include/RmlUi/Core/FontEffect.h"
  2. #include "../../Include/RmlUi/Core/FontEffectInstancer.h"
  3. namespace Rml {
  4. FontEffect::FontEffect() : layer(Layer::Back), colour(255, 255, 255), fingerprint(0) {}
  5. FontEffect::~FontEffect() {}
  6. bool FontEffect::HasUniqueTexture() const
  7. {
  8. return false;
  9. }
  10. bool FontEffect::GetGlyphMetrics(Vector2i& /*origin*/, Vector2i& /*dimensions*/, const FontGlyph& /*glyph*/) const
  11. {
  12. return false;
  13. }
  14. void FontEffect::GenerateGlyphTexture(byte* /*destination_data*/, Vector2i /*destination_dimensions*/, int /*destination_stride*/,
  15. const FontGlyph& /*glyph*/) const
  16. {}
  17. void FontEffect::SetColour(const Colourb _colour)
  18. {
  19. colour = _colour;
  20. }
  21. Colourb FontEffect::GetColour() const
  22. {
  23. return colour;
  24. }
  25. FontEffect::Layer FontEffect::GetLayer() const
  26. {
  27. return layer;
  28. }
  29. void FontEffect::SetLayer(Layer _layer)
  30. {
  31. layer = _layer;
  32. }
  33. size_t FontEffect::GetFingerprint() const
  34. {
  35. return fingerprint;
  36. }
  37. void FontEffect::SetFingerprint(size_t _fingerprint)
  38. {
  39. fingerprint = _fingerprint;
  40. }
  41. void FontEffect::FillColorValuesFromAlpha(byte* destination, Vector2i dimensions, int stride)
  42. {
  43. for (int y = 0; y < dimensions.y; ++y)
  44. {
  45. for (int x = 0; x < dimensions.x; ++x)
  46. {
  47. const int i = y * stride + x * 4;
  48. const byte alpha = destination[i + 3];
  49. destination[i + 0] = destination[i + 1] = destination[i + 2] = alpha;
  50. }
  51. }
  52. }
  53. } // namespace Rml