X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=vv%2FvvAnimatedGIFWriter.cxx;h=7af2ca4ab26466a2e7f401c3f9837a86cb4aa3ca;hb=99a4e52ce46e7018a46e94ad4925858165463c1d;hp=75352acacc0f05b33f48540b97b9ad52649fddaa;hpb=3fd15028ab81e6746d3af96695526d7d973a26c8;p=clitk.git diff --git a/vv/vvAnimatedGIFWriter.cxx b/vv/vvAnimatedGIFWriter.cxx index 75352ac..7af2ca4 100644 --- a/vv/vvAnimatedGIFWriter.cxx +++ b/vv/vvAnimatedGIFWriter.cxx @@ -75,11 +75,19 @@ void vvAnimatedGIFWriter::End() width, height, 8, width, false); cximages[i]->SetFrameDelay(100/Rate); cximages[i]->SetPalette((RGBQUAD*)(quant->GetLookupTable()->GetPointer(0))); + // Swap r and b in LUT before setting it + RGBQUAD *pal = cximages[i]->GetPalette(); + for(unsigned int j=0; j<256; j++) + std::swap(pal[j].rgbBlue, pal[j].rgbRed); } // Create gif FILE * pFile; pFile = fopen (this->FileName, "wb"); + if(pFile==NULL) { + vtkErrorMacro("Error in vvAnimatedGIFWriter::End: could not open " << this->FileName ); + return; + } CxImageGIF cximagegif; cximagegif.SetLoops(Loops); bool result = cximagegif.Encode(pFile,&(cximages[0]), (int)RGBslices.size(), true);