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

ENH: Implement WriteImage for vtkSMContextViewProxy.

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