MCPcopy Create free account
hub / github.com/Kitware/VTK / TestRenderString

Function TestRenderString

Rendering/Matplotlib/Testing/Cxx/TestRenderString.cxx:16–46  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

14
15//------------------------------------------------------------------------------
16int TestRenderString(int vtkNotUsed(argc), char* vtkNotUsed(argv)[])
17{
18 const char* str = "$\\hat{H}\\psi = \\left(-\\frac{\\hbar}{2m}\\nabla^2"
19 " + V(r)\\right) \\psi = \\psi\\cdot E $";
20
21 vtkNew<vtkImageData> image;
22 vtkNew<vtkMathTextUtilities> utils;
23 utils->SetScaleToPowerOfTwo(false);
24 vtkNew<vtkTextProperty> tprop;
25 tprop->SetColor(1, 1, 1);
26 tprop->SetFontSize(50);
27
28 vtkNew<vtkImageViewer2> viewer;
29 utils->RenderString(str, image, tprop, viewer->GetRenderWindow()->GetDPI());
30
31 viewer->SetInputData(image);
32
33 vtkNew<vtkRenderWindowInteractor> iren;
34 viewer->SetupInteractor(iren);
35
36 viewer->Render();
37 viewer->GetRenderer()->ResetCamera();
38 viewer->GetRenderer()->GetActiveCamera()->Zoom(6.0);
39 viewer->Render();
40
41 viewer->GetRenderWindow()->SetMultiSamples(0);
42 viewer->GetRenderWindow()->GetInteractor()->Initialize();
43 viewer->GetRenderWindow()->GetInteractor()->Start();
44
45 return EXIT_SUCCESS;
46}

Callers

nothing calls this directly

Calls 15

SetFontSizeMethod · 0.80
GetActiveCameraMethod · 0.80
SetMultiSamplesMethod · 0.80
RenderMethod · 0.65
SetScaleToPowerOfTwoMethod · 0.45
SetColorMethod · 0.45
RenderStringMethod · 0.45
GetRenderWindowMethod · 0.45
SetInputDataMethod · 0.45
SetupInteractorMethod · 0.45
ResetCameraMethod · 0.45
GetRendererMethod · 0.45

Tested by

no test coverage detected