Mercurial > hg > orthanc-stone
changeset 557:77a21b28becd
new argument in ComputeAnchorTranslation: border
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 17 Apr 2019 15:33:06 +0200 |
parents | b1e1eccee214 |
children | 9e61b0ac12f1 |
files | Framework/StoneEnumerations.cpp Framework/StoneEnumerations.h |
diffstat | 2 files changed, 45 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/Framework/StoneEnumerations.cpp Wed Apr 17 14:37:18 2019 +0200 +++ b/Framework/StoneEnumerations.cpp Wed Apr 17 15:33:06 2019 +0200 @@ -78,7 +78,8 @@ double& deltaY, BitmapAnchor anchor, unsigned int bitmapWidth, - unsigned int bitmapHeight) + unsigned int bitmapHeight, + unsigned int border) { double dw = static_cast<double>(bitmapWidth); double dh = static_cast<double>(bitmapHeight); @@ -133,5 +134,46 @@ default: throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); } + + if (border != 0) + { + double b = static_cast<double>(border); + + switch (anchor) + { + case BitmapAnchor_TopLeft: + case BitmapAnchor_TopCenter: + case BitmapAnchor_TopRight: + deltaY += b; + break; + + case BitmapAnchor_BottomLeft: + case BitmapAnchor_BottomCenter: + case BitmapAnchor_BottomRight: + deltaY -= b; + break; + + default: + break; + } + + switch (anchor) + { + case BitmapAnchor_TopLeft: + case BitmapAnchor_CenterLeft: + case BitmapAnchor_BottomLeft: + deltaX += b; + break; + + case BitmapAnchor_CenterRight: + case BitmapAnchor_TopRight: + case BitmapAnchor_BottomRight: + deltaX -= b; + break; + + default: + throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); + } + } } }
--- a/Framework/StoneEnumerations.h Wed Apr 17 14:37:18 2019 +0200 +++ b/Framework/StoneEnumerations.h Wed Apr 17 15:33:06 2019 +0200 @@ -202,5 +202,6 @@ double& deltaY /* out */, BitmapAnchor anchor, unsigned int bitmapWidth, - unsigned int bitmapHeight); + unsigned int bitmapHeight, + unsigned int border = 0); }