VTKFIG  0.20.20181114
Easy VTK based in situ visualization
int main ( int  argc,
char *  argv[] 
)

Definition at line 15 of file example-draw.cxx.

16 {
17 
18 
19  // Draw a circle in the center of the image
20  vtkSmartPointer<vtkImageCanvasSource2D> drawing =
21  vtkSmartPointer<vtkImageCanvasSource2D>::New();
22  drawing->SetNumberOfScalarComponents(3);
23  drawing->SetScalarTypeToUnsignedChar();
24  drawing->SetExtent(0,1000,0,1000,0,1000);
25  drawing->SetDrawColor(0.0, 0.0, 0.0);
26  drawing->FillBox(0,1000,0,1000);
27  drawing->SetDrawColor(255.0, 255.0, 255.0);
28  drawing->DrawCircle(500,500,100);
29 
30 
31  // Display the result
32  vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor =
33  vtkSmartPointer<vtkRenderWindowInteractor>::New();
34 
35  vtkSmartPointer<vtkImageViewer2> imageViewer =
36  vtkSmartPointer<vtkImageViewer2>::New();
37  imageViewer->SetInputConnection(drawing->GetOutputPort());
38  imageViewer->SetSize(640, 512);
39  imageViewer->SetupInteractor(renderWindowInteractor);
40  imageViewer->GetRenderer()->ResetCamera();
41  imageViewer->GetRenderer()->SetBackground(1,0,0); //red
42 
43  renderWindowInteractor->Initialize();
44  renderWindowInteractor->Start();
45 
46  return EXIT_SUCCESS;
47 }