Mercurial > hg > orthanc-stone
annotate OrthancStone/Sources/Scene2D/ICompositor.h @ 1515:b750b6eab453
sync
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 07 Jul 2020 20:52:35 +0200 |
parents | 244ad1e4e76a |
children | 92fca2b3ba3d |
rev | line source |
---|---|
1458
828a9b4ee1b7
added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1215
diff
changeset
|
1 /** |
828a9b4ee1b7
added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1215
diff
changeset
|
2 * Stone of Orthanc |
828a9b4ee1b7
added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1215
diff
changeset
|
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
828a9b4ee1b7
added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1215
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
828a9b4ee1b7
added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1215
diff
changeset
|
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium |
828a9b4ee1b7
added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1215
diff
changeset
|
6 * |
828a9b4ee1b7
added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1215
diff
changeset
|
7 * This program is free software: you can redistribute it and/or |
828a9b4ee1b7
added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1215
diff
changeset
|
8 * modify it under the terms of the GNU Affero General Public License |
828a9b4ee1b7
added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1215
diff
changeset
|
9 * as published by the Free Software Foundation, either version 3 of |
828a9b4ee1b7
added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1215
diff
changeset
|
10 * the License, or (at your option) any later version. |
828a9b4ee1b7
added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1215
diff
changeset
|
11 * |
828a9b4ee1b7
added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1215
diff
changeset
|
12 * This program is distributed in the hope that it will be useful, but |
828a9b4ee1b7
added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1215
diff
changeset
|
13 * WITHOUT ANY WARRANTY; without even the implied warranty of |
828a9b4ee1b7
added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1215
diff
changeset
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
828a9b4ee1b7
added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1215
diff
changeset
|
15 * Affero General Public License for more details. |
828a9b4ee1b7
added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1215
diff
changeset
|
16 * |
828a9b4ee1b7
added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1215
diff
changeset
|
17 * You should have received a copy of the GNU Affero General Public License |
828a9b4ee1b7
added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1215
diff
changeset
|
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
828a9b4ee1b7
added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1215
diff
changeset
|
19 **/ |
828a9b4ee1b7
added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1215
diff
changeset
|
20 |
828a9b4ee1b7
added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1215
diff
changeset
|
21 |
1053
32b403a47b19
simplifying IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
905
diff
changeset
|
22 #pragma once |
32b403a47b19
simplifying IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
905
diff
changeset
|
23 |
1211
d10d2acb8a02
compositors do not keep a reference to the scene anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1053
diff
changeset
|
24 #include "Scene2D.h" |
1215
9efa66d8d3f8
removed ViewportBase, and removed dependency of ViewportController on IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1211
diff
changeset
|
25 #include "ScenePoint2D.h" |
1211
d10d2acb8a02
compositors do not keep a reference to the scene anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1053
diff
changeset
|
26 |
1053
32b403a47b19
simplifying IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
905
diff
changeset
|
27 namespace OrthancStone |
32b403a47b19
simplifying IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
905
diff
changeset
|
28 { |
32b403a47b19
simplifying IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
905
diff
changeset
|
29 class ICompositor : public boost::noncopyable |
32b403a47b19
simplifying IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
905
diff
changeset
|
30 { |
32b403a47b19
simplifying IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
905
diff
changeset
|
31 public: |
32b403a47b19
simplifying IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
905
diff
changeset
|
32 virtual ~ICompositor() |
32b403a47b19
simplifying IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
905
diff
changeset
|
33 { |
32b403a47b19
simplifying IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
905
diff
changeset
|
34 } |
32b403a47b19
simplifying IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
905
diff
changeset
|
35 |
1482
5c96bf3f1d32
IOpenGL::RefreshCanvasSize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1471
diff
changeset
|
36 // This function can be expensive (notably in wasm) |
5c96bf3f1d32
IOpenGL::RefreshCanvasSize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1471
diff
changeset
|
37 virtual void RefreshCanvasSize() = 0; |
5c96bf3f1d32
IOpenGL::RefreshCanvasSize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1471
diff
changeset
|
38 |
1053
32b403a47b19
simplifying IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
905
diff
changeset
|
39 virtual unsigned int GetCanvasWidth() const = 0; |
32b403a47b19
simplifying IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
905
diff
changeset
|
40 |
32b403a47b19
simplifying IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
905
diff
changeset
|
41 virtual unsigned int GetCanvasHeight() const = 0; |
32b403a47b19
simplifying IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
905
diff
changeset
|
42 |
1211
d10d2acb8a02
compositors do not keep a reference to the scene anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1053
diff
changeset
|
43 /** |
d10d2acb8a02
compositors do not keep a reference to the scene anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1053
diff
changeset
|
44 * WARNING: "Refresh()" must always be called with the same |
d10d2acb8a02
compositors do not keep a reference to the scene anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1053
diff
changeset
|
45 * scene. If the scene changes, a call to "ResetScene()" must be |
d10d2acb8a02
compositors do not keep a reference to the scene anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1053
diff
changeset
|
46 * done to reset the tracking of the revisions of the layers. |
d10d2acb8a02
compositors do not keep a reference to the scene anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1053
diff
changeset
|
47 **/ |
d10d2acb8a02
compositors do not keep a reference to the scene anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1053
diff
changeset
|
48 virtual void Refresh(const Scene2D& scene) = 0; |
d10d2acb8a02
compositors do not keep a reference to the scene anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1053
diff
changeset
|
49 |
d10d2acb8a02
compositors do not keep a reference to the scene anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1053
diff
changeset
|
50 virtual void ResetScene() = 0; |
1053
32b403a47b19
simplifying IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
905
diff
changeset
|
51 |
32b403a47b19
simplifying IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
905
diff
changeset
|
52 #if ORTHANC_ENABLE_LOCALE == 1 |
32b403a47b19
simplifying IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
905
diff
changeset
|
53 virtual void SetFont(size_t index, |
1471
28c64c246312
working on a shared library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1458
diff
changeset
|
54 const std::string& ttf, |
1053
32b403a47b19
simplifying IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
905
diff
changeset
|
55 unsigned int fontSize, |
32b403a47b19
simplifying IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
905
diff
changeset
|
56 Orthanc::Encoding codepage) = 0; |
32b403a47b19
simplifying IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
905
diff
changeset
|
57 #endif |
1215
9efa66d8d3f8
removed ViewportBase, and removed dependency of ViewportController on IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1211
diff
changeset
|
58 |
9efa66d8d3f8
removed ViewportBase, and removed dependency of ViewportController on IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1211
diff
changeset
|
59 // Get the center of the given pixel, in canvas coordinates |
9efa66d8d3f8
removed ViewportBase, and removed dependency of ViewportController on IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1211
diff
changeset
|
60 ScenePoint2D GetPixelCenterCoordinates(int x, int y) const |
9efa66d8d3f8
removed ViewportBase, and removed dependency of ViewportController on IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1211
diff
changeset
|
61 { |
9efa66d8d3f8
removed ViewportBase, and removed dependency of ViewportController on IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1211
diff
changeset
|
62 return ScenePoint2D( |
9efa66d8d3f8
removed ViewportBase, and removed dependency of ViewportController on IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1211
diff
changeset
|
63 static_cast<double>(x) + 0.5 - static_cast<double>(GetCanvasWidth()) / 2.0, |
9efa66d8d3f8
removed ViewportBase, and removed dependency of ViewportController on IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1211
diff
changeset
|
64 static_cast<double>(y) + 0.5 - static_cast<double>(GetCanvasHeight()) / 2.0); |
9efa66d8d3f8
removed ViewportBase, and removed dependency of ViewportController on IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1211
diff
changeset
|
65 } |
9efa66d8d3f8
removed ViewportBase, and removed dependency of ViewportController on IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1211
diff
changeset
|
66 |
9efa66d8d3f8
removed ViewportBase, and removed dependency of ViewportController on IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1211
diff
changeset
|
67 void FitContent(Scene2D& scene) const |
9efa66d8d3f8
removed ViewportBase, and removed dependency of ViewportController on IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1211
diff
changeset
|
68 { |
9efa66d8d3f8
removed ViewportBase, and removed dependency of ViewportController on IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1211
diff
changeset
|
69 scene.FitContent(GetCanvasWidth(), GetCanvasHeight()); |
9efa66d8d3f8
removed ViewportBase, and removed dependency of ViewportController on IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1211
diff
changeset
|
70 } |
1053
32b403a47b19
simplifying IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
905
diff
changeset
|
71 }; |
32b403a47b19
simplifying IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
905
diff
changeset
|
72 } |