I ran into this problem this week, but couldn't easily correct it since I was using Zwoptex for my PVR files rather than TexturePacker. Zwoptex currently exports PVR files without premultiplied alpha. I wrote a quick Mac program to convert the files. While I can't easily post the program, here's the core of it:
typedef struct PVR_TEXTURE_HEADER_TAG
{
unsigned int dwHeaderSize;
unsigned int dwHeight;
unsigned int dwWidth;
unsigned int dwMipMapCount;
unsigned int dwpfFlags;
unsigned int dwDataSize;
unsigned int dwBitCount;
unsigned int dwRBitMask;
unsigned int dwGBitMask;
unsigned int dwBBitMask;
unsigned int dwAlphaBitMask;
unsigned int dwPVR;
unsigned int dwNumSurfs;
} PVR_TEXTURE_HEADER;
- (void)openFile:(NSString *)strFileName
{
FILE *fpFileIn = fopen([strFileName UTF8String], "rb");
fseek(fpFileIn, 0, SEEK_END);
int nLength = ftell(fpFileIn);
if (nLength < 1)
{
return;
}
fseek(fpFileIn, 0, SEEK_SET);
int nHeader = sizeof(PVR_TEXTURE_HEADER);
NSString *strNewFile = [strFileName lastPathComponent];
FILE *fpFileOut = fopen([strNewFile UTF8String], "wb");
unsigned char *data = malloc(nHeader);
fread(data, nHeader, 1, fpFileIn);
fwrite(data, nHeader, 1, fpFileOut);
int nValue;
for (int i = nHeader; i < nLength; i += sizeof(int))
{
fread(&nValue, sizeof(int), 1, fpFileIn);
unsigned char A = (char)((nValue >> 24) & 0x000000ff);
unsigned char B = (char)((nValue >> 16) & 0x000000ff);
unsigned char G = (char)((nValue >> 8) & 0x000000ff);
unsigned char R = (char)(nValue & 0x000000ff);
R = (R * A) / 255;
G = (G * A) / 255;
B = (B * A) / 255;
nValue = (A << 24) | (B << 16) | (G << 8) | R;
fwrite(&nValue, sizeof(int), 1, fpFileOut);
}
fclose(fpFileIn);
fclose(fpFileOut);
}
Maybe this will be helpful to someone.