private void parse_tEXt_chunk(PNGChunk chunk) { byte b; StringBuffer key = new StringBuffer(); int textIndex = 0; while ((b = chunk.getByte(textIndex++)) != 0) { key.append( (char)b ); } StringBuffer value= new StringBuffer(); for (int i = textIndex; i < chunk.getLength(); i++) { value.append( (char)chunk.getByte(i) ); } textKeys.add(key.toString() ); textStrings.add(value.toString() ); }
private void parse_tEXt_chunk(PNGChunk chunk) { byte b; StringBuffer key = new StringBuffer(); int textIndex = 0; while ((b = chunk.getByte(textIndex++)) != 0) { key.append( (char)b ); } StringBuffer value= new StringBuffer(); for (int i = textIndex; i < chunk.getLength(); i++) { value.append( (char)chunk.getByte(i) ); } textKeys.add(key.toString() ); textStrings.add(value.toString() ); }
private void parse_tEXt_chunk(PNGChunk chunk) { byte b; StringBuffer key = new StringBuffer(); int textIndex = 0; while ((b = chunk.getByte(textIndex++)) != 0) { key.append( (char)b ); } StringBuffer value= new StringBuffer(); for (int i = textIndex; i < chunk.getLength(); i++) { value.append( (char)chunk.getByte(i) ); } textKeys.add(key.toString() ); textStrings.add(value.toString() ); }
private void parse_tEXt_chunk(PNGChunk chunk) { byte b; StringBuffer key = new StringBuffer(); int textIndex = 0; while ((b = chunk.getByte(textIndex++)) != 0) { key.append( (char)b ); } StringBuffer value= new StringBuffer(); for (int i = textIndex; i < chunk.getLength(); i++) { value.append( (char)chunk.getByte(i) ); } textKeys.add(key.toString() ); textStrings.add(value.toString() ); }
private void parse_zTXt_chunk(PNGChunk chunk) { int textIndex = 0; StringBuffer key = new StringBuffer(); byte b; while ((b = chunk.getByte(textIndex++)) != 0) { key.append( (char)b ); } /* int method = */ chunk.getByte(textIndex++); StringBuffer value = new StringBuffer(); try { int length = chunk.getLength() - textIndex; byte[] data = chunk.getData(); InputStream cis = new ByteArrayInputStream(data, textIndex, length); InputStream iis = new InflaterInputStream(cis); int c; while ((c = iis.read()) != -1) { value.append( (char)c ); } ztextKeys.add(key.toString() ); ztextStrings.add(value.toString() ); } catch (Exception e) { e.printStackTrace(); } }
private void parse_zTXt_chunk(PNGChunk chunk) { int textIndex = 0; StringBuffer key = new StringBuffer(); byte b; while ((b = chunk.getByte(textIndex++)) != 0) { key.append( (char)b ); } /* int method = */ chunk.getByte(textIndex++); StringBuffer value = new StringBuffer(); try { int length = chunk.getLength() - textIndex; byte[] data = chunk.getData(); InputStream cis = new ByteArrayInputStream(data, textIndex, length); InputStream iis = new InflaterInputStream(cis); int c; while ((c = iis.read()) != -1) { value.append( (char)c ); } ztextKeys.add(key.toString() ); ztextStrings.add(value.toString() ); } catch (Exception e) { e.printStackTrace(); } }
private void parse_zTXt_chunk(PNGChunk chunk) { int textIndex = 0; StringBuffer key = new StringBuffer(); byte b; while ((b = chunk.getByte(textIndex++)) != 0) { key.append( (char)b ); } /* int method = */ chunk.getByte(textIndex++); StringBuffer value = new StringBuffer(); try { int length = chunk.getLength() - textIndex; byte[] data = chunk.getData(); InputStream cis = new ByteArrayInputStream(data, textIndex, length); InputStream iis = new InflaterInputStream(cis); int c; while ((c = iis.read()) != -1) { value.append( (char)c ); } ztextKeys.add(key.toString() ); ztextStrings.add(value.toString() ); } catch (Exception e) { e.printStackTrace(); } }
private void parse_zTXt_chunk(PNGChunk chunk) { int textIndex = 0; StringBuffer key = new StringBuffer(); byte b; while ((b = chunk.getByte(textIndex++)) != 0) { key.append( (char)b ); } /* int method = */ chunk.getByte(textIndex++); StringBuffer value = new StringBuffer(); try { int length = chunk.getLength() - textIndex; byte[] data = chunk.getData(); InputStream cis = new ByteArrayInputStream(data, textIndex, length); InputStream iis = new InflaterInputStream(cis); int c; while ((c = iis.read()) != -1) { value.append( (char)c ); } ztextKeys.add(key.toString() ); ztextStrings.add(value.toString() ); } catch (Exception e) { e.printStackTrace(); } }
private void parse_PLTE_chunk(PNGChunk chunk) { paletteEntries = chunk.getLength()/3; redPalette = new byte[paletteEntries]; greenPalette = new byte[paletteEntries]; bluePalette = new byte[paletteEntries]; int pltIndex = 0; // gAMA chunk must precede PLTE chunk if (performGammaCorrection) { if (gammaLut == null) { initGammaLut(bitDepth == 16 ? 16 : 8); } for (int i = 0; i < paletteEntries; i++) { byte r = chunk.getByte(pltIndex++); byte g = chunk.getByte(pltIndex++); byte b = chunk.getByte(pltIndex++); redPalette[i] = (byte)gammaLut[r & 0xff]; greenPalette[i] = (byte)gammaLut[g & 0xff]; bluePalette[i] = (byte)gammaLut[b & 0xff]; } } else { for (int i = 0; i < paletteEntries; i++) { redPalette[i] = chunk.getByte(pltIndex++); greenPalette[i] = chunk.getByte(pltIndex++); bluePalette[i] = chunk.getByte(pltIndex++); } } }
private void parse_tRNS_chunk(PNGChunk chunk) { if (colorType == PNG_COLOR_PALETTE) { int entries = chunk.getLength(); if (entries > paletteEntries) {
private void parse_tRNS_chunk(PNGChunk chunk) { if (colorType == PNG_COLOR_PALETTE) { int entries = chunk.getLength(); if (entries > paletteEntries) {
private void parse_tRNS_chunk(PNGChunk chunk) { if (colorType == PNG_COLOR_PALETTE) { int entries = chunk.getLength(); if (entries > paletteEntries) {
private void parse_PLTE_chunk(PNGChunk chunk) { paletteEntries = chunk.getLength()/3; redPalette = new byte[paletteEntries]; greenPalette = new byte[paletteEntries]; bluePalette = new byte[paletteEntries]; int pltIndex = 0; // gAMA chunk must precede PLTE chunk if (performGammaCorrection) { if (gammaLut == null) { initGammaLut(bitDepth == 16 ? 16 : 8); } for (int i = 0; i < paletteEntries; i++) { byte r = chunk.getByte(pltIndex++); byte g = chunk.getByte(pltIndex++); byte b = chunk.getByte(pltIndex++); redPalette[i] = (byte)gammaLut[r & 0xff]; greenPalette[i] = (byte)gammaLut[g & 0xff]; bluePalette[i] = (byte)gammaLut[b & 0xff]; } } else { for (int i = 0; i < paletteEntries; i++) { redPalette[i] = chunk.getByte(pltIndex++); greenPalette[i] = chunk.getByte(pltIndex++); bluePalette[i] = chunk.getByte(pltIndex++); } } }
private void parse_PLTE_chunk(PNGChunk chunk) { paletteEntries = chunk.getLength()/3; redPalette = new byte[paletteEntries]; greenPalette = new byte[paletteEntries]; bluePalette = new byte[paletteEntries]; int pltIndex = 0; // gAMA chunk must precede PLTE chunk if (performGammaCorrection) { if (gammaLut == null) { initGammaLut(bitDepth == 16 ? 16 : 8); } for (int i = 0; i < paletteEntries; i++) { byte r = chunk.getByte(pltIndex++); byte g = chunk.getByte(pltIndex++); byte b = chunk.getByte(pltIndex++); redPalette[i] = (byte)gammaLut[r & 0xff]; greenPalette[i] = (byte)gammaLut[g & 0xff]; bluePalette[i] = (byte)gammaLut[b & 0xff]; } } else { for (int i = 0; i < paletteEntries; i++) { redPalette[i] = chunk.getByte(pltIndex++); greenPalette[i] = chunk.getByte(pltIndex++); bluePalette[i] = chunk.getByte(pltIndex++); } } }
private void parse_tRNS_chunk(PNGChunk chunk) { if (colorType == PNG_COLOR_PALETTE) { int entries = chunk.getLength(); if (entries > paletteEntries) {
private void parse_PLTE_chunk(PNGChunk chunk) { paletteEntries = chunk.getLength()/3; redPalette = new byte[paletteEntries]; greenPalette = new byte[paletteEntries]; bluePalette = new byte[paletteEntries]; int pltIndex = 0; // gAMA chunk must precede PLTE chunk if (performGammaCorrection) { if (gammaLut == null) { initGammaLut(bitDepth == 16 ? 16 : 8); } for (int i = 0; i < paletteEntries; i++) { byte r = chunk.getByte(pltIndex++); byte g = chunk.getByte(pltIndex++); byte b = chunk.getByte(pltIndex++); redPalette[i] = (byte)gammaLut[r & 0xff]; greenPalette[i] = (byte)gammaLut[g & 0xff]; bluePalette[i] = (byte)gammaLut[b & 0xff]; } } else { for (int i = 0; i < paletteEntries; i++) { redPalette[i] = chunk.getByte(pltIndex++); greenPalette[i] = chunk.getByte(pltIndex++); bluePalette[i] = chunk.getByte(pltIndex++); } } }