Mercurial > hg > orthanc-stone
changeset 773:b8dfd966b5f4
FloatTextureSceneLayer::SetInverted()
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 24 May 2019 13:44:34 +0200 |
parents | ed783cbc92d7 |
children | cf1102295ae5 0387485f048b |
files | Framework/Scene2D/FloatTextureSceneLayer.cpp Framework/Scene2D/FloatTextureSceneLayer.h Framework/Scene2D/Internals/CairoFloatTextureRenderer.cpp |
diffstat | 3 files changed, 22 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/Framework/Scene2D/FloatTextureSceneLayer.cpp Fri May 24 11:04:41 2019 +0200 +++ b/Framework/Scene2D/FloatTextureSceneLayer.cpp Fri May 24 13:44:34 2019 +0200 @@ -86,6 +86,13 @@ } + void FloatTextureSceneLayer::SetInverted(bool inverted) + { + inverted_ = inverted; + IncrementRevision(); + } + + void FloatTextureSceneLayer::FitRange() { float minValue, maxValue; @@ -116,6 +123,7 @@ cloned->windowing_ = windowing_; cloned->customCenter_ = customCenter_; cloned->customWidth_ = customWidth_; + cloned->inverted_ = inverted_; return cloned.release(); }
--- a/Framework/Scene2D/FloatTextureSceneLayer.h Fri May 24 11:04:41 2019 +0200 +++ b/Framework/Scene2D/FloatTextureSceneLayer.h Fri May 24 13:44:34 2019 +0200 @@ -31,6 +31,7 @@ ImageWindowing windowing_; float customCenter_; float customWidth_; + bool inverted_; public: // The pixel format must be convertible to "Float32" @@ -49,6 +50,14 @@ return windowing_; } + // To achieve MONOCHROME1 photometric interpretation + void SetInverted(bool inverted); + + bool IsInverted() const + { + return inverted_; + } + void FitRange(); virtual ISceneLayer* Clone() const;
--- a/Framework/Scene2D/Internals/CairoFloatTextureRenderer.cpp Fri May 24 11:04:41 2019 +0200 +++ b/Framework/Scene2D/Internals/CairoFloatTextureRenderer.cpp Fri May 24 13:44:34 2019 +0200 @@ -72,6 +72,11 @@ uint8_t vv = static_cast<uint8_t>(v); + if (l.IsInverted()) + { + vv = 255 - vv; + } + q[0] = vv; q[1] = vv; q[2] = vv;