Mercurial > hg > orthanc-stone
comparison Framework/Scene2D/CairoCompositor.h @ 911:64e5f3ff6360 am-dev
Merge
author | Alain Mazy <alain@mazy.be> |
---|---|
date | Thu, 18 Jul 2019 10:50:59 +0200 |
parents | 6e79e8c9021c 7a7e4e1f558f |
children | 685c9a2d115f |
comparison
equal
deleted
inserted
replaced
903:ef6e425dc79f | 911:64e5f3ff6360 |
---|---|
11 * | 11 * |
12 * This program is distributed in the hope that it will be useful, but | 12 * This program is distributed in the hope that it will be useful, but |
13 * WITHOUT ANY WARRANTY; without even the implied warranty of | 13 * WITHOUT ANY WARRANTY; without even the implied warranty of |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 * Affero General Public License for more details. | 15 * Affero General Public License for more details. |
16 * | 16 * |
17 * You should have received a copy of the GNU Affero General Public License | 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/>. | 18 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 **/ | 19 **/ |
20 | 20 |
21 | 21 |
22 #pragma once | 22 #pragma once |
23 | 23 |
24 #include "ICompositor.h" | |
24 #include "../Fonts/GlyphBitmapAlphabet.h" | 25 #include "../Fonts/GlyphBitmapAlphabet.h" |
25 #include "../Wrappers/CairoContext.h" | 26 #include "../Wrappers/CairoContext.h" |
26 #include "Internals/CompositorHelper.h" | 27 #include "Internals/CompositorHelper.h" |
27 #include "Internals/ICairoContextProvider.h" | 28 #include "Internals/ICairoContextProvider.h" |
28 | 29 |
29 namespace OrthancStone | 30 namespace OrthancStone |
30 { | 31 { |
31 class CairoCompositor : | 32 class CairoCompositor : |
32 public ICompositor, | 33 public ICompositor, |
33 private Internals::CompositorHelper::IRendererFactory, | 34 private Internals::CompositorHelper::IRendererFactory, |
34 private Internals::ICairoContextProvider | 35 private Internals::ICairoContextProvider |
35 { | 36 { |
36 private: | 37 private: |
37 typedef std::map<size_t, GlyphBitmapAlphabet*> Fonts; | 38 typedef std::map<size_t, GlyphBitmapAlphabet*> Fonts; |
38 | 39 |
39 Internals::CompositorHelper helper_; | 40 Internals::CompositorHelper helper_; |
50 public: | 51 public: |
51 CairoCompositor(const Scene2D& scene, | 52 CairoCompositor(const Scene2D& scene, |
52 unsigned int canvasWidth, | 53 unsigned int canvasWidth, |
53 unsigned int canvasHeight); | 54 unsigned int canvasHeight); |
54 | 55 |
55 ~CairoCompositor(); | 56 virtual ~CairoCompositor(); |
56 | 57 |
57 const CairoSurface& GetCanvas() const | 58 const CairoSurface& GetCanvas() const |
58 { | 59 { |
59 return canvas_; | 60 return canvas_; |
60 } | 61 } |
71 | 72 |
72 void SetFont(size_t index, | 73 void SetFont(size_t index, |
73 GlyphBitmapAlphabet* dict); // Takes ownership | 74 GlyphBitmapAlphabet* dict); // Takes ownership |
74 | 75 |
75 #if ORTHANC_ENABLE_LOCALE == 1 | 76 #if ORTHANC_ENABLE_LOCALE == 1 |
76 void SetFont(size_t index, | 77 virtual void SetFont(size_t index, |
77 Orthanc::EmbeddedResources::FileResourceId resource, | 78 Orthanc::EmbeddedResources::FileResourceId resource, |
78 unsigned int fontSize, | 79 unsigned int fontSize, |
79 Orthanc::Encoding codepage); | 80 Orthanc::Encoding codepage); |
80 #endif | 81 #endif |
81 | 82 |
82 virtual void Refresh(); | 83 virtual void Refresh(); |
84 | |
85 void UpdateSize(unsigned int canvasWidth, | |
86 unsigned int canvasHeight); | |
83 | 87 |
84 Orthanc::ImageAccessor* RenderText(size_t fontIndex, | 88 Orthanc::ImageAccessor* RenderText(size_t fontIndex, |
85 const std::string& utf8) const; | 89 const std::string& utf8) const; |
86 }; | 90 }; |
87 } | 91 } |