private void writeIHDR() throws IOException { ChunkStream cs = new ChunkStream("IHDR"); cs.writeInt(width); cs.writeInt(height); cs.writeByte((byte)bitDepth); cs.writeByte((byte)colorType); cs.writeByte((byte)0); cs.writeByte((byte)0); cs.writeByte(interlace ? (byte)1 : (byte)0); cs.writeToStream(dataOutput); cs.close(); }
private void writePLTE() throws IOException { if (redPalette == null) { return; } ChunkStream cs = new ChunkStream("PLTE"); for (int i = 0; i < redPalette.length; i++) { cs.writeByte(redPalette[i]); cs.writeByte(greenPalette[i]); cs.writeByte(bluePalette[i]); } cs.writeToStream(dataOutput); cs.close(); }
private void writeIHDR() throws IOException { ChunkStream cs = new ChunkStream("IHDR"); cs.writeInt(width); cs.writeInt(height); cs.writeByte((byte)bitDepth); cs.writeByte((byte)colorType); cs.writeByte((byte)0); cs.writeByte((byte)0); cs.writeByte(interlace ? (byte)1 : (byte)0); cs.writeToStream(dataOutput); cs.close(); }
private void writeIHDR() throws IOException { ChunkStream cs = new ChunkStream("IHDR"); cs.writeInt(width); cs.writeInt(height); cs.writeByte((byte)bitDepth); cs.writeByte((byte)colorType); cs.writeByte((byte)0); cs.writeByte((byte)0); cs.writeByte(interlace ? (byte)1 : (byte)0); cs.writeToStream(dataOutput); cs.close(); }
private void writeIHDR() throws IOException { ChunkStream cs = new ChunkStream("IHDR"); cs.writeInt(width); cs.writeInt(height); cs.writeByte((byte)bitDepth); cs.writeByte((byte)colorType); cs.writeByte((byte)0); cs.writeByte((byte)0); cs.writeByte(interlace ? (byte)1 : (byte)0); cs.writeToStream(dataOutput); cs.close(); }
private void writePLTE() throws IOException { if (redPalette == null) { return; } ChunkStream cs = new ChunkStream("PLTE"); for (int i = 0; i < redPalette.length; i++) { cs.writeByte(redPalette[i]); cs.writeByte(greenPalette[i]); cs.writeByte(bluePalette[i]); } cs.writeToStream(dataOutput); cs.close(); }
private void writePLTE() throws IOException { if (redPalette == null) { return; } ChunkStream cs = new ChunkStream("PLTE"); for (int i = 0; i < redPalette.length; i++) { cs.writeByte(redPalette[i]); cs.writeByte(greenPalette[i]); cs.writeByte(bluePalette[i]); } cs.writeToStream(dataOutput); cs.close(); }
private void writePLTE() throws IOException { if (redPalette == null) { return; } ChunkStream cs = new ChunkStream("PLTE"); for (int i = 0; i < redPalette.length; i++) { cs.writeByte(redPalette[i]); cs.writeByte(greenPalette[i]); cs.writeByte(bluePalette[i]); } cs.writeToStream(dataOutput); cs.close(); }
private void writeTIME() throws IOException { if (param.isModificationTimeSet()) { ChunkStream cs = new ChunkStream("tIME"); Date date = param.getModificationTime(); TimeZone gmt = TimeZone.getTimeZone("GMT"); GregorianCalendar cal = new GregorianCalendar(gmt); cal.setTime(date); int year = cal.get(Calendar.YEAR); int month = cal.get(Calendar.MONTH); int day = cal.get(Calendar.DAY_OF_MONTH); int hour = cal.get(Calendar.HOUR_OF_DAY); int minute = cal.get(Calendar.MINUTE); int second = cal.get(Calendar.SECOND); cs.writeShort(year); cs.writeByte(month + 1); cs.writeByte(day); cs.writeByte(hour); cs.writeByte(minute); cs.writeByte(second); cs.writeToStream(dataOutput); cs.close(); } }
private void writeTIME() throws IOException { if (param.isModificationTimeSet()) { ChunkStream cs = new ChunkStream("tIME"); Date date = param.getModificationTime(); TimeZone gmt = TimeZone.getTimeZone("GMT"); GregorianCalendar cal = new GregorianCalendar(gmt); cal.setTime(date); int year = cal.get(Calendar.YEAR); int month = cal.get(Calendar.MONTH); int day = cal.get(Calendar.DAY_OF_MONTH); int hour = cal.get(Calendar.HOUR_OF_DAY); int minute = cal.get(Calendar.MINUTE); int second = cal.get(Calendar.SECOND); cs.writeShort(year); cs.writeByte(month + 1); cs.writeByte(day); cs.writeByte(hour); cs.writeByte(minute); cs.writeByte(second); cs.writeToStream(dataOutput); cs.close(); } }
private void writeTIME() throws IOException { if (param.isModificationTimeSet()) { ChunkStream cs = new ChunkStream("tIME"); Date date = param.getModificationTime(); TimeZone gmt = TimeZone.getTimeZone("GMT"); GregorianCalendar cal = new GregorianCalendar(gmt); cal.setTime(date); int year = cal.get(Calendar.YEAR); int month = cal.get(Calendar.MONTH); int day = cal.get(Calendar.DAY_OF_MONTH); int hour = cal.get(Calendar.HOUR_OF_DAY); int minute = cal.get(Calendar.MINUTE); int second = cal.get(Calendar.SECOND); cs.writeShort(year); cs.writeByte(month + 1); cs.writeByte(day); cs.writeByte(hour); cs.writeByte(minute); cs.writeByte(second); cs.writeToStream(dataOutput); cs.close(); } }
private void writeSBIT() throws IOException { if (param.isSignificantBitsSet()) { ChunkStream cs = new ChunkStream("sBIT"); int[] significantBits = param.getSignificantBits(); int len = significantBits.length; for (int i = 0; i < len; i++) { cs.writeByte(significantBits[i]); } cs.writeToStream(dataOutput); cs.close(); } }
private void writeSBIT() throws IOException { if (param.isSignificantBitsSet()) { ChunkStream cs = new ChunkStream("sBIT"); int[] significantBits = param.getSignificantBits(); int len = significantBits.length; for (int i = 0; i < len; i++) { cs.writeByte(significantBits[i]); } cs.writeToStream(dataOutput); cs.close(); } }
private void writeSBIT() throws IOException { if (param.isSignificantBitsSet()) { ChunkStream cs = new ChunkStream("sBIT"); int[] significantBits = param.getSignificantBits(); int len = significantBits.length; for (int significantBit : significantBits) { cs.writeByte(significantBit); } cs.writeToStream(dataOutput); cs.close(); } }
private void writeSBIT() throws IOException { if (param.isSignificantBitsSet()) { ChunkStream cs = new ChunkStream("sBIT"); int[] significantBits = param.getSignificantBits(); int len = significantBits.length; for (int significantBit : significantBits) { cs.writeByte(significantBit); } cs.writeToStream(dataOutput); cs.close(); } }
private void writePHYS() throws IOException { if (param.isPhysicalDimensionSet()) { ChunkStream cs = new ChunkStream("pHYs"); int[] dims = param.getPhysicalDimension(); cs.writeInt(dims[0]); cs.writeInt(dims[1]); cs.writeByte((byte)dims[2]); cs.writeToStream(dataOutput); cs.close(); } }
private void writePHYS() throws IOException { if (param.isPhysicalDimensionSet()) { ChunkStream cs = new ChunkStream("pHYs"); int[] dims = param.getPhysicalDimension(); cs.writeInt(dims[0]); cs.writeInt(dims[1]); cs.writeByte((byte)dims[2]); cs.writeToStream(dataOutput); cs.close(); } }
private void writePHYS() throws IOException { if (param.isPhysicalDimensionSet()) { ChunkStream cs = new ChunkStream("pHYs"); int[] dims = param.getPhysicalDimension(); cs.writeInt(dims[0]); cs.writeInt(dims[1]); cs.writeByte((byte)dims[2]); cs.writeToStream(dataOutput); cs.close(); } }
private void writePHYS() throws IOException { if (param.isPhysicalDimensionSet()) { ChunkStream cs = new ChunkStream("pHYs"); int[] dims = param.getPhysicalDimension(); cs.writeInt(dims[0]); cs.writeInt(dims[1]); cs.writeByte((byte)dims[2]); cs.writeToStream(dataOutput); cs.close(); } }
private void writeBKGD() throws IOException { if (param.isBackgroundSet()) { ChunkStream cs = new ChunkStream("bKGD"); switch (colorType) { case PNG_COLOR_GRAY: case PNG_COLOR_GRAY_ALPHA: int gray = ((PNGEncodeParam.Gray)param).getBackgroundGray(); cs.writeShort(gray); break; case PNG_COLOR_PALETTE: int index = ((PNGEncodeParam.Palette)param).getBackgroundPaletteIndex(); cs.writeByte(index); break; case PNG_COLOR_RGB: case PNG_COLOR_RGB_ALPHA: int[] rgb = ((PNGEncodeParam.RGB)param).getBackgroundRGB(); cs.writeShort(rgb[0]); cs.writeShort(rgb[1]); cs.writeShort(rgb[2]); break; } cs.writeToStream(dataOutput); cs.close(); } }