Mercurial > hg > orthanc-stone
comparison Framework/Fonts/OpenGLTextCoordinates.h @ 577:b098a3aaf694
alphabet of glyphs
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 19 Apr 2019 15:42:57 +0200 |
parents | |
children | 2faf9b53d6d9 |
comparison
equal
deleted
inserted
replaced
576:529c9617654b | 577:b098a3aaf694 |
---|---|
1 /** | |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
5 * Copyright (C) 2017-2019 Osimis S.A., Belgium | |
6 * | |
7 * This program is free software: you can redistribute it and/or | |
8 * modify it under the terms of the GNU Affero General Public License | |
9 * as published by the Free Software Foundation, either version 3 of | |
10 * the License, or (at your option) any later version. | |
11 * | |
12 * This program is distributed in the hope that it will be useful, but | |
13 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 * Affero General Public License for more details. | |
16 * | |
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/>. | |
19 **/ | |
20 | |
21 | |
22 #pragma once | |
23 | |
24 #include "GlyphTextureAlphabet.h" | |
25 #include "TextBoundingBox.h" | |
26 | |
27 namespace OrthancStone | |
28 { | |
29 namespace OpenGL | |
30 { | |
31 class OpenGLTextCoordinates : protected GlyphAlphabet::ITextVisitor | |
32 { | |
33 private: | |
34 TextBoundingBox box_; | |
35 float width_; | |
36 float height_; | |
37 std::vector<float> renderingCoords_; | |
38 std::vector<float> textureCoords_; | |
39 float textureWidth_; | |
40 float textureHeight_; | |
41 | |
42 protected: | |
43 virtual void Visit(uint32_t unicode, | |
44 int x, | |
45 int y, | |
46 unsigned int width, | |
47 unsigned int height, | |
48 const Orthanc::IDynamicObject* payload); | |
49 | |
50 public: | |
51 OpenGLTextCoordinates(const GlyphTextureAlphabet& alphabet, | |
52 const std::string& utf8); | |
53 | |
54 unsigned int GetTextWidth() const | |
55 { | |
56 return box_.GetWidth(); | |
57 } | |
58 | |
59 unsigned int GetTextHeight() const | |
60 { | |
61 return box_.GetHeight(); | |
62 } | |
63 | |
64 bool IsEmpty() const | |
65 { | |
66 return renderingCoords_.empty(); | |
67 } | |
68 | |
69 const std::vector<float>& GetRenderingCoords() const; | |
70 | |
71 const std::vector<float>& GetTextureCoords() const; | |
72 }; | |
73 } | |
74 } |