Mercurial > hg > orthanc-stone
changeset 1230:355dba5352d7
TestRenderer: Add a blank line on top of the text to improve bilinera filtering of the topmost line
author | Alain Mazy <alain@mazy.be> |
---|---|
date | Mon, 09 Dec 2019 16:37:39 +0100 |
parents | e2435a524029 |
children | 8154350aa195 |
files | Framework/Radiography/RadiographyAlphaLayer.cpp Framework/Toolbox/TextRenderer.cpp |
diffstat | 2 files changed, 17 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/Framework/Radiography/RadiographyAlphaLayer.cpp Sat Dec 07 17:47:35 2019 +0100 +++ b/Framework/Radiography/RadiographyAlphaLayer.cpp Mon Dec 09 16:37:39 2019 +0100 @@ -91,6 +91,7 @@ return; // layer is outside the buffer } + printf("rendering alpha: %d \n", y1); t.Apply(tmp, cropped, interpolation, true /* clear */); float value = foreground_;
--- a/Framework/Toolbox/TextRenderer.cpp Sat Dec 07 17:47:35 2019 +0100 +++ b/Framework/Toolbox/TextRenderer.cpp Mon Dec 09 16:37:39 2019 +0100 @@ -57,7 +57,22 @@ posInString += utf8CharLength; } - return alphabet->RenderText(utf8String); + + std::auto_ptr<Orthanc::ImageAccessor> renderedText(alphabet->RenderText(utf8String)); + + // add a blank line on top of the text (to improve bilinear filtering of the topmost line) + std::auto_ptr<Orthanc::Image> renderedTextExtended(new Orthanc::Image(renderedText->GetFormat(), renderedText->GetWidth(), renderedText->GetHeight() + 1, true)); + + Orthanc::ImageAccessor textRegion; + Orthanc::ImageAccessor firstLineRegion; + + renderedTextExtended->GetRegion(firstLineRegion, 0, 0, renderedText->GetWidth(), 1); + Orthanc::ImageProcessing::Set(firstLineRegion, 0); + + renderedTextExtended->GetRegion(textRegion, 0, 1, renderedText->GetWidth(), renderedText->GetHeight()); + Orthanc::ImageProcessing::Copy(textRegion, *renderedText); + + return renderedTextExtended.release(); }