Definition at line 20 of file LimitCompressedImageSize.h. References Impala::Core::Array::Array2dTem< StorT, elemSize, ArithT >::CH(), Impala::Core::Array::Array2dTem< StorT, elemSize, ArithT >::CPB(), Impala::Core::Array::Array2dTem< StorT, elemSize, ArithT >::CW(), ILOG_VAR, Impala::Core::Geometry::NEAREST, ReadImageFromMemory(), Scale(), and WritePngToMemory(). Referenced by Impala::Application::Util::DoCreateImageSet(). 00021 { 00022 ILOG_VAR(Impala.Core.Array.LimitCompressedImageSize); 00023 00024 if (maxSize <= 0) 00025 return; 00026 00027 Array2dVec3UInt8* rgbIm = 0; 00028 ReadImageFromMemory(rgbIm, (char*)bufIm->CPB(), bufIm->CW()); 00029 if (!rgbIm) 00030 return; 00031 00032 if ((rgbIm->CW() > maxSize) || (rgbIm->CH() > maxSize)) 00033 { 00034 double scale = 1.0; 00035 while ((scale * rgbIm->CW() > maxSize) || (scale * rgbIm->CH() > maxSize)) 00036 scale *= 0.5; 00037 00038 size_t nrBytes = 0; 00039 Array2dVec3UInt8* sc = 0; 00040 Scale(sc, rgbIm, scale, scale, Core::Geometry::NEAREST, true); 00041 int charBufSize = sc->CW() * sc->CH() * 3 + 1024; 00042 char* charBuf = new char[charBufSize]; 00043 WritePngToMemory(sc, charBuf, charBufSize, &nrBytes); 00044 delete sc; 00045 00046 delete bufIm; 00047 bufIm = MakeFromData<Array2dScalarUInt8>((UInt8*) charBuf, nrBytes, 1); 00048 delete charBuf; 00049 } 00050 delete rgbIm; 00051 }
Here is the call graph for this function:
|