[vtkusers] vtkProperty , color setting problem

Sercani sercanimailgroups at gmail.com
Wed Jul 30 11:15:18 EDT 2008


Hi Shady;

VTK uses normalized color values so you must do these divisions:

      r=double(re)/255.0;

      g=double(ge)/255.0;

b=double(be)/255.0;

re,ge and be are your integer RGB values(for your program re=147,ge=112, be=219), r,g,b are normalized color values which are used by vtk...

 

From: vtkusers-bounces at vtk.org [mailto:vtkusers-bounces at vtk.org] On Behalf Of Shady Shidfar
Sent: Wednesday, July 30, 2008 5:19 PM
To: vtkusers at vtk.org
Subject: [vtkusers] vtkProperty , color setting problem

 

Hi Everyone,

 

I'm having a wierd problem with vtkProperty. I create a line and specify a color for it. The problem is that some (actually most) RGB values I pass to vtkProperty won't generate the related colour. say for example slateblue identified by R=147, G=112 and B=219 (http://www.ecrion.com/Support/Resources/XSL-FOTutorial/ApendixA.xml.html) appears as white?????!!!!!!! and it's not only that color. Can someone tell me what's the solution the create any RGB color. Here's my code:

 

vtk.vtkLineSource line = new vtkLineSource();

line.SetPoint1(0.0, 0.0, 0.0);

line.SetPoint2(50, 50, 0.0);

 

vtkPolyDataMapper mapper = new vtkPolyDataMapper();

mapper.SetInput(line.GetOutput());

 

vtkActor lineActor = new vtkActor();

lineActor.SetMapper(mapper);

 

//set line properties

vtkProperty property = new vtkProperty();

property.SetColor(147.0, 112.0, 219.0);

lineActor.SetProperty(property);

 

  _____  

Not happy with your email address? 
Get the one you really want <http://uk.docs.yahoo.com/ymail/new.html>  - millions of new email addresses available now at Yahoo! <http://uk.docs.yahoo.com/ymail/new.html> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080730/f4e90f88/attachment.htm>


More information about the vtkusers mailing list