# HG changeset patch # User Sebastien Jodogne # Date 1555507986 -7200 # Node ID 77a21b28becd57c9b4a7cfd9a8dc0e7b7a07e446 # Parent b1e1eccee214a63f0cd486ff2cf517abdb30a5bc new argument in ComputeAnchorTranslation: border diff -r b1e1eccee214 -r 77a21b28becd Framework/StoneEnumerations.cpp --- 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(bitmapWidth); double dh = static_cast(bitmapHeight); @@ -133,5 +134,46 @@ default: throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); } + + if (border != 0) + { + double b = static_cast(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); + } + } } } diff -r b1e1eccee214 -r 77a21b28becd Framework/StoneEnumerations.h --- 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); }