Commit 596e0825 authored by Pat Marion's avatar Pat Marion
Browse files

ENH: Implement WriteImage for vtkSMContextViewProxy.

parent 514322ca
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "vtkRenderWindow.h" #include "vtkRenderWindow.h"
#include "vtkWindowToImageFilter.h" #include "vtkWindowToImageFilter.h"
#include "vtkProcessModule.h" #include "vtkProcessModule.h"
#include "vtkErrorCode.h"
#include "vtkObjectFactory.h" #include "vtkObjectFactory.h"
#include "vtkQtChartInteractorSetup.h" #include "vtkQtChartInteractorSetup.h"
...@@ -25,6 +26,7 @@ ...@@ -25,6 +26,7 @@
#include "vtkQtChartWidget.h" #include "vtkQtChartWidget.h"
#include "vtkQtChartView.h" #include "vtkQtChartView.h"
#include "vtkSMChartOptionsProxy.h" #include "vtkSMChartOptionsProxy.h"
#include "vtkSMUtilities.h"
#include "QVTKWidget.h" #include "QVTKWidget.h"
#include <QPointer> #include <QPointer>
...@@ -48,7 +50,7 @@ public: ...@@ -48,7 +50,7 @@ public:
}; };
vtkCxxRevisionMacro(vtkSMContextViewProxy, "1.6"); vtkCxxRevisionMacro(vtkSMContextViewProxy, "1.7");
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
vtkSMContextViewProxy::vtkSMContextViewProxy() vtkSMContextViewProxy::vtkSMContextViewProxy()
{ {
...@@ -126,12 +128,18 @@ vtkImageData* vtkSMContextViewProxy::CaptureWindow(int magnification) ...@@ -126,12 +128,18 @@ vtkImageData* vtkSMContextViewProxy::CaptureWindow(int magnification)
return capture; return capture;
} }
//---------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool vtkSMContextViewProxy::WriteImage(const char*) int vtkSMContextViewProxy::WriteImage(const char* filename,
const char* writerName, int magnification)
{ {
// this->PerformRender(); if (!filename || !writerName)
// return this->ChartView->SaveImage(filename); {
return false; return vtkErrorCode::UnknownError;
}
vtkSmartPointer<vtkImageData> shot;
shot.TakeReference(this->CaptureWindow(magnification));
return vtkSMUtilities::SaveImageOnProcessZero(shot, filename, writerName);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
......
...@@ -35,9 +35,9 @@ public: ...@@ -35,9 +35,9 @@ public:
void PrintSelf(ostream& os, vtkIndent indent); void PrintSelf(ostream& os, vtkIndent indent);
// Description: // Description:
// Saves the chart view as an image file. See vtkQtChartView::SaveImage(). // Saves a screenshot of the view to disk. The writerName argument specifies
// Returns true on success. // the vtkImageWriter subclass to use.
bool WriteImage(const char* filename); int WriteImage(const char* filename, const char* writerName, int magnification);
//BTX //BTX
// Description: // Description:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment