diff options
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(); |