diff options
Diffstat (limited to 'include/basegfx/range/basicrange.hxx')
-rw-r--r-- | include/basegfx/range/basicrange.hxx | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/include/basegfx/range/basicrange.hxx b/include/basegfx/range/basicrange.hxx index bea40dd3ded2..17f31ea42f19 100644 --- a/include/basegfx/range/basicrange.hxx +++ b/include/basegfx/range/basicrange.hxx @@ -248,6 +248,28 @@ namespace basegfx } } + T clamp(T nValue) const + { + if(isEmpty()) + { + return nValue; + } + else + { + if(nValue < mnMinimum) + { + return mnMinimum; + } + + if(nValue > mnMaximum) + { + return mnMaximum; + } + + return nValue; + } + } + typename Traits::DifferenceType getRange() const { if(isEmpty()) |