www in docker support

This commit is contained in:
MaddoScientisto 2026-04-22 18:41:37 +02:00
commit c227fce036
2145 changed files with 399596 additions and 58 deletions

View file

@ -0,0 +1,23 @@
package org.jcodec.codecs.ppm;
import java.nio.ByteBuffer;
import org.jcodec.common.JCodecUtil2;
import org.jcodec.common.model.ColorSpace;
import org.jcodec.common.model.Picture;
public class PPMEncoder {
public ByteBuffer encodeFrame(Picture picture) {
if (picture.getColor() != ColorSpace.RGB)
throw new IllegalArgumentException("Only RGB image can be stored in PPM");
ByteBuffer buffer = ByteBuffer.allocate(picture.getWidth() * picture.getHeight() * 3 + 200);
buffer.put(JCodecUtil2.asciiString("P6 " + picture.getWidth() + " " + picture.getHeight() + " 255\n"));
byte[][] data = picture.getData();
for (int i = 0; i < picture.getWidth() * picture.getHeight() * 3; i += 3) {
buffer.put((byte)(data[0][i + 2] + 128));
buffer.put((byte)(data[0][i + 1] + 128));
buffer.put((byte)(data[0][i] + 128));
}
buffer.flip();
return buffer;
}
}