Setting node colors

The engine.
Post Reply
jdtoellner
Posts: 71
Joined: Mon Aug 01, 2016 9:45 pm

Setting node colors

Post by jdtoellner »

I'm able to set node colors to a nice light pink with a darker pink border with this code:

Code: Select all

theNet.GetNode(observableNodeHandle)->Info().Screen().color = 0xeeb4e2;
theNet.GetNode(observableNodeHandle)->Info().Screen().borderColor = 0x9d3b88;
When I try this color however I should get blue node with a darker blue border but I get a burnt orange instead:

Code: Select all

theNet.GetNode(nodeHandle)->Info().Screen().color = 0x3e8fc3;
theNet.GetNode(nodeHandle)->Info().Screen().borderColor = 0x2c6e99;
Here's what it looks like:
Attachments
NodeColor.JPG
NodeColor.JPG (12.4 KiB) Viewed 3753 times
jdtoellner
Posts: 71
Joined: Mon Aug 01, 2016 9:45 pm

Re: Setting node colors

Post by jdtoellner »

It looks like the Red and Blue colors are reversed. If I display the network in Genie I see:

R - 195
G - 143
B - 62

The correct color is:

R - 62
G - 143
B - 195
shooltz[BayesFusion]
Site Admin
Posts: 1417
Joined: Mon Nov 26, 2007 5:51 pm

Re: Setting node colors

Post by shooltz[BayesFusion] »

The colors are represented as rrbbgg in XDSL file. Internally SMILE uses Windows API convention for ordering red/green/blue components (again, for historical reasons). If your program runs on Windows and you include windows.h, you can use RGB macro to initializer colors:

Code: Select all

theNet.GetNode(nodeHandle)->Info().Screen().color = RGB(62, 143, 195);
Post Reply