MFC & vtkWriter problem

Agris Klimkans agris at phc.chalmers.se
Fri Jan 21 16:37:20 EST 2000


Hi!

I'd really appreciate any hints on the following matter:

There is a little problem in a 'combination' of the 'vtkWriter' and the MFC 'CFileDialog'.
My MDI program renders to a 'CView' derived window and everything is fine until I want to save the rendered image in a file, using a 'vtkWriter' derived class (like 'vtkBMPWriter').
The 'CFileDialog' window is hiding a part of the rendered image. In saving the image using the 'vtkBMPWriter', it saves also a part of the dialog box, which was above the image.
The File->Save code used is like this:

void CCurrents3DView::OnFileSave() 
{
 CString sFileName;

 static TCHAR szFilter[] = _T("Bitmap Files(*.bmp) |*.bmp|All Files (*.*)|*.*||");
 
 CFileDialog dlg(TRUE,_T("*.bmp"),NULL, OFN_HIDEREADONLY | OFN_PATHMUSTEXIST |
      OFN_OVERWRITEPROMPT | OFN_CREATEPROMPT, szFilter,NULL);

 if( dlg.DoModal() == IDOK)
 {
  sFileName = dlg.GetPathName();

  vtkWindowToImageFilter* renSrc = vtkWindowToImageFilter::New();
   renSrc->SetInput(m_pRenderer->GetVTKWindow());

  vtkBMPWriter* writer = vtkBMPWriter::New();
   writer->SetInput(renSrc->GetOutput());
   writer->SetFileName(sFileName.GetBuffer(10));
   writer->Write();

  renSrc->Delete();
  writer->Delete();
 }
}

There is no problem when overwriting already existing (previously created) file.
It appears when saving to a new file.



Thanks in advance!
-------------------------------------------
Agris Klimkans
Dept. of Physical Chemistry, office 5020
Chalmers University of Technology
S-41296 Gothenburg
Sweden

 phone: (+46)31-7723051
   fax: (+46)31-7723858
mailto:agris at phc.chalmers.se
-------------------------------------------




-----------------------------------------------------------------------------
This is the private VTK discussion list.  Please keep messages on-topic.
Check the FAQ at: <http://www.automatrix.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at gsao.med.ge.com>.  For help, send message body containing
"info vtkusers" to the same address.     Live long and prosper.
-----------------------------------------------------------------------------




More information about the vtkusers mailing list