if (channels == 1) {
identifier = "Pf";
outChannels = 1;
- } else {
+ } else if (channels <= 3) {
identifier = "PF";
- outChannels = 3;
+ outChannels = 4;
+ } else {
+ // Non-standard extension for 4 floats
+ identifier = "PX";
+ outChannels = 4;
}
break;
default:
* Need to add/remove channels, one pixel at a time.
*/
- unsigned char *tmp = new unsigned char[width*bytesPerPixel];
+ unsigned char *tmp = new unsigned char[width*outChannels*bytesPerChannel];
if (channelType == TYPE_UNORM8) {
/*
*dst++ = 0;
}
}
- os.write((const char *)tmp, width*bytesPerPixel);
+ os.write((const char *)tmp, width*outChannels*bytesPerChannel);
}
}
info.channels = 3;
info.channelType = TYPE_FLOAT;
break;
+ case 'X':
+ info.channels = 4;
+ info.channelType = TYPE_FLOAT;
+ break;
default:
return NULL;
}