02.07.2013, 11:53
Hi,
How from hex for ex: 080808
Make RGBA? i want to use that in setobjectmaterialtext...
How from hex for ex: 080808
Make RGBA? i want to use that in setobjectmaterialtext...
new value = 0xFFFFFFFF; // value to extract channels from
new red = (value & 0xFF000000) >> 24;
new green = (value & 0x00FF0000) >> 16;
new blue = (value & 0x0000FF00) >> 8;
new color = 0xFFFFFFAA; // original color
new r = (color & 0xFF000000) >> 24;
new g = (color & 0x00FF0000) >> 16;
new b = (color & 0x0000FF00) >> 8;
new a = (color & 0x000000FF);
// the new color that you pass to SetObjectMaterialText
new value = ( ((a & 0xFF) << 24) | ((g & 0xFF) << 16) | ((b & 0xFF) << 8) | (r & 0xFF) );