Mercurial > hg > orthanc-stone
annotate OrthancStone/Sources/Scene2D/ICompositor.h @ 1599:73cd85d7da6a
SortedFrames::LookupSopInstanceUid()
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 28 Oct 2020 10:55:45 +0100 |
parents | 8563ea5d8ae4 |
children | 9ac2a65d4172 |
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 |
1598
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
8 * modify it under the terms of the GNU Lesser General Public License |
1458
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 |
1598
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
15 * Lesser General Public License for more details. |
1596
4fb8fdf03314
removed annoying whitespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1576
diff
changeset
|
16 * |
1598
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
17 * You should have received a copy of the GNU Lesser General Public |
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
18 * License along with this program. If not, see |
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
19 * <http://www.gnu.org/licenses/>. |
1458
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 |
828a9b4ee1b7
added missing copyright
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1215
diff
changeset
|
22 |
1053
32b403a47b19
simplifying IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
905
diff
changeset
|
23 #pragma once |
32b403a47b19
simplifying IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
905
diff
changeset
|
24 |
1211
d10d2acb8a02
compositors do not keep a reference to the scene anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1053
diff
changeset
|
25 #include "Scene2D.h" |
1215
9efa66d8d3f8
removed ViewportBase, and removed dependency of ViewportController on IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1211
diff
changeset
|
26 #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
|
27 |
1053
32b403a47b19
simplifying IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
905
diff
changeset
|
28 namespace OrthancStone |
32b403a47b19
simplifying IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
905
diff
changeset
|
29 { |
32b403a47b19
simplifying IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
905
diff
changeset
|
30 class ICompositor : public boost::noncopyable |
32b403a47b19
simplifying IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
905
diff
changeset
|
31 { |
32b403a47b19
simplifying IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
905
diff
changeset
|
32 public: |
32b403a47b19
simplifying IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
905
diff
changeset
|
33 virtual ~ICompositor() |
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 } |
32b403a47b19
simplifying IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
905
diff
changeset
|
36 |
1576
92fca2b3ba3d
sanitizing the handling of canvas size
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1512
diff
changeset
|
37 virtual void SetCanvasSize(unsigned int canvasWidth, |
92fca2b3ba3d
sanitizing the handling of canvas size
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1512
diff
changeset
|
38 unsigned int canvasHeight) = 0; |
1482
5c96bf3f1d32
IOpenGL::RefreshCanvasSize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1471
diff
changeset
|
39 |
1053
32b403a47b19
simplifying IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
905
diff
changeset
|
40 virtual unsigned int GetCanvasWidth() const = 0; |
32b403a47b19
simplifying IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
905
diff
changeset
|
41 |
32b403a47b19
simplifying IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
905
diff
changeset
|
42 virtual unsigned int GetCanvasHeight() const = 0; |
32b403a47b19
simplifying IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
905
diff
changeset
|
43 |
1211
d10d2acb8a02
compositors do not keep a reference to the scene anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1053
diff
changeset
|
44 /** |
d10d2acb8a02
compositors do not keep a reference to the scene anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1053
diff
changeset
|
45 * 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
|
46 * 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
|
47 * 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
|
48 **/ |
d10d2acb8a02
compositors do not keep a reference to the scene anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1053
diff
changeset
|
49 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
|
50 |
d10d2acb8a02
compositors do not keep a reference to the scene anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1053
diff
changeset
|
51 virtual void ResetScene() = 0; |
1053
32b403a47b19
simplifying IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
905
diff
changeset
|
52 |
32b403a47b19
simplifying IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
905
diff
changeset
|
53 #if ORTHANC_ENABLE_LOCALE == 1 |
32b403a47b19
simplifying IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
905
diff
changeset
|
54 virtual void SetFont(size_t index, |
1471
28c64c246312
working on a shared library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1458
diff
changeset
|
55 const std::string& ttf, |
1053
32b403a47b19
simplifying IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
905
diff
changeset
|
56 unsigned int fontSize, |
32b403a47b19
simplifying IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
905
diff
changeset
|
57 Orthanc::Encoding codepage) = 0; |
32b403a47b19
simplifying IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
905
diff
changeset
|
58 #endif |
1215
9efa66d8d3f8
removed ViewportBase, and removed dependency of ViewportController on IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1211
diff
changeset
|
59 |
9efa66d8d3f8
removed ViewportBase, and removed dependency of ViewportController on IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1211
diff
changeset
|
60 // 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
|
61 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
|
62 { |
9efa66d8d3f8
removed ViewportBase, and removed dependency of ViewportController on IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1211
diff
changeset
|
63 return ScenePoint2D( |
9efa66d8d3f8
removed ViewportBase, and removed dependency of ViewportController on IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1211
diff
changeset
|
64 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
|
65 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
|
66 } |
9efa66d8d3f8
removed ViewportBase, and removed dependency of ViewportController on IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1211
diff
changeset
|
67 |
9efa66d8d3f8
removed ViewportBase, and removed dependency of ViewportController on IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1211
diff
changeset
|
68 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
|
69 { |
9efa66d8d3f8
removed ViewportBase, and removed dependency of ViewportController on IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1211
diff
changeset
|
70 scene.FitContent(GetCanvasWidth(), GetCanvasHeight()); |
9efa66d8d3f8
removed ViewportBase, and removed dependency of ViewportController on IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1211
diff
changeset
|
71 } |
1053
32b403a47b19
simplifying IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
905
diff
changeset
|
72 }; |
32b403a47b19
simplifying IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
905
diff
changeset
|
73 } |