[vtkusers] scaling an image interactively

Sidney Cadot sidney at v2e.nl
Mon Feb 11 12:25:28 EST 2002


  Hi all,

I'm wrestling around a bit with VTK, and right now I am trying to get a
simple 2D image to respond to resize requests etcetera, interactively.

The code below does all this, except that I would now like to have the
image rescale to the full window size instead of repositioning it in the
bottom left corner. Is there an easy way to achieve this without
subclassing vtkImageViewer and re-implementing the Render() member
function?

Regards, Sidney

=========================

int main()
{
  vtkJPEGReader *jpeg = vtkJPEGReader::New();
  jpeg->SetFileName("beach.jpg");

  vtkImageViewer *viewer = vtkImageViewer::New();
  viewer->SetInput(jpeg->GetOutput());
  viewer->SetColorLevel(127.5);
  viewer->SetColorWindow(256.0);

  vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
  iren->SetRenderWindow(viewer->GetRenderWindow());
  iren->Start();

  return 0;
}

========================






More information about the vtkusers mailing list