]> Creatis software - clitk.git/commitdiff
Merge branch 'master' of git.creatis.insa-lyon.fr:clitk
authorSimon Rit <simon.rit@creatis.insa-lyon.fr>
Thu, 19 Apr 2012 12:38:27 +0000 (14:38 +0200)
committerSimon Rit <simon.rit@creatis.insa-lyon.fr>
Thu, 19 Apr 2012 12:38:27 +0000 (14:38 +0200)
vv/vvAnimatedGIFWriter.cxx

index 75352acacc0f05b33f48540b97b9ad52649fddaa..7af2ca4ab26466a2e7f401c3f9837a86cb4aa3ca 100644 (file)
@@ -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);