1

我可以通过执行以下操作将我的渲染窗口保存为位图:

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 图像并将其传递给画家/打印机?

4

0 回答 0