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

Method RasterizeBackground

IO/ExportGL2PS/vtkOpenGLGL2PSExporter.cxx:152–175  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

150}
151
152bool vtkOpenGLGL2PSExporter::RasterizeBackground(vtkImageData* image)
153{
154 vtkNew<vtkWindowToImageFilter> windowToImage;
155 windowToImage->SetInput(this->RenderWindow);
156 windowToImage->SetInputBufferTypeToRGB();
157 windowToImage->SetReadFrontBuffer(false);
158
159 vtkNew<vtkImageShiftScale> byteToFloat;
160 byteToFloat->SetOutputScalarTypeToFloat();
161 byteToFloat->SetScale(1.0 / 255.0);
162 byteToFloat->SetInputConnection(windowToImage->GetOutputPort());
163
164 vtkOpenGLGL2PSHelper* gl2ps = vtkOpenGLGL2PSHelper::GetInstance();
165 gl2ps->SetActiveState(vtkOpenGLGL2PSHelper::Background);
166 // Render twice to set the backbuffer:
167 this->RenderWindow->Render();
168 this->RenderWindow->Render();
169 byteToFloat->Update();
170 gl2ps->SetActiveState(vtkOpenGLGL2PSHelper::Inactive);
171
172 image->ShallowCopy(byteToFloat->GetOutput());
173
174 return true;
175}
176
177bool vtkOpenGLGL2PSExporter::CaptureVectorProps()
178{

Callers 1

WriteDataMethod · 0.95

Calls 8

RenderMethod · 0.65
SetInputMethod · 0.45
SetScaleMethod · 0.45
SetInputConnectionMethod · 0.45
GetOutputPortMethod · 0.45
UpdateMethod · 0.45
ShallowCopyMethod · 0.45
GetOutputMethod · 0.45

Tested by

no test coverage detected