Saves the current image based on the extension given in FileName. ! \param FileName Ansi or Unicode string, depending on the compiled version of DevIL, that gives the filename to save to. \return Boolean value of failure or success. Returns IL_FALSE if saving failed.*/
| 2525 | the filename to save to. |
| 2526 | \return Boolean value of failure or success. Returns IL_FALSE if saving failed.*/ |
| 2527 | ILboolean ILAPIENTRY ilSaveImage(ILconst_string FileName) |
| 2528 | { |
| 2529 | ILstring Ext; |
| 2530 | ILboolean bRet = IL_FALSE; |
| 2531 | |
| 2532 | if (FileName == NULL || ilStrLen(FileName) < 1) { |
| 2533 | ilSetError(IL_INVALID_PARAM); |
| 2534 | return IL_FALSE; |
| 2535 | } |
| 2536 | |
| 2537 | if (iCurImage == NULL) { |
| 2538 | ilSetError(IL_ILLEGAL_OPERATION); |
| 2539 | return IL_FALSE; |
| 2540 | } |
| 2541 | |
| 2542 | Ext = iGetExtension(FileName); |
| 2543 | if (Ext == NULL) { |
| 2544 | ilSetError(IL_INVALID_PARAM); |
| 2545 | return IL_FALSE; |
| 2546 | } |
| 2547 | |
| 2548 | #ifndef IL_NO_BMP |
| 2549 | if (!iStrCmp(Ext, IL_TEXT("bmp"))) { |
| 2550 | bRet = ilSaveBmp(FileName); |
| 2551 | goto finish; |
| 2552 | } |
| 2553 | #endif |
| 2554 | |
| 2555 | #ifndef IL_NO_CHEAD |
| 2556 | if (!iStrCmp(Ext, IL_TEXT("h"))) { |
| 2557 | bRet = ilSaveCHeader(FileName, (char*)"IL_IMAGE"); |
| 2558 | goto finish; |
| 2559 | } |
| 2560 | #endif |
| 2561 | |
| 2562 | #ifndef IL_NO_DDS |
| 2563 | if (!iStrCmp(Ext, IL_TEXT("dds"))) { |
| 2564 | bRet = ilSaveDds(FileName); |
| 2565 | goto finish; |
| 2566 | } |
| 2567 | #endif |
| 2568 | |
| 2569 | #ifndef IL_NO_EXR |
| 2570 | if (!iStrCmp(Ext, IL_TEXT("exr"))) { |
| 2571 | bRet = ilSaveExr(FileName); |
| 2572 | goto finish; |
| 2573 | } |
| 2574 | #endif |
| 2575 | |
| 2576 | #ifndef IL_NO_HDR |
| 2577 | if (!iStrCmp(Ext, IL_TEXT("hdr"))) { |
| 2578 | bRet = ilSaveHdr(FileName); |
| 2579 | goto finish; |
| 2580 | } |
| 2581 | #endif |
| 2582 | |
| 2583 | #ifndef IL_NO_JP2 |
| 2584 | if (!iStrCmp(Ext, IL_TEXT("jp2"))) { |
nothing calls this directly
no test coverage detected