[DEV] set game working

This commit is contained in:
Edouard DUPIN 2021-05-27 00:17:48 +02:00
parent 5186fb115e
commit d5d68542ed

View File

@ -63,7 +63,7 @@ public class ToolImage {
} }
return out; return out;
} }
public static byte[] convertInByteBufferRGB(final Image data) { public static byte[] convertInByteBufferRGB(final Image data) {
byte[] out = new byte[data.getHeight() * data.getWidth() * 3]; byte[] out = new byte[data.getHeight() * data.getWidth() * 3];
for (int xxx = 0; xxx < data.getWidth(); ++xxx) { for (int xxx = 0; xxx < data.getWidth(); ++xxx) {
@ -75,6 +75,19 @@ public class ToolImage {
} }
return out; return out;
} }
public static byte[] pngConvertInByteBufferRGB(final Image data) {
int nbChannel = 3;
final int rowByteSize = 1 + nbChannel*data.getWidth();
byte[] out = new byte[data.getHeight() * rowByteSize];
for (int xxx = 0; xxx < data.getWidth(); ++xxx) {
for (int yyy = 0; yyy < data.getHeight(); ++yyy) {
out[yyy * rowByteSize + xxx * nbChannel + 1] = data.getRByte(xxx, yyy);
out[yyy * rowByteSize + xxx * nbChannel + 2] = data.getGByte(xxx, yyy);
out[yyy * rowByteSize + xxx * nbChannel + 3] = data.getBByte(xxx, yyy);
}
}
return out;
}
public static byte[] convertInByteBufferRGBA(final Image data) { public static byte[] convertInByteBufferRGBA(final Image data) {
byte[] out = new byte[data.getHeight() * data.getWidth() * 4]; byte[] out = new byte[data.getHeight() * data.getWidth() * 4];
@ -89,6 +102,21 @@ public class ToolImage {
return out; return out;
} }
public static byte[] pngConvertInByteBufferRGBA(final Image data) {
int nbChannel = 4;
final int rowByteSize = 1 + nbChannel*data.getWidth();
byte[] out = new byte[data.getHeight() * rowByteSize];
for (int xxx = 0; xxx < data.getWidth(); ++xxx) {
for (int yyy = 0; yyy < data.getHeight(); ++yyy) {
out[yyy * rowByteSize + xxx * nbChannel + 1] = data.getRByte(xxx, yyy);
out[yyy * rowByteSize + xxx * nbChannel + 2] = data.getGByte(xxx, yyy);
out[yyy * rowByteSize + xxx * nbChannel + 3] = data.getBByte(xxx, yyy);
out[yyy * rowByteSize + xxx * nbChannel + 4] = data.getAByte(xxx, yyy);
}
}
return out;
}
public static float[] convertInFloatBufferARGB(final Image data) { public static float[] convertInFloatBufferARGB(final Image data) {
float[] out = new float[data.getHeight() * data.getWidth() * 4]; float[] out = new float[data.getHeight() * data.getWidth() * 4];
for (int xxx = 0; xxx < data.getWidth(); ++xxx) { for (int xxx = 0; xxx < data.getWidth(); ++xxx) {