Skip to content
Snippets Groups Projects
Commit 1afe4dfe authored by Olivier Couet's avatar Olivier Couet
Browse files

- TGLSAViewer::SavePicture is now a public method. Therefore it is now

  possible to generate gif files of the GL-Viewer from the command line
  doing:

  root [1] TGLSAViewer *glv = (TGLSAViewer *)gPad->GetViewer3D();
  root [2] glv->SavePicture("gl.gif");

  TGLSAViewer::SavePicture has also been modified to allow to generate
  animated gif files. Example:

  root [1] TGLSAViewer *glv = (TGLSAViewer *)gPad->GetViewer3D();
  root [2] glv->SavePicture("gl.gif+");
  root [3] glv->SavePicture("gl.gif+");
  root [4] glv->SavePicture("gl.gif+");

  Between each call to glv->SavePicture("gl.gif+"), the GL-Viewer display
  has been modified. Then gl.gif is an amination build from the various
  images displayed in the GL-Viewer.


git-svn-id: http://root.cern.ch/svn/root/trunk@16865 27541ba8-7e3a-0410-8455-c3a389f83636
parent 32826269
No related branches found
No related tags found
No related merge requests found
// @(#)root/gl:$Name: $:$Id: TGLSAViewer.h,v 1.16 2006/09/26 08:06:49 rdm Exp $ // @(#)root/gl:$Name: $:$Id: TGLSAViewer.h,v 1.17 2006/10/05 18:19:09 brun Exp $
// Author: Richard Maunder / Timur Pocheptsov // Author: Richard Maunder / Timur Pocheptsov
/************************************************************************* /*************************************************************************
...@@ -80,7 +80,6 @@ private: ...@@ -80,7 +80,6 @@ private:
TGLSAViewer(const TGLSAViewer &); TGLSAViewer(const TGLSAViewer &);
TGLSAViewer & operator = (const TGLSAViewer &); TGLSAViewer & operator = (const TGLSAViewer &);
void SavePicture(const TString &fileName);
protected: protected:
// Overloadable // Overloadable
...@@ -98,6 +97,7 @@ public: ...@@ -98,6 +97,7 @@ public:
void Show(); void Show();
void Close(); void Close();
void SavePicture(const TString &fileName);
// GUI events - editors, frame etc // GUI events - editors, frame etc
Bool_t ProcessFrameMessage(Long_t msg, Long_t parm1, Long_t); Bool_t ProcessFrameMessage(Long_t msg, Long_t parm1, Long_t);
......
// @(#)root/gl:$Name: $:$Id: TGLSAViewer.cxx,v 1.26 2006/10/05 18:19:09 brun Exp $ // @(#)root/gl:$Name: $:$Id: TGLSAViewer.cxx,v 1.27 2006/10/10 06:41:06 brun Exp $
// Author: Timur Pocheptsov / Richard Maunder // Author: Timur Pocheptsov / Richard Maunder
/************************************************************************* /*************************************************************************
...@@ -551,7 +551,8 @@ void TGLSAViewer::SavePicture(const TString &fileName) ...@@ -551,7 +551,8 @@ void TGLSAViewer::SavePicture(const TString &fileName)
gVirtualGL->CaptureViewer(this, TGLOutput::kEPS_BSP, fileName.Data()); gVirtualGL->CaptureViewer(this, TGLOutput::kEPS_BSP, fileName.Data());
else if (fileName.EndsWith(".pdf")) else if (fileName.EndsWith(".pdf"))
gVirtualGL->CaptureViewer(this, TGLOutput::kPDF_BSP, fileName.Data()); gVirtualGL->CaptureViewer(this, TGLOutput::kPDF_BSP, fileName.Data());
else if (fileName.EndsWith(".gif") || fileName.EndsWith(".jpg") || fileName.EndsWith(".png")) { else if (fileName.EndsWith(".gif") || fileName.Contains("gif+") ||
fileName.EndsWith(".jpg") || fileName.EndsWith(".png")) {
std::auto_ptr<TImage>gif(TImage::Create()); std::auto_ptr<TImage>gif(TImage::Create());
gif->FromWindow(fGLArea->GetGLWindow()->GetId()); gif->FromWindow(fGLArea->GetGLWindow()->GetId());
gif->WriteImage(fileName.Data()); gif->WriteImage(fileName.Data());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment