Mercurial > hg > orthanc-stone
comparison Framework/Scene2D/CairoCompositor.h @ 905:88bf49aebc13
introduced ICompositor and allow SdlViewport to work with a CairoCompositor (to run on machines without OpenGL drivers)
author | Alain Mazy <alain@mazy.be> |
---|---|
date | Wed, 17 Jul 2019 16:56:53 +0200 |
parents | 6e888cf6a48b |
children | 7a7e4e1f558f |
comparison
equal
deleted
inserted
replaced
904:ecdb2ceaa925 | 905:88bf49aebc13 |
---|---|
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 private Internals::CompositorHelper::IRendererFactory, | 33 public ICompositor, |
33 private Internals::ICairoContextProvider | 34 private Internals::CompositorHelper::IRendererFactory, |
35 private Internals::ICairoContextProvider | |
34 { | 36 { |
35 private: | 37 private: |
36 typedef std::map<size_t, GlyphBitmapAlphabet*> Fonts; | 38 typedef std::map<size_t, GlyphBitmapAlphabet*> Fonts; |
37 | 39 |
38 Internals::CompositorHelper helper_; | 40 Internals::CompositorHelper helper_; |
49 public: | 51 public: |
50 CairoCompositor(const Scene2D& scene, | 52 CairoCompositor(const Scene2D& scene, |
51 unsigned int canvasWidth, | 53 unsigned int canvasWidth, |
52 unsigned int canvasHeight); | 54 unsigned int canvasHeight); |
53 | 55 |
54 ~CairoCompositor(); | 56 virtual ~CairoCompositor(); |
55 | 57 |
56 const CairoSurface& GetCanvas() const | 58 const CairoSurface& GetCanvas() const |
57 { | 59 { |
58 return canvas_; | 60 return canvas_; |
59 } | 61 } |
60 | 62 |
61 unsigned int GetCanvasWidth() const | 63 virtual unsigned int GetCanvasWidth() const |
62 { | 64 { |
63 return canvas_.GetWidth(); | 65 return canvas_.GetWidth(); |
64 } | 66 } |
65 | 67 |
66 unsigned int GetCanvasHeight() const | 68 virtual unsigned int GetCanvasHeight() const |
67 { | 69 { |
68 return canvas_.GetHeight(); | 70 return canvas_.GetHeight(); |
69 } | 71 } |
70 | 72 |
71 void SetFont(size_t index, | 73 void SetFont(size_t index, |
72 GlyphBitmapAlphabet* dict); // Takes ownership | 74 GlyphBitmapAlphabet* dict); // Takes ownership |
73 | 75 |
74 #if ORTHANC_ENABLE_LOCALE == 1 | 76 #if ORTHANC_ENABLE_LOCALE == 1 |
75 void SetFont(size_t index, | 77 virtual void SetFont(size_t index, |
76 Orthanc::EmbeddedResources::FileResourceId resource, | 78 Orthanc::EmbeddedResources::FileResourceId resource, |
77 unsigned int fontSize, | 79 unsigned int fontSize, |
78 Orthanc::Encoding codepage); | 80 Orthanc::Encoding codepage); |
79 #endif | 81 #endif |
80 | 82 |
81 void Refresh(); | 83 virtual void Refresh(); |
82 | 84 |
83 Orthanc::ImageAccessor* RenderText(size_t fontIndex, | 85 Orthanc::ImageAccessor* RenderText(size_t fontIndex, |
84 const std::string& utf8) const; | 86 const std::string& utf8) const; |
85 }; | 87 }; |
86 } | 88 } |