Changeset 7253 for trunk


Ignore:
Timestamp:
11/26/10 15:31:37 (10 years ago)
Author:
melissa
Message:

Fixed APNG writer to properly handle interleaved little-endian data.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/components/bio-formats/src/loci/formats/out/APNGWriter.java

    r7225 r7253  
    118118      boolean indexed = 
    119119        getColorModel() != null && (getColorModel() instanceof IndexColorModel); 
     120      littleEndian = !r.getPixelsBinDataBigEndian(series, 0); 
    120121 
    121122      // write 8-byte PNG signature 
     
    256257      deflater.write(0); 
    257258      if (interleaved) { 
    258         System.arraycopy(stream, i * rowLen, rowBuf, 0, rowLen); 
     259        if (littleEndian) { 
     260          for (int col=0; col<width*sizeC; col++) { 
     261            int offset = (i * sizeC * width + col) * bytesPerPixel; 
     262            int pixel = DataTools.bytesToInt(stream, offset, 
     263              bytesPerPixel, littleEndian); 
     264            DataTools.unpackBytes(pixel, rowBuf, col * bytesPerPixel, 
     265              bytesPerPixel, false); 
     266          } 
     267        } 
     268        else System.arraycopy(stream, i * rowLen, rowBuf, 0, rowLen); 
    259269      } 
    260270      else { 
Note: See TracChangeset for help on using the changeset viewer.