Changeset 8566

Show
Ignore:
Timestamp:
07/11/08 21:43:01
Author:
robert
Message:

From Christophe Loustaunau, "For our application, we need to write tiff file in floats. I have change a little bit the readerWritterTiff :
It check the data type of the image ( img.getDataType() ) and if it's GL_FLOAT :It save the tiff with float values.
Otherwise it does the same thing as before."

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • OpenSceneGraph/trunk/src/osgPlugins/tiff/ReaderWriterTIFF.cpp

    r7878 r8566  
    690690            TIFF *image; 
    691691            int samplesPerPixel; 
     692            int bitsPerSample; 
    692693            uint16 photometric; 
    693694 
     
    729730            } 
    730731 
     732            switch(img.getDataType()){ 
     733                case GL_FLOAT: 
     734                    TIFFSetField(image, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_IEEEFP); 
     735                    TIFFSetField(image, TIFFTAG_ROWSPERSTRIP, 1); 
     736                    bitsPerSample = 32; 
     737                    break; 
     738                default: 
     739                    bitsPerSample = 8; 
     740                    break; 
     741            } 
     742 
    731743            TIFFSetField(image, TIFFTAG_IMAGEWIDTH,img.s()); 
    732744            TIFFSetField(image, TIFFTAG_IMAGELENGTH,img.t()); 
    733             TIFFSetField(image, TIFFTAG_BITSPERSAMPLE,8); 
     745            TIFFSetField(image, TIFFTAG_BITSPERSAMPLE,bitsPerSample); 
    734746            TIFFSetField(image, TIFFTAG_SAMPLESPERPIXEL,samplesPerPixel); 
    735747            TIFFSetField(image, TIFFTAG_PHOTOMETRIC, photometric);