diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-06-21 20:29:23 +1000 |
---|---|---|
committer | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-06-21 20:29:23 +1000 |
commit | ee296e3381d0dc83a9315a101280dc63fdf4128a (patch) | |
tree | e4f02cf0cadbb34f485219c469cb8c4f69ae0874 /source/rendering/StarFontTextureGroup.cpp | |
parent | 8dce3349312927653b2ca7a33dcee0d2e6b69137 (diff) |
font directives bwahahaha
Diffstat (limited to 'source/rendering/StarFontTextureGroup.cpp')
-rw-r--r-- | source/rendering/StarFontTextureGroup.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/source/rendering/StarFontTextureGroup.cpp b/source/rendering/StarFontTextureGroup.cpp index 21f6d6a..b576ef8 100644 --- a/source/rendering/StarFontTextureGroup.cpp +++ b/source/rendering/StarFontTextureGroup.cpp @@ -34,14 +34,21 @@ const FontTextureGroup::GlyphTexture& FontTextureGroup::glyphTexture(String::Cha m_font->setPixelSize(size); Image image = m_font->render(c); if (!processingDirectives.empty()) { - Vec2F preSize = Vec2F(image.size()); - auto imageOperations = parseImageOperations(processingDirectives); - for (auto& imageOp : imageOperations) { - if (auto border = imageOp.ptr<BorderImageOperation>()) - border->includeTransparent = true; + try { + Vec2F preSize = Vec2F(image.size()); + auto imageOperations = parseImageOperations(processingDirectives); + for (auto& imageOp : imageOperations) { + if (auto border = imageOp.ptr<BorderImageOperation>()) + border->includeTransparent = true; + } + image = processImageOperations(imageOperations, image); + res.first->second.processingOffset = preSize - Vec2F(image.size()); + } + catch (StarException&) { + image.forEachPixel([](unsigned x, unsigned y, Vec4B& pixel) { + pixel = ((x + y) % 2 == 0) ? Vec4B(255, 0, 255, pixel[3]) : Vec4B(0, 0, 0, pixel[3]); + }); } - image = processImageOperations(imageOperations, image); - res.first->second.processingOffset = preSize - Vec2F(image.size()); } else res.first->second.processingOffset = Vec2F(); |