Converting from ACI to RGB in AC2021

Converting from ACI to RGB in AC2021

dajum
Participant Participant
574 Views
1 Reply
Message 1 of 2

Converting from ACI to RGB in AC2021

dajum
Participant
Participant

I'm trying to use AcCmColor to convert from ACI to RGB and it doesn't work.


union {
Adesk::UInt32 val;
Adesk::UInt8 rgbs[4];
} c;
AcCmColor s;
Adesk::UInt16 ic;
ic = inletColor;
Acad::ErrorStatus es = s.setColorIndex(ic);
c.val = s.getRGB();
int r = s.red();
int g = s.green();
int b = s.blue();

 

The last 4 lines all return zero.  ic=5 and I can see the value in s looks okay with blue=5. mData values are fine. So why do all these methods fail in 2021? Since the SetColorMethod is deprecated I can't change the method. Is that why it fails? How to do this?

Thanks,

Dave

 

0 Likes
575 Views
1 Reply
Reply (1)
Message 2 of 2

dajum
Participant
Participant

This will work:


Adesk::ColorRef cref = acedGetRGB(ic);
int rv = GetRValue(cref);
int gv = GetGValue(cref);
int bv = GetBValue(cref);

0 Likes