This is minor issue, but anyway... Sometimes we need call non-wrapped FreeImage functions, like, for example, SetTransparentIndex/GetTransparentIndex. In C++ typically used constant references for objects, which we shouldn't change inside some methods, but only get data from them:
static void convertFIImageToGiRasterImage(const fipImage &fiImage, OdExGiRasterImage& bitmap)
, but, how I can call, for example, GetTransparentIndex in this function? Only using const_cast (or other set of casts) which contradicts with good coding style and doesn't recommented to be used in well-designed program. Actually problem here:
operator FIBITMAP*() {
return _dib;
}
fipImage contains necessary operator, but it is non-constant, so can't be used in our case:
static void convertFIImageToGiRasterImage(const fipImage &fiImage, OdExGiRasterImage& bitmap)
{
...
bitmap.setTransparentColor(::FreeImage_GetTransparentIndex(fipImage)); // Error
I think that this operator must be const to be compatible with calling FreeImage_Get... functions from C++ code without problems.
Hi,
Currently, a FIBITMAP cannot be const, so that a fipImage cannot be const (this is necessary if you need to call the FreeImage API using a fipImage, e.g. FreeImage_GetTransparentIndex(fipImage)).
Hervé