private static void processExtraSamples(DeflaterOutputStream zip, DeflaterOutputStream mzip, byte[] outBuf, int samplePerPixel, int bitsPerSample, int width, int height) throws java.io.IOException { if (bitsPerSample == 8) { byte[] mask = new byte[width * height]; int mptr = 0; int optr = 0; int total = width * height * samplePerPixel; for (int k = 0; k < total; k += samplePerPixel) { for (int s = 0; s < samplePerPixel - 1; ++s) { outBuf[optr++] = outBuf[k + s]; } mask[mptr++] = outBuf[k + samplePerPixel - 1]; } zip.write(outBuf, 0, optr); mzip.write(mask, 0, mptr); } else throw new IOException(IOException.ExtraSamplesAreNotSupported); }
private static void processExtraSamples(DeflaterOutputStream zip, DeflaterOutputStream mzip, byte[] outBuf, int samplePerPixel, int bitsPerSample, int width, int height) throws java.io.IOException { if (bitsPerSample == 8) { byte[] mask = new byte[width * height]; int mptr = 0; int optr = 0; int total = width * height * samplePerPixel; for (int k = 0; k < total; k += samplePerPixel) { for (int s = 0; s < samplePerPixel - 1; ++s) { outBuf[optr++] = outBuf[k + s]; } mask[mptr++] = outBuf[k + samplePerPixel - 1]; } zip.write(outBuf, 0, optr); mzip.write(mask, 0, mptr); } else throw new IOException(IOException.ExtraSamplesAreNotSupported); }
public void writeData(byte[] data, int stride) throws IOException { ByteArrayOutputStream stream = new ByteArrayOutputStream(); DeflaterOutputStream zip = new DeflaterOutputStream(stream); int k; for (k = 0; k < data.length - stride; k += stride) { zip.write(0); zip.write(data, k, stride); } int remaining = data.length - k; if (remaining > 0) { zip.write(0); zip.write(data, k, remaining); } zip.close(); writeChunk(IDAT, stream.toByteArray()); }
public void writeData(byte[] data, int stride) throws IOException { ByteArrayOutputStream stream = new ByteArrayOutputStream(); DeflaterOutputStream zip = new DeflaterOutputStream(stream); int k; for (k = 0; k < data.length - stride; k += stride) { zip.write(0); zip.write(data, k, stride); } int remaining = data.length - k; if (remaining > 0) { zip.write(0); zip.write(data, k, remaining); } zip.close(); writeChunk(IDAT, stream.toByteArray()); }
public void writeIccProfile(byte[] data) throws IOException { ByteArrayOutputStream stream = new ByteArrayOutputStream(); stream.write((byte) 'I'); stream.write((byte) 'C'); stream.write((byte) 'C'); stream.write(0); stream.write(0); DeflaterOutputStream zip = new DeflaterOutputStream(stream); zip.write(data); zip.close(); writeChunk(iCCP, stream.toByteArray()); }
public void writeIccProfile(byte[] data) throws IOException { ByteArrayOutputStream stream = new ByteArrayOutputStream(); stream.write((byte) 'I'); stream.write((byte) 'C'); stream.write((byte) 'C'); stream.write(0); stream.write(0); DeflaterOutputStream zip = new DeflaterOutputStream(stream); zip.write(data); zip.close(); writeChunk(iCCP, stream.toByteArray()); }
processExtraSamples(zip, mzip, outBuf, samplePerPixel, bitsPerSample, w, height); else zip.write(outBuf);
processExtraSamples(zip, mzip, outBuf, samplePerPixel, bitsPerSample, w, height); else zip.write(outBuf);