comparison Framework/StoneEnumerations.cpp @ 557:77a21b28becd

new argument in ComputeAnchorTranslation: border
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 17 Apr 2019 15:33:06 +0200
parents b70e9be013e4
children 9e61b0ac12f1
comparison
equal deleted inserted replaced
556:b1e1eccee214 557:77a21b28becd
76 76
77 void ComputeAnchorTranslation(double& deltaX, 77 void ComputeAnchorTranslation(double& deltaX,
78 double& deltaY, 78 double& deltaY,
79 BitmapAnchor anchor, 79 BitmapAnchor anchor,
80 unsigned int bitmapWidth, 80 unsigned int bitmapWidth,
81 unsigned int bitmapHeight) 81 unsigned int bitmapHeight,
82 unsigned int border)
82 { 83 {
83 double dw = static_cast<double>(bitmapWidth); 84 double dw = static_cast<double>(bitmapWidth);
84 double dh = static_cast<double>(bitmapHeight); 85 double dh = static_cast<double>(bitmapHeight);
85 86
86 switch (anchor) 87 switch (anchor)
131 break; 132 break;
132 133
133 default: 134 default:
134 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); 135 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
135 } 136 }
137
138 if (border != 0)
139 {
140 double b = static_cast<double>(border);
141
142 switch (anchor)
143 {
144 case BitmapAnchor_TopLeft:
145 case BitmapAnchor_TopCenter:
146 case BitmapAnchor_TopRight:
147 deltaY += b;
148 break;
149
150 case BitmapAnchor_BottomLeft:
151 case BitmapAnchor_BottomCenter:
152 case BitmapAnchor_BottomRight:
153 deltaY -= b;
154 break;
155
156 default:
157 break;
158 }
159
160 switch (anchor)
161 {
162 case BitmapAnchor_TopLeft:
163 case BitmapAnchor_CenterLeft:
164 case BitmapAnchor_BottomLeft:
165 deltaX += b;
166 break;
167
168 case BitmapAnchor_CenterRight:
169 case BitmapAnchor_TopRight:
170 case BitmapAnchor_BottomRight:
171 deltaX -= b;
172 break;
173
174 default:
175 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
176 }
177 }
136 } 178 }
137 } 179 }