Attempts to load an image from a file with various different methods before failing - very generic. ! The ilLoadImage function allows a general interface to the specific internal file-loading routines. First, it finds the extension and checks to see if any user-registered functions (registered through ilRegisterLoad) match the extension. If nothing matches, it takes the extension and determine
| 1805 | \return Boolean value of failure or success. Returns IL_FALSE if all three loading methods |
| 1806 | have been tried and failed.*/ |
| 1807 | ILboolean ILAPIENTRY ilLoadImage(ILconst_string FileName) |
| 1808 | { |
| 1809 | ILstring Ext; |
| 1810 | ILenum Type; |
| 1811 | ILboolean bRet = IL_FALSE; |
| 1812 | |
| 1813 | if (iCurImage == NULL) { |
| 1814 | ilSetError(IL_ILLEGAL_OPERATION); |
| 1815 | return IL_FALSE; |
| 1816 | } |
| 1817 | |
| 1818 | if (FileName == NULL || ilStrLen(FileName) < 1) { |
| 1819 | ilSetError(IL_INVALID_PARAM); |
| 1820 | return IL_FALSE; |
| 1821 | } |
| 1822 | |
| 1823 | Ext = iGetExtension(FileName); |
| 1824 | |
| 1825 | // Try registered procedures first (so users can override default lib functions). |
| 1826 | if (Ext) { |
| 1827 | if (iRegisterLoad(FileName)) |
| 1828 | return IL_TRUE; |
| 1829 | |
| 1830 | #ifndef IL_NO_TGA |
| 1831 | if (!iStrCmp(Ext, IL_TEXT("tga")) || !iStrCmp(Ext, IL_TEXT("vda")) || |
| 1832 | !iStrCmp(Ext, IL_TEXT("icb")) || !iStrCmp(Ext, IL_TEXT("vst"))) { |
| 1833 | bRet = ilLoadTarga(FileName); |
| 1834 | goto finish; |
| 1835 | } |
| 1836 | #endif |
| 1837 | |
| 1838 | #ifndef IL_NO_JPG |
| 1839 | if (!iStrCmp(Ext, IL_TEXT("jpg")) || !iStrCmp(Ext, IL_TEXT("jpe")) || |
| 1840 | !iStrCmp(Ext, IL_TEXT("jpeg")) || !iStrCmp(Ext, IL_TEXT("jif")) || !iStrCmp(Ext, IL_TEXT("jfif"))) { |
| 1841 | bRet = ilLoadJpeg(FileName); |
| 1842 | goto finish; |
| 1843 | } |
| 1844 | #endif |
| 1845 | |
| 1846 | #ifndef IL_NO_JP2 |
| 1847 | if (!iStrCmp(Ext, IL_TEXT("jp2")) || !iStrCmp(Ext, IL_TEXT("jpx")) || |
| 1848 | !iStrCmp(Ext, IL_TEXT("j2k")) || !iStrCmp(Ext, IL_TEXT("j2c"))) { |
| 1849 | bRet = ilLoadJp2(FileName); |
| 1850 | goto finish; |
| 1851 | } |
| 1852 | #endif |
| 1853 | |
| 1854 | #ifndef IL_NO_DDS |
| 1855 | if (!iStrCmp(Ext, IL_TEXT("dds"))) { |
| 1856 | bRet = ilLoadDds(FileName); |
| 1857 | goto finish; |
| 1858 | } |
| 1859 | #endif |
| 1860 | |
| 1861 | #ifndef IL_NO_PNG |
| 1862 | if (!iStrCmp(Ext, IL_TEXT("png"))) { |
| 1863 | bRet = ilLoadPng(FileName); |
| 1864 | goto finish; |
nothing calls this directly
no test coverage detected