| 7369 | // @deprecated |
| 7370 | #if 0 |
| 7371 | int SaveEXR(const float *in_rgba, int width, int height, const char *filename, |
| 7372 | const char **err) { |
| 7373 | if (in_rgba == NULL || filename == NULL) { |
| 7374 | if (err) { |
| 7375 | (*err) = "Invalid argument."; |
| 7376 | } |
| 7377 | return -1; |
| 7378 | } |
| 7379 | |
| 7380 | FILE *fp = fopen(filename, "wb"); |
| 7381 | if (!fp) { |
| 7382 | if (err) { |
| 7383 | (*err) = "Cannot write a file."; |
| 7384 | } |
| 7385 | return -1; |
| 7386 | } |
| 7387 | |
| 7388 | // Header |
| 7389 | { |
| 7390 | const char header[] = {0x76, 0x2f, 0x31, 0x01}; |
| 7391 | size_t n = fwrite(header, 1, 4, fp); |
| 7392 | assert(n == 4); |
| 7393 | } |
| 7394 | |
| 7395 | // Version, scanline. |
| 7396 | { |
| 7397 | const char marker[] = {2, 0, 0, 0}; |
| 7398 | size_t n = fwrite(marker, 1, 4, fp); |
| 7399 | assert(n == 4); |
| 7400 | } |
| 7401 | |
| 7402 | int numScanlineBlocks = 16; // 16 for ZIP compression. |
| 7403 | |
| 7404 | // Write attributes. |
| 7405 | { |
| 7406 | unsigned char data[] = { |
| 7407 | 'A', 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 'B', |
| 7408 | 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 'G', 0, |
| 7409 | 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 'R', 0, 1, |
| 7410 | 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0}; // last 0 = |
| 7411 | // terminator. |
| 7412 | |
| 7413 | WriteAttribute(fp, "channels", "chlist", data, 18 * 4 + 1); // +1 = null |
| 7414 | } |
| 7415 | |
| 7416 | { |
| 7417 | int compressionType = 3; // ZIP compression |
| 7418 | WriteAttribute(fp, "compression", "compression", |
| 7419 | reinterpret_cast<const unsigned char *>(&compressionType), |
| 7420 | 1); |
| 7421 | } |
| 7422 | |
| 7423 | { |
| 7424 | int data[4] = {0, 0, width - 1, height - 1}; |
| 7425 | WriteAttribute(fp, "dataWindow", "box2i", |
| 7426 | reinterpret_cast<const unsigned char *>(data), |
| 7427 | sizeof(int) * 4); |
| 7428 | WriteAttribute(fp, "displayWindow", "box2i", |
nothing calls this directly
no test coverage detected