annotate Framework/Fonts/OpenGLTextCoordinates.h @ 920:5ca418d6579e refactor-viewport-controller

Close branch refactor-viewport-controller.
author Alain Mazy <am@osimis.io>
date Fri, 19 Jul 2019 14:15:49 +0000
parents 2faf9b53d6d9
children 2d8ab34c8c91
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
577
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Stone of Orthanc
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 * Copyright (C) 2017-2019 Osimis S.A., Belgium
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * modify it under the terms of the GNU Affero General Public License
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * the License, or (at your option) any later version.
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 *
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * Affero General Public License for more details.
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 *
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * You should have received a copy of the GNU Affero General Public License
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 **/
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 #pragma once
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 #include "GlyphTextureAlphabet.h"
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 #include "TextBoundingBox.h"
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26
580
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 577
diff changeset
27 #include <vector>
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 577
diff changeset
28
577
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 namespace OrthancStone
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 {
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 namespace OpenGL
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 {
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 class OpenGLTextCoordinates : protected GlyphAlphabet::ITextVisitor
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 {
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 private:
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 TextBoundingBox box_;
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 float width_;
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 float height_;
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 std::vector<float> renderingCoords_;
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 std::vector<float> textureCoords_;
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 float textureWidth_;
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 float textureHeight_;
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 protected:
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 virtual void Visit(uint32_t unicode,
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 int x,
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 int y,
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 unsigned int width,
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 unsigned int height,
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 const Orthanc::IDynamicObject* payload);
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 public:
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 OpenGLTextCoordinates(const GlyphTextureAlphabet& alphabet,
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 const std::string& utf8);
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 unsigned int GetTextWidth() const
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 {
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 return box_.GetWidth();
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 }
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 unsigned int GetTextHeight() const
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 {
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 return box_.GetHeight();
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 }
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 bool IsEmpty() const
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 {
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 return renderingCoords_.empty();
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 }
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 const std::vector<float>& GetRenderingCoords() const;
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 const std::vector<float>& GetTextureCoords() const;
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 };
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 }
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 }