[vtkusers] Pan, brightness & contrast (2D).

de Boer Ingo I.deBoer at polytec.de
Tue Aug 17 06:28:17 EDT 2004


Hi,

you can write your own vtkMyInteractorStyle based on eg.
vtkInteractorStyleTrackballCamera
Overwrite eg

void OnLeftButtonDown();
void OnLeftButtonUp();
void OnMiddleButtonDown();
void OnMiddleButtonUp();

Than, like..

void vtkMyInteractorStyle::OnLeftButtonDown()
{
  if (bPanMode)
    vtkInteractorStyleTrackballCamera::OnLeftButtonDown();
  else
    vtkInteractorStyleTrackballCamera::OnMiddleButtonDown();
}

In vtkMyInteractorStyle write a function for the bPanMode flag
which toggles between rotation and panning.

greets
  Ingo

---
Dr.-Ing. Ingo H. de Boer

Polytec GmbH
Polytec-Platz 1-7, 76337 Waldbronn, Germany
phone: ++49 7243 604 106
fax  : ++49 7243 604 255
 
> I want to pan (without having to use the middle button of the 
> mouse, since
> I want to use outer button that I will create in a MFC 
> dialog) a 2D picture
> and to change its brightness and contrast. How can I do this 
> without using
> an imageViewer?
> 
> My code now is:
> bmpReader = vtkBMPReader::New();
> bmpReader->SetFileName("D:\\vtkExp\\femur1.bmp");
> bmpReader->Update();
> vtkImageActor* act = vtkImageActor::New();
> act->SetInput(bmpReader->GetOutput());
> vtkRenderer* renderer = vtkRenderer::New();
> renderer->AddActor(act);
> 
> CRect rect; 
> 
> CWnd* wind = GetDlgItem(IDC_PIC);
> renwin = vtkWin32OpenGLRenderWindow::New();
> wind->GetClientRect(&rect); 
> renwin->SetSize(rect.Width(), rect.Height());
> renwin->SetParentId(wind->m_hWnd); 
> ::SetParent(renwin->GetWindowId(), this->m_hWnd); 
> renwin->AddRenderer(renderer); 
> renwin->Render();
> 	
> 	vtkRenderWindowInteractor* renwinint = 
> vtkRenderWindowInteractor::New();
> 	renwinint->SetRenderWindow(renwin);
> 	renwinint->Initialize();
> 
> 
> camera = vtkCamera::New();
> renderer->SetActiveCamera(camera);
> renderer->ResetCamera();
> renderer->SetBackground(1,1,1);



More information about the vtkusers mailing list