private void decodeScanline(InputStream in, int width) throws IOException{ if (width < 8 || width > 0x7fff){ // too short/long for RLE compression decodeScanlineUncompressed(in, width); } // check format byte[] data = new byte[4]; in.read(data); if (data[0] != 0x02 || data[1] != 0x02 || (data[2] & 0x80) != 0){ // not RLE data decodeScanlineUncompressed(in, width-1); }else{ // check scanline width int readWidth = (data[2] & 0xFF) << 8 | (data[3] & 0xFF); if (readWidth != width) throw new IOException("Illegal scanline width in HDR file: "+width+" != "+readWidth); // RLE data decodeScanlineRLE(in, width); } }
private void decodeScanline(InputStream in, int width) throws IOException{ if (width < 8 || width > 0x7fff){ // too short/long for RLE compression decodeScanlineUncompressed(in, width); } // check format byte[] data = new byte[4]; in.read(data); if (data[0] != 0x02 || data[1] != 0x02 || (data[2] & 0x80) != 0){ // not RLE data decodeScanlineUncompressed(in, width-1); }else{ // check scanline width int readWidth = (data[2] & 0xFF) << 8 | (data[3] & 0xFF); if (readWidth != width) throw new IOException("Illegal scanline width in HDR file: "+width+" != "+readWidth); // RLE data decodeScanlineRLE(in, width); } }
private void decodeScanline(InputStream in, int width) throws IOException{ if (width < 8 || width > 0x7fff){ // too short/long for RLE compression decodeScanlineUncompressed(in, width); } // check format byte[] data = new byte[4]; in.read(data); if (data[0] != 0x02 || data[1] != 0x02 || (data[2] & 0x80) != 0){ // not RLE data decodeScanlineUncompressed(in, width-1); }else{ // check scanline width int readWidth = (data[2] & 0xFF) << 8 | (data[3] & 0xFF); if (readWidth != width) throw new IOException("Illegal scanline width in HDR file: "+width+" != "+readWidth); // RLE data decodeScanlineRLE(in, width); } }