decodePVR3 method
Implementation
Image? decodePVR3(List<int> data) {
//const PVR3_PVRTC_2BPP_RGB = 0;
//const PVR3_PVRTC_2BPP_RGBA = 1;
const PVR3_PVRTC_4BPP_RGB = 2;
const PVR3_PVRTC_4BPP_RGBA = 3;
/*const PVR3_PVRTC2_2BPP = 4;
const PVR3_PVRTC2_4BPP = 5;
const PVR3_ETC1 = 6;
const PVR3_DXT1 = 7;
const PVR3_DXT2 = 8;
const PVR3_DXT3 = 9;
const PVR3_DXT4 = 10;
const PVR3_DXT5 = 11;
const PVR3_BC1 = 7;
const PVR3_BC2 = 9;
const PVR3_BC3 = 11;
const PVR3_BC4 = 12;
const PVR3_BC5 = 13;
const PVR3_BC6 = 14;
const PVR3_BC7 = 15;
const PVR3_UYVY = 16;
const PVR3_YUY2 = 17;
const PVR3_BW_1BPP = 18;
const PVR3_R9G9B9E5 = 19;
const PVR3_RGBG8888 = 20;
const PVR3_GRGB8888 = 21;
const PVR3_ETC2_RGB = 22;
const PVR3_ETC2_RGBA = 23;
const PVR3_ETC2_RGB_A1 = 24;
const PVR3_EAC_R11_U = 25;
const PVR3_EAC_R11_S = 26;
const PVR3_EAC_RG11_U = 27;
const PVR3_EAC_RG11_S = 28;*/
final input = InputBuffer(data);
// Header
final version = input.readUint32();
if (version != 0x03525650) {
return null;
}
/*int flags =*/ input.readUint32();
final format = input.readUint32();
final order = [
input.readByte(),
input.readByte(),
input.readByte(),
input.readByte()
];
/*int colorspace =*/ input.readUint32();
/*int channeltype =*/ input.readUint32();
final height = input.readUint32();
final width = input.readUint32();
/*int depth =*/ input.readUint32();
/*int num_surfaces =*/ input.readUint32();
/*int num_faces =*/ input.readUint32();
/*int mipcount =*/ input.readUint32();
final metadata_size = input.readUint32();
input.skip(metadata_size);
if (order[0] == 0) {
switch (format) {
case PVR3_PVRTC_4BPP_RGB:
return decodeRgb4bpp(width, height, input.toUint8List());
case PVR3_PVRTC_4BPP_RGBA:
return decodeRgba4bpp(width, height, input.toUint8List());
/*case PVR3_PVRTC_2BPP_RGB:
return null;
case PVR3_PVRTC_2BPP_RGBA:
return null;
case PVR3_PVRTC2_2BPP:
return null;
case PVR3_PVRTC2_4BPP:
return null;
case PVR3_ETC1:
return null;
case PVR3_DXT1:
return null;
case PVR3_DXT2:
return null;
case PVR3_DXT3:
return null;
case PVR3_DXT4:
return null;
case PVR3_DXT5:
return null;
case PVR3_BC1:
return null;
case PVR3_BC2:
return null;
case PVR3_BC3:
return null;
case PVR3_BC4:
return null;
case PVR3_BC5:
return null;
case PVR3_BC6:
return null;
case PVR3_BC7:
return null;
case PVR3_UYVY:
return null;
case PVR3_YUY2:
return null;
case PVR3_BW_1BPP:
return null;
case PVR3_R9G9B9E5:
return null;
case PVR3_RGBG8888:
return null;
case PVR3_GRGB8888:
return null;
case PVR3_ETC2_RGB:
return null;
case PVR3_ETC2_RGBA:
return null;
case PVR3_ETC2_RGB_A1:
return null;
case PVR3_EAC_R11_U:
return null;
case PVR3_EAC_R11_S:
return null;
case PVR3_EAC_RG11_U:
return null;
case PVR3_EAC_RG11_S:
return null;*/
}
}
return null;
}