Mercurial > hg > orthanc-stone
annotate OrthancStone/Sources/Scene2D/Internals/OpenGLTextProgram.h @ 2050:b2738d7a388d
Prevent dragging series before they are ready
author | Alain Mazy <am@osimis.io> |
---|---|
date | Thu, 30 Mar 2023 12:56:04 +0200 |
parents | 7053b8a0aaec |
children | 07964689cb0b |
rev | line source |
---|---|
592 | 1 /** |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
1871
7053b8a0aaec
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1870
diff
changeset
|
5 * Copyright (C) 2017-2022 Osimis S.A., Belgium |
7053b8a0aaec
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1870
diff
changeset
|
6 * Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
592 | 7 * |
8 * This program is free software: you can redistribute it and/or | |
1598
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
9 * modify it under the terms of the GNU Lesser General Public License |
592 | 10 * as published by the Free Software Foundation, either version 3 of |
11 * the License, or (at your option) any later version. | |
12 * | |
13 * This program is distributed in the hope that it will be useful, but | |
14 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
1598
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
16 * Lesser General Public License for more details. |
1596
4fb8fdf03314
removed annoying whitespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1576
diff
changeset
|
17 * |
1598
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
18 * You should have received a copy of the GNU Lesser General Public |
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
19 * License along with this program. If not, see |
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
20 * <http://www.gnu.org/licenses/>. |
592 | 21 **/ |
22 | |
23 | |
24 #pragma once | |
25 | |
26 #include "../../Fonts/GlyphTextureAlphabet.h" | |
27 #include "../../OpenGL/IOpenGLContext.h" | |
28 #include "../../OpenGL/OpenGLProgram.h" | |
29 #include "../../OpenGL/OpenGLTexture.h" | |
30 #include "../../Toolbox/AffineTransform2D.h" | |
31 #include "../TextSceneLayer.h" | |
32 | |
1455
30deba7bc8e2
simplifying include_directories
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1301
diff
changeset
|
33 #include <Compatibility.h> |
1301 | 34 |
592 | 35 namespace OrthancStone |
36 { | |
37 namespace Internals | |
38 { | |
39 class OpenGLTextProgram : public boost::noncopyable | |
40 { | |
41 public: | |
42 class Data : public boost::noncopyable | |
43 { | |
44 private: | |
45 OpenGL::IOpenGLContext& context_; | |
46 size_t coordinatesCount_; | |
47 GLuint buffers_[2]; | |
48 float red_; | |
49 float green_; | |
50 float blue_; | |
51 double x_; | |
52 double y_; | |
53 double border_; | |
54 unsigned int textWidth_; | |
55 unsigned int textHeight_; | |
56 BitmapAnchor anchor_; | |
57 | |
58 public: | |
59 Data(OpenGL::IOpenGLContext& context, | |
60 const GlyphTextureAlphabet& alphabet, | |
61 const TextSceneLayer& layer); | |
62 | |
63 ~Data(); | |
64 | |
65 bool IsEmpty() const | |
66 { | |
67 return coordinatesCount_ == 0; | |
68 } | |
69 | |
70 size_t GetCoordinatesCount() const | |
71 { | |
72 return coordinatesCount_; | |
73 } | |
74 | |
75 GLuint GetSceneLocationsBuffer() const; | |
76 | |
77 GLuint GetTextureLocationsBuffer() const; | |
78 | |
79 float GetRed() const | |
80 { | |
81 return red_; | |
82 } | |
83 | |
84 float GetGreen() const | |
85 { | |
86 return green_; | |
87 } | |
88 | |
89 float GetBlue() const | |
90 { | |
91 return blue_; | |
92 } | |
93 | |
94 double GetX() const | |
95 { | |
96 return x_; | |
97 } | |
98 | |
99 double GetY() const | |
100 { | |
101 return y_; | |
102 } | |
103 | |
104 double GetBorder() const | |
105 { | |
106 return border_; | |
107 } | |
108 | |
109 unsigned int GetTextWidth() const | |
110 { | |
111 return textWidth_; | |
112 } | |
113 | |
114 unsigned int GetTextHeight() const | |
115 { | |
116 return textHeight_; | |
117 } | |
118 | |
119 BitmapAnchor GetAnchor() const | |
120 { | |
121 return anchor_; | |
122 } | |
123 }; | |
124 | |
125 private: | |
1571 | 126 OpenGL::IOpenGLContext& context_; |
1298
8a0a62189f46
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1270
diff
changeset
|
127 std::unique_ptr<OpenGL::OpenGLProgram> program_; |
1571 | 128 GLint positionLocation_; |
129 GLint textureLocation_; | |
592 | 130 |
131 public: | |
1571 | 132 explicit OpenGLTextProgram(OpenGL::IOpenGLContext& context); |
592 | 133 |
134 void Apply(OpenGL::OpenGLTexture& fontTexture, | |
135 const Data& data, | |
1576
92fca2b3ba3d
sanitizing the handling of canvas size
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1571
diff
changeset
|
136 const AffineTransform2D& transform, |
92fca2b3ba3d
sanitizing the handling of canvas size
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1571
diff
changeset
|
137 unsigned int canvasWidth, |
92fca2b3ba3d
sanitizing the handling of canvas size
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1571
diff
changeset
|
138 unsigned int canvasHeight); |
592 | 139 }; |
140 } | |
141 } |