Mercurial > hg > orthanc-stone
comparison Framework/Radiography/RadiographyTextLayer.cpp @ 1190:f417a0ae282b
wip: TextLayer with new fonts
author | Alain Mazy <alain@mazy.be> |
---|---|
date | Tue, 26 Nov 2019 15:27:48 +0100 |
parents | b85f635f1eb5 |
children | a5f2a6b04a31 |
comparison
equal
deleted
inserted
replaced
1184:848dcba80d81 | 1190:f417a0ae282b |
---|---|
16 * | 16 * |
17 * You should have received a copy of the GNU Affero General Public License | 17 * You should have received a copy of the GNU Affero General Public License |
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 **/ | 19 **/ |
20 | 20 |
21 | |
22 #include "RadiographyTextLayer.h" | 21 #include "RadiographyTextLayer.h" |
23 | 22 |
23 #include "Core/OrthancException.h" | |
24 #include "RadiographyScene.h" | 24 #include "RadiographyScene.h" |
25 #include "Framework/Toolbox/TextRenderer.h" | |
25 | 26 |
26 namespace OrthancStone | 27 namespace OrthancStone |
27 { | 28 { |
28 void RadiographyTextLayer::LoadText(const Orthanc::Font& font, | 29 bool RadiographyTextLayer::fontHasBeenConfigured_ = false; |
29 const std::string& utf8) | 30 Orthanc::EmbeddedResources::FileResourceId RadiographyTextLayer::fontResourceId_; |
31 | |
32 void RadiographyTextLayer::LoadText(const std::string& utf8, | |
33 size_t fontSize, | |
34 uint8_t foreground) | |
30 { | 35 { |
36 if (!fontHasBeenConfigured_) | |
37 { | |
38 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls, "No font has been loaded"); | |
39 } | |
40 | |
31 text_ = utf8; | 41 text_ = utf8; |
32 fontName_ = font.GetName(); | 42 fontSize_ = fontSize; |
43 foreground_ = foreground; | |
33 | 44 |
34 SetAlpha(font.RenderAlpha(utf8)); | 45 SetAlpha(TextRenderer::Render(fontResourceId_, |
46 fontSize_, | |
47 text_)); | |
35 } | 48 } |
36 } | 49 } |