Search code examples
c++c++buildervclc++builder-xe2

C++ Builder XE2: Color2RGB not found


The documentation for the function TGIFColor Color2RGB(TColor) should be in the Vcl.Imaging.GIFImg.hpp source file. But when I try to use it I get the error Call to undefined function 'Color2RGB'. Here is a short example:

//---------------------------------------------------------------------------
#include <Vcl.Imaging.GIFImg.hpp>
#pragma hdrstop
//---------------------------------------------------------------------------
#pragma package(smart_init)


TGIFColor TestRGB(TColor fColor) {

   TGIFColor RGBColor = Color2RGB(fColor);
   return RGBColor;
}

Can anyone explain how to call this function, because the documentation doesn't!?

// Thanks

PS. I did started the question with "Hello, " but even when I edit the question it is removed :(


Solution

  • Read the documentation again more carefully. Color2RGB() is not a standalone function like you are trying to use it as. It is a static method of the TGIFColorMap class instead, eg:

    TGIFColor TestRGB(TColor fColor)
    {
        TGIFColor RGBColor = TGIFColorMap::Color2RGB(fColor);
        return RGBColor;
    }