comparison Framework/Fonts/GlyphTextureAlphabet.h @ 577:b098a3aaf694

alphabet of glyphs
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 19 Apr 2019 15:42:57 +0200
parents
children 2d8ab34c8c91
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 "GlyphBitmapAlphabet.h"
25
26 #include <Core/Images/ImageAccessor.h>
27
28 namespace OrthancStone
29 {
30 class GlyphTextureAlphabet : public boost::noncopyable
31 {
32 public:
33 class TextureLocation : public Orthanc::IDynamicObject
34 {
35 private:
36 unsigned int x_;
37 unsigned int y_;
38
39 public:
40 TextureLocation(unsigned int x,
41 unsigned int y) :
42 x_(x),
43 y_(y)
44 {
45 }
46
47 unsigned int GetX() const
48 {
49 return x_;
50 }
51
52 unsigned int GetY() const
53 {
54 return y_;
55 }
56 };
57
58 private:
59 class GlyphSizeVisitor;
60 class TextureGenerator;
61 class RenderTextVisitor;
62
63 GlyphAlphabet alphabet_;
64 std::auto_ptr<Orthanc::ImageAccessor> texture_;
65 unsigned int textureWidth_;
66 unsigned int textureHeight_;
67
68 public:
69 GlyphTextureAlphabet(const GlyphBitmapAlphabet& sourceAlphabet);
70
71 const Orthanc::ImageAccessor& GetTexture() const;
72
73 Orthanc::ImageAccessor* ReleaseTexture();
74
75 Orthanc::ImageAccessor* RenderText(const std::string& utf8);
76
77 const GlyphAlphabet& GetAlphabet() const
78 {
79 return alphabet_;
80 }
81
82 unsigned int GetTextureWidth() const
83 {
84 return textureWidth_;
85 }
86
87 unsigned int GetTextureHeight() const
88 {
89 return textureHeight_;
90 }
91 };
92 }