]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
MakeTexture() moved to VISU_GaussPointsPL
authorouv <ouv@opencascade.com>
Fri, 23 Sep 2005 13:53:23 +0000 (13:53 +0000)
committerouv <ouv@opencascade.com>
Fri, 23 Sep 2005 13:53:23 +0000 (13:53 +0000)
src/VISU_I/VISU_GaussPoints_i.cc
src/VISU_I/VISU_GaussPoints_i.hh

index 68e6be9f9a367cb4573967365556b30b08077d99..2743288e43723fca299712d3fbbaf7ea316994f8 100644 (file)
@@ -332,66 +332,7 @@ VISU::GaussPoints_i
   bool convertAlphaTexture = system( command2.latin1() ) == 0;
 
   if( convertMainTexture && convertAlphaTexture )
-    MakeTexture( mainTextureVTI, alphaTextureVTI );
+    myGaussPointsPL->SetImageData( VISU_GaussPointsPL::MakeTexture( mainTextureVTI.latin1(),
+                                                                   alphaTextureVTI.latin1() ) );
 }
 
-
-//----------------------------------------------------------------------------
-void
-VISU::GaussPoints_i
-::MakeTexture( const QString& theMainTexture, 
-              const QString& theAlphaTexture )
-{
-  if( theMainTexture.isNull() || theAlphaTexture.isNull() )
-    return;
-
-  vtkXMLImageDataReader* aMainReader = vtkXMLImageDataReader::New();
-  vtkXMLImageDataReader* anAlphaReader = vtkXMLImageDataReader::New();
-
-  aMainReader->SetFileName( theMainTexture );
-  anAlphaReader->SetFileName( theAlphaTexture );
-
-  aMainReader->Update();
-  anAlphaReader->Update();
-
-  vtkImageData* aMainImageData = aMainReader->GetOutput();
-  vtkImageData* anAlphaImageData = anAlphaReader->GetOutput();
-
-  int* aMainImageSize = aMainImageData->GetDimensions();
-  int* anAlphaImageSize = anAlphaImageData->GetDimensions();
-  if(aMainImageSize[0] != anAlphaImageSize[0] || aMainImageSize[1] != anAlphaImageSize[1])
-    throw std::runtime_error("GaussPoints_i::MakeTexture : aMainImageSize[0] != anAlphaImageSize[0] || aMainImageSize[1] != anAlphaImageSize[1]");
-
-  int aNbCompositeComponents = 4;
-  vtkImageData* aCompositeImageData = vtkImageData::New();
-  aCompositeImageData->SetDimensions(aMainImageSize);
-  aCompositeImageData->SetScalarTypeToUnsignedChar();        
-  aCompositeImageData->SetNumberOfScalarComponents(aNbCompositeComponents);
-  aCompositeImageData->AllocateScalars();
-
-  unsigned char* aMainDataPtr = (unsigned char*)aMainImageData->GetScalarPointer();
-  unsigned char* anAlphaDataPtr = (unsigned char*)anAlphaImageData->GetScalarPointer();
-  unsigned char *aCompositeDataPtr = (unsigned char * )aCompositeImageData->GetScalarPointer();
-
-  int aNbMainComponents = aMainImageData->GetNumberOfScalarComponents();
-  int aNbAlphaComponents = anAlphaImageData->GetNumberOfScalarComponents();
-  int aCompositeSize = aMainImageSize[0] * aMainImageSize[1] * aNbCompositeComponents;
-  
-  int aMainId = 0, anAlphaId = 0, aCompositeId = 0;
-  for(; aCompositeId < aCompositeSize;)
-  {
-    aCompositeDataPtr[aCompositeId] = aMainDataPtr[aMainId];
-    aCompositeDataPtr[aCompositeId + 1] = aMainDataPtr[aMainId + 1];
-    aCompositeDataPtr[aCompositeId + 2] = aMainDataPtr[aMainId + 2];
-    aCompositeDataPtr[aCompositeId + 3] = anAlphaDataPtr[anAlphaId];
-
-    aMainId += aNbMainComponents;
-    anAlphaId += aNbAlphaComponents;
-    aCompositeId += aNbCompositeComponents;
-  }
-  aMainReader->Delete();
-  anAlphaReader->Delete();
-  aCompositeImageData->Update();
-
-  myGaussPointsPL->SetImageData(aCompositeImageData);
-}
index c3b9e612fd6903421caa91a3478f3f22f6ef6d4f..59ba0d05b8c038acc70155f74f28811c3116b208 100644 (file)
@@ -106,10 +106,6 @@ namespace VISU
     VISU_PipeLine* 
     GetPipeLine();
 
-    void
-    MakeTexture( const QString& theMainTexture,
-                const QString& theAlphaTexture );
-
     VISU_GaussPointsPL *myGaussPointsPL;
 
     bool myIsColored;