-static inline int
-rgbaf2argb(float r, float g, float b, float a)
-{
- quint8 rb = r * 255;
- quint8 gb = g * 255;
- quint8 bb = b * 255;
- quint8 ab = a * 255;
+ /*
+ * Detect the PNG vs PFM images.
+ */
+ const char pngSignature[] = {(char)0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A, 0};
+ if (dataArray.startsWith(pngSignature)) {
+ ByteArrayBuf buf(dataArray);
+ std::istream istr(&buf);
+ image = image::readPNG(istr);
+ } else {
+ image = image::readPNM(dataArray.data(), dataArray.size());
+ }