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

David Gobbi david.gobbi at gmail.com
Fri Aug 31 16:18:32 EDT 2012


On Fri, Aug 31, 2012 at 2:12 PM, Jeff Baumes <jeff.baumes at kitware.com> wrote:
> On Fri, Aug 31, 2012 at 2:37 PM, Marcus D. Hanwell
> <marcus.hanwell at kitware.com> wrote:
>
>> The vtkColor4d is just a double[4] in memory, and an
>> std::vector<vtkColor4d> colors would be laid out as 4*N doubles. The
>> color classes can also convert between different representations and
>> you don't need to guess the size. I personally prefer the compactness
>> of the vtkColor4ub, and the representation is easy to send to GL (as
>> is the vtkColor4d but it does use more space).
>>
>> I would love to see us move towards using actual types to represent
>> things like color, with accessors that can give the pointers for
>> older/C function calls.
>>
>> My $0.02, there is another color table class in the charts modules
>> that lets us pass around color sequences for plot colors too.
>
> 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. The vtkNamedColors class could for example store a map of string
> to vtkColor4ub internally and have functions that return vtkColor4d to
> be compatible with many existing VTK color-setting functions.
> 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"));

This gets me thinking... didn't someone just commit an addition to
vtkLookupTable() so that it can look up colors by name, instead of by
index?  Maybe we could just use that.  A vtkLookupTable subclass that
provides html colors, with all the standard names.

 - David



More information about the vtk-developers mailing list