vtkRenderer: add radial gradient option
vtkViewport
has the GradientBackground
option to enable drawing a vertically oriented background gradient from one color to another. Please add a mode that lets this gradient be a radial gradient instead, e.g.,
renderer->SetGradientMode(VTK_GRADIENT_RADIAL_VIEWPORT);
The radius should be computed as a distance function from the center of the viewport (0.5, 0.5) to each pixel in viewport coordinate space. That means that for a viewport that is wider than it is tall, the gradient should take on an ellipsoidal shape since the viewport distance from the center to each edge is equal. Note that viewport coordinates range from [0.0, 1.0] in each dimension.
Future work could define a radial gradient as a screen-space distance from center out, which would be circular regardless of aspect ratio. Hence the suggested mode name VTK_GRADIENT_RADIAL_VIEWPORT
. For the existing vertically oriented gradient, a suggested mode name is VTK_GRADIENT_LINEAR_VERTICAL
to leave open the possibility of a horizontal linear gradient.