Mercurial > hg > orthanc-stone
comparison Framework/StoneEnumerations.cpp @ 366:a7de01c8fd29 am-2
new enum BitmapAnchor
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 01 Nov 2018 11:55:45 +0100 |
parents | 5412adf19980 |
children | b70e9be013e4 |
comparison
equal
deleted
inserted
replaced
365:ef31240a73f6 | 366:a7de01c8fd29 |
---|---|
70 | 70 |
71 default: | 71 default: |
72 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); | 72 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); |
73 } | 73 } |
74 } | 74 } |
75 | |
76 | |
77 void ComputeAnchorTranslation(double& deltaX, | |
78 double& deltaY, | |
79 BitmapAnchor anchor, | |
80 unsigned int bitmapWidth, | |
81 unsigned int bitmapHeight) | |
82 { | |
83 double dw = static_cast<double>(bitmapWidth); | |
84 double dh = static_cast<double>(bitmapHeight); | |
85 | |
86 switch (anchor) | |
87 { | |
88 case BitmapAnchor_TopLeft: | |
89 deltaX = 0; | |
90 deltaY = 0; | |
91 break; | |
92 | |
93 case BitmapAnchor_TopCenter: | |
94 deltaX = -dw / 2.0; | |
95 deltaY = 0; | |
96 break; | |
97 | |
98 case BitmapAnchor_TopRight: | |
99 deltaX = -dw; | |
100 deltaY = 0; | |
101 break; | |
102 | |
103 case BitmapAnchor_CenterLeft: | |
104 deltaX = 0; | |
105 deltaY = -dh / 2.0; | |
106 break; | |
107 | |
108 case BitmapAnchor_Center: | |
109 deltaX = -dw / 2.0; | |
110 deltaY = -dh / 2.0; | |
111 break; | |
112 | |
113 case BitmapAnchor_CenterRight: | |
114 deltaX = -dw; | |
115 deltaY = -dh / 2.0; | |
116 break; | |
117 | |
118 case BitmapAnchor_BottomLeft: | |
119 deltaX = 0; | |
120 deltaY = -dh; | |
121 break; | |
122 | |
123 case BitmapAnchor_BottomCenter: | |
124 deltaX = -dw / 2.0; | |
125 deltaY = -dh; | |
126 break; | |
127 | |
128 case BitmapAnchor_BottomRight: | |
129 deltaX = -dw; | |
130 deltaY = -dh; | |
131 break; | |
132 | |
133 default: | |
134 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); | |
135 } | |
136 } | |
75 } | 137 } |