我可以通过执行以下操作将渲染窗口保存为位图:
vtkWindowToImageFilter *winToImg = vtkWindowToImageFilter::New();
winToImg->SetInput(mRenderWindow);
vtkBMPWriter *writer = vtkBMPWriter::New();
writer->SetInput(winToImg->GetOutput());
writer->SetFileName(aFilename.c_str());
writer->Write();
我可以使用QPrinter打印就绪的位图图像:
QPrinter printer;
QPrintDialog *dialog = new QPrintDialog(&printer);
dialog->setWindowTitle(tr("Print Document"));
if (dialog->exec() != QDialog::Accepted) {
return;
}
QImage testbild("C:\\test.bmp");
QPainter painter(&printer);
painter.drawImage(QPoint(0, 0), testbild);
painter.end();
但我不知道如何将两者合并并从vtkbmpwriter打印图像。如何从vtkbmpwriter中提取bmp图像并将其传递给画家/打印机?