[vtk-developers] Interest in a vtkColor class?
Andrew Maclean
a.maclean at cas.edu.au
Mon Mar 21 17:32:40 EST 2005
Thanks for your comments. I just wanted something in a class that doesn't
add a whole mass of static variables and also gives the user the ability to
add new colours to their tables. The values of the colours won't change in
the map but the user can add new colours or delete if they want. Someone
might want "alizarin purple"!
If no-one thinks this is of any use and maybe my solution is probably a bit
too sophisticated, could we perhaps just rename vtkTestingColors.h to say
vtkColors.h and move it into Commmon? This would be quite useful. I would be
quite happy with this approach.
This has just been motivated because I like to be able to set the same
colours in the TCL scripts and in the C++ code. Also when given an option
for colours, users often remember names better. I have a colour combo-box in
windows that lets the user select a named colour patch or make their own
colour. Hence the motivation for a map of colours keyed by name.
Andrew
-----Original Message-----
From: Mathieu Malaterre [mailto:mathieu.malaterre at kitware.com]
Sent: Tuesday, 22 March 2005 00:40
To: Andrew Maclean
Cc: 'list-vtk-developers'
Subject: Re: [vtk-developers] Interest in a vtkColor class?
Andrew,
Basically what you are asking is to include by default:
VTK/Common/Testing/Cxx/vtkTestingColors.h
The solution of the hash seems a bit too elaborate since the colors
are
not supposed to change. So I would rather see a solution like
vtkTestingColors.h.
My 2 cents,
Mathieu
Andrew Maclean wrote:
> Hi All,
>
> Is there any interest in a vtkColor class?
>
> If so I would be happy to write one.
>
> I envisage using the colour names in colors.tcl and having a function
like:
> GetColor("red"); returning a float[3]. Most likely I would use a map as
the
> underlying structure so that we could have a function like
> InsertColor(name,r,g,b); Thus users could add to the existing colour
table.
>
> I just find it frustrating that when using TCL I can easily specify a
colour
> but I can't do this in C++.
>
> It would be nice to have something like:
> actor->GetProperty()->SetColor(color->GetColor("antique_white"));
>
>
> Of course local defines could be used but I think having a colour class
> along with the ability to add more colours as you want may be a better
> solution. I also want to keep the well known colour names without
decorating
> them, hence the syntax above.
>
>
> Andrew
>
>
>
>
> ___________________________________________
> Andrew J. P. Maclean
> Centre for Autonomous Systems
> The Rose Street Building J04
> The University of Sydney 2006 NSW
> AUSTRALIA
> Ph: +61 2 9351 3283
> Fax: +61 2 9351 7474
> URL: http://www.cas.edu.au/
> ___________________________________________
>
>
> _______________________________________________
> vtk-developers mailing list
> vtk-developers at vtk.org
> http://www.vtk.org/mailman/listinfo/vtk-developers
>
More information about the vtk-developers
mailing list