annotate Framework/Fonts/GlyphTextureAlphabet.h @ 1326:55166e57a77c broker

doc
author Benjamin Golinvaux <bgo@osimis.io>
date Tue, 24 Mar 2020 21:32:35 +0100
parents 8a0a62189f46
children 30deba7bc8e2
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
1270
2d8ab34c8c91 upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 577
diff changeset
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium
577
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 "GlyphBitmapAlphabet.h"
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 #include <Core/Images/ImageAccessor.h>
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 namespace OrthancStone
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 {
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 class GlyphTextureAlphabet : public boost::noncopyable
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 {
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 public:
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 class TextureLocation : public Orthanc::IDynamicObject
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 unsigned int x_;
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 unsigned int y_;
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 public:
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 TextureLocation(unsigned int x,
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 unsigned int y) :
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 x_(x),
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 y_(y)
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 {
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 }
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 unsigned int GetX() const
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 {
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 return x_;
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 }
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 unsigned int GetY() const
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 {
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 return y_;
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 };
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 private:
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 class GlyphSizeVisitor;
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 class TextureGenerator;
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 class RenderTextVisitor;
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 GlyphAlphabet alphabet_;
1298
8a0a62189f46 replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1270
diff changeset
64 std::unique_ptr<Orthanc::ImageAccessor> texture_;
577
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 unsigned int textureWidth_;
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 unsigned int textureHeight_;
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 public:
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 GlyphTextureAlphabet(const GlyphBitmapAlphabet& sourceAlphabet);
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 Orthanc::ImageAccessor& GetTexture() 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 Orthanc::ImageAccessor* ReleaseTexture();
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 Orthanc::ImageAccessor* RenderText(const std::string& utf8);
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 const GlyphAlphabet& GetAlphabet() const
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 {
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 return alphabet_;
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 }
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 unsigned int GetTextureWidth() const
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 {
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 return textureWidth_;
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85 }
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87 unsigned int GetTextureHeight() const
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88 {
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 return textureHeight_;
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 }
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 };
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 }