changeset 556:b1e1eccee214

CairoSurface::Copy()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 17 Apr 2019 14:37:18 +0200
parents 731b40e9bfe1
children 77a21b28becd
files Framework/Viewport/CairoSurface.cpp Framework/Viewport/CairoSurface.h
diffstat 2 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Framework/Viewport/CairoSurface.cpp	Tue Apr 09 17:49:37 2019 +0200
+++ b/Framework/Viewport/CairoSurface.cpp	Wed Apr 17 14:37:18 2019 +0200
@@ -114,6 +114,17 @@
   }
 
 
+  void CairoSurface::Copy(const Orthanc::ImageAccessor& source)
+  {
+    SetSize(source.GetWidth(), source.GetHeight());
+
+    Orthanc::ImageAccessor target;
+    GetWriteableAccessor(target);
+
+    Orthanc::ImageProcessing::Convert(target, source);
+  }
+
+
   void CairoSurface::GetReadOnlyAccessor(Orthanc::ImageAccessor& target) const
   {
     target.AssignReadOnly(Orthanc::PixelFormat_BGRA32, width_, height_, pitch_, buffer_);
--- a/Framework/Viewport/CairoSurface.h	Tue Apr 09 17:49:37 2019 +0200
+++ b/Framework/Viewport/CairoSurface.h	Wed Apr 17 14:37:18 2019 +0200
@@ -56,8 +56,10 @@
       Allocate(width, height);
     }
 
+  private:
     CairoSurface(Orthanc::ImageAccessor& accessor);
 
+  public:
     ~CairoSurface()
     {
       Release();
@@ -68,6 +70,8 @@
 
     void Copy(const CairoSurface& other);
 
+    void Copy(const Orthanc::ImageAccessor& source);
+
     unsigned int GetWidth() const
     {
       return width_;