[vtk-developers] Manual conversion of some Tcl to Python tests.

David Thompson david.thompson at kitware.com
Fri Aug 31 17:29:18 EDT 2012


> A central place for color schemes/palettes would be great,

Perhaps the class(es) could go in Common/Color ? Or Color/Core (in anticipation of Color/Lcms).

> ... Is there any reason not to
> use the exact color strings used in HTML/CSS/SVG, which came from the
> X11 colors ?... I suppose we can
> support both legacy non-standard names and current standards.

+1 for both.

> ...
> I'd also like to see vtkColor4ub being used internally and in new API
> where possible. Since 0-255 is what rendering engines often use (and
> what people familiar with modern standards like HTML, CSS, SVG are
> used to) it seems vtkColor4ub should be the preferred internal format,
> with vtkColor4d API being used for compatibility with existing VTK
> code.

My problem is that if someone wants to process an HDR image with something that uses Color4ub internally, they'll end up using something other than VTK. Using vtkColor4ub seems like an opportunity to repeat the float->double conversion of a few years ago.

> ... So to me, this is good:
> 
> actor->GetProperty()->SetColor(vtkNamedColors::GetColorDouble("antiquewhite").GetData());
> 
> Eventually we would have a vtkColor4ub function overload for
> vtkProperty::SetColor:
> 
> actor->GetProperty()->SetColor(vtkNamedColors::GetColor("antiquewhite"));


How about eventually having vtkProperty take a color name directly and use a factory to get colors from whatever dictionary has been linked in:

    actor->GetProperty()->SetColor( "antiquewhite" )?

This might also be a good time to bring up Tim Shead's idea of "CSS for VTK" where you pass a style sheet like this to a renderer or view:

    vtkActor { ambient-color: "antiquewhite" }
    vtkActor#picked { ambient-color: "poison_toad_green" }
    vtkTextActor { color: "limon" }

and matching actors/props would have their properties set accordingly. It seems like the next step past using vtkNamedColors internal to vtkProperty.

	David




More information about the vtk-developers mailing list