最近用camera360的sdk做滤镜。太tm有点小坑。。。主要就是byte[]和int[]互转。
int2Byte:
public static byte[] intArrToByteArray(int[] intArr) throws IOException {
ByteArrayOutputStream buf = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(buf);
for (int i : intArr) {
out.writeInt(i);
}
byte[] b = buf.toByteArray();
out.close();
buf.close();
return b;
}
byte[] 2 int[]
ByteBuffer bb = ByteBuffer.wrap(arrRGBA);
int[] arrIntRGBA = new int[arrRGBA.length/4];
for (int i = 0; i < arrIntRGBA.length; i++) {
arrIntRGBA[i] = bb.getInt();
}
