VTK 中文站
返回常见问题
渲染显示 2026-05-18 1 分钟阅读

VTK 设置背景色和渐变背景

使用 vtkRenderer 设置纯色背景、渐变背景,以及常用颜色值写法。

设置纯色背景

renderer.SetBackground(0.1, 0.2, 0.4)

VTK 颜色范围是 0 到 1,不是 0 到 255。

设置渐变背景

renderer.GradientBackgroundOn()
renderer.SetBackground(0.05, 0.08, 0.12)
renderer.SetBackground2(0.3, 0.45, 0.7)

刷新

修改背景后调用:

window.Render()

相关内容

反馈

发现内容错误、链接失效或希望补充案例,可以提交反馈。