Mercurial > hg > orthanc-stone
diff Framework/Scene2D/ICompositor.h @ 1215:9efa66d8d3f8 broker
removed ViewportBase, and removed dependency of ViewportController on IViewport
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 04 Dec 2019 20:12:15 +0100 |
parents | d10d2acb8a02 |
children | 828a9b4ee1b7 |
line wrap: on
line diff
--- a/Framework/Scene2D/ICompositor.h Wed Dec 04 19:12:08 2019 +0100 +++ b/Framework/Scene2D/ICompositor.h Wed Dec 04 20:12:15 2019 +0100 @@ -1,6 +1,7 @@ #pragma once #include "Scene2D.h" +#include "ScenePoint2D.h" #include <EmbeddedResources.h> @@ -32,5 +33,18 @@ unsigned int fontSize, Orthanc::Encoding codepage) = 0; #endif + + // Get the center of the given pixel, in canvas coordinates + ScenePoint2D GetPixelCenterCoordinates(int x, int y) const + { + return ScenePoint2D( + static_cast<double>(x) + 0.5 - static_cast<double>(GetCanvasWidth()) / 2.0, + static_cast<double>(y) + 0.5 - static_cast<double>(GetCanvasHeight()) / 2.0); + } + + void FitContent(Scene2D& scene) const + { + scene.FitContent(GetCanvasWidth(), GetCanvasHeight()); + } }; }