[vtkusers] RE: Screenshots JPEGWriter Iren

Brenton.Thomas at HardYards.info Brenton.Thomas at HardYards.info
Mon Feb 10 01:41:03 EST 2003


Figured how to fix it - set up off screen rendering, seems to work...


void CvtkInfrastructure::Snapshot(CString cFName)
{ 
 int *size = m_pRenWin->GetSize();
 
 vtkWindowToImageFilter *vtkImageFilter;
 vtkJPEGWriter *vtkJpegWriter;

 vtkImageFilter=vtkWindowToImageFilter::New();
 vtkJpegWriter=vtkJPEGWriter::New();

 m_pRenWin->SetupMemoryRendering(size[0], size[1], AfxGetMainWnd( )->GetDC()->GetSafeHdc());
 m_pRenWin->Render();

 vtkImageFilter->SetInput(m_pRenWin);
 vtkJpegWriter->SetInput(vtkImageFilter->GetOutput());
 
 vtkJpegWriter->SetFileName(cFName);
 vtkJpegWriter->SetQuality(100);
 vtkJpegWriter->ProgressiveOff();
 vtkJpegWriter->Write();

 vtkImageFilter->Delete();
 vtkJpegWriter->Delete();

 m_pRenWin->ResumeScreenRendering();


}
  -----Original Message-----
  From: Brenton.Thomas at HardYards.info [mailto:Brenton.Thomas at HardYards.info]
  Sent: Monday, 10 February 2003 4:57 PM
  To: vtkusers at public.kitware.com
  Subject: Screenshots JPEGWriter Iren 


  When I take a screenshot using vtkImageFilter and vtkJPEGWriter I am losing control of the interactor.  Does anyone have any ideas?
   
  The screenshot works fine - although best if the mouse if not over any part of the image.  But for some reason the application will no longer process mouse events afterword.
   
  If I comment out the vtkJpegWriter->Write(); command everything is fine - but of course no image.
   
   
  Help....
   
   
  void CvtkInfrastructure::Snapshot(CString cFName)
  {
   vtkWindowToImageFilter *vtkImageFilter;
   vtkJPEGWriter *vtkJpegWriter;

   vtkImageFilter=vtkWindowToImageFilter::New();
   vtkJpegWriter=vtkJPEGWriter::New();

   vtkImageFilter->SetInput(m_pRenWin);
   vtkJpegWriter->SetInput(vtkImageFilter->GetOutput());
   
   vtkJpegWriter->SetFileName(cFName);
   vtkJpegWriter->SetQuality(100);
   vtkJpegWriter->ProgressiveOff();
   vtkJpegWriter->Write();

   vtkImageFilter->Delete();
   vtkJpegWriter->Delete();


  }

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20030210/91ab8a3f/attachment.htm>


More information about the vtkusers mailing list