private static PNGChunk readChunk(DataInputStream distream) { try { int length = distream.readInt(); int type = distream.readInt(); byte[] data = new byte[length]; distream.readFully(data); int crc = distream.readInt(); return new PNGChunk(length, type, data, crc); } catch (Exception e) { e.printStackTrace(); return null; } }
private void parse_sRGB_chunk(PNGChunk chunk) { sRGBRenderingIntent = chunk.getByte(0);
private void parse_zTXt_chunk(PNGChunk chunk) { StringBuffer key = new StringBuffer(); StringBuffer value = new StringBuffer(); byte b; int textIndex = 0; while ((b = chunk.getByte(textIndex++)) != 0) { key.append( (char)b ); } /* int method = */ chunk.getByte(textIndex++); 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_IHDR_chunk(PNGChunk chunk) { int width = chunk.getInt4(0); int height = chunk.getInt4(4); bitDepth = chunk.getInt1(8); colorType = chunk.getInt1(9); if ((colorType != PNG_COLOR_GRAY) && (colorType != PNG_COLOR_RGB) && compressionMethod = chunk.getInt1(10); if (compressionMethod != 0) { filterMethod = chunk.getInt1(11); if (filterMethod != 0) { interlaceMethod = chunk.getInt1(12); if (interlaceMethod == 0) { if (encodeParam != null) {
private void parse_IHDR_chunk(PNGChunk chunk) { int width = chunk.getInt4(0); int height = chunk.getInt4(4); bitDepth = chunk.getInt1(8); colorType = chunk.getInt1(9); if ((colorType != PNG_COLOR_GRAY) && (colorType != PNG_COLOR_RGB) && compressionMethod = chunk.getInt1(10); if (compressionMethod != 0) { filterMethod = chunk.getInt1(11); if (filterMethod != 0) { interlaceMethod = chunk.getInt1(12); if (interlaceMethod == 0) { if (encodeParam != null) {
private void parse_IHDR_chunk(PNGChunk chunk) { int width = chunk.getInt4(0); int height = chunk.getInt4(4); bitDepth = chunk.getInt1(8); colorType = chunk.getInt1(9); if ((colorType != PNG_COLOR_GRAY) && (colorType != PNG_COLOR_RGB) && compressionMethod = chunk.getInt1(10); if (compressionMethod != 0) { filterMethod = chunk.getInt1(11); if (filterMethod != 0) { interlaceMethod = chunk.getInt1(12); if (interlaceMethod == 0) { if (encodeParam != null) {
private void parse_IHDR_chunk(PNGChunk chunk) { int width = chunk.getInt4(0); int height = chunk.getInt4(4); bitDepth = chunk.getInt1(8); colorType = chunk.getInt1(9); if ((colorType != PNG_COLOR_GRAY) && (colorType != PNG_COLOR_RGB) && compressionMethod = chunk.getInt1(10); if (compressionMethod != 0) { filterMethod = chunk.getInt1(11); if (filterMethod != 0) { interlaceMethod = chunk.getInt1(12); if (interlaceMethod == 0) { if (encodeParam != null) {
} else if (chunkType.equals("IDAT")) { chunk = readChunk(distream); streamVec.add(new ByteArrayInputStream(chunk.getData())); } else if (chunkType.equals("IEND")) { chunk = readChunk(distream); String type = chunk.getTypeString(); byte[] data = chunk.getData(); if (encodeParam != null) { encodeParam.addPrivateChunk(type, data);
} else if (chunkType.equals("IDAT")) { chunk = readChunk(distream); streamVec.add(new ByteArrayInputStream(chunk.getData())); } else if (chunkType.equals("IEND")) { chunk = readChunk(distream); String type = chunk.getTypeString(); byte[] data = chunk.getData(); if (encodeParam != null) { encodeParam.addPrivateChunk(type, data);
} else if (chunkType.equals("IDAT")) { chunk = readChunk(distream); streamVec.add(new ByteArrayInputStream(chunk.getData())); } else if (chunkType.equals("IEND")) { chunk = readChunk(distream); String type = chunk.getTypeString(); byte[] data = chunk.getData(); if (encodeParam != null) { encodeParam.addPrivateChunk(type, data);
} else if (chunkType.equals("IDAT")) { chunk = readChunk(distream); streamVec.add(new ByteArrayInputStream(chunk.getData())); } else if (chunkType.equals("IEND")) { chunk = readChunk(distream); String type = chunk.getTypeString(); byte[] data = chunk.getData(); if (encodeParam != null) { encodeParam.addPrivateChunk(type, data);
private void parse_tRNS_chunk(PNGChunk chunk) { if (colorType == PNG_COLOR_PALETTE) { int entries = chunk.getLength(); if (entries > paletteEntries) { alphaPalette[i] = chunk.getByte(i); grayTransparentAlpha = chunk.getInt2(0); redTransparentAlpha = chunk.getInt2(0); greenTransparentAlpha = chunk.getInt2(2); blueTransparentAlpha = chunk.getInt2(4);
private void parse_tRNS_chunk(PNGChunk chunk) { if (colorType == PNG_COLOR_PALETTE) { int entries = chunk.getLength(); if (entries > paletteEntries) { alphaPalette[i] = chunk.getByte(i); grayTransparentAlpha = chunk.getInt2(0); redTransparentAlpha = chunk.getInt2(0); greenTransparentAlpha = chunk.getInt2(2); blueTransparentAlpha = chunk.getInt2(4);
private void parse_tRNS_chunk(PNGChunk chunk) { if (colorType == PNG_COLOR_PALETTE) { int entries = chunk.getLength(); if (entries > paletteEntries) { alphaPalette[i] = chunk.getByte(i); grayTransparentAlpha = chunk.getInt2(0); redTransparentAlpha = chunk.getInt2(0); greenTransparentAlpha = chunk.getInt2(2); blueTransparentAlpha = chunk.getInt2(4);
private void parse_tRNS_chunk(PNGChunk chunk) { if (colorType == PNG_COLOR_PALETTE) { int entries = chunk.getLength(); if (entries > paletteEntries) { alphaPalette[i] = chunk.getByte(i); grayTransparentAlpha = chunk.getInt2(0); redTransparentAlpha = chunk.getInt2(0); greenTransparentAlpha = chunk.getInt2(2); blueTransparentAlpha = chunk.getInt2(4);
private void parse_sRGB_chunk(PNGChunk chunk) { sRGBRenderingIntent = chunk.getByte(0);