* @memberof ktxTexture1 * @~English * @brief Create a ktxTexture1 from a named KTX file. * * The address of a newly created texture reflecting the contents of the * file is written to the location pointed at by @p newTex. * * The file name must be encoded in utf-8. On Windows convert unicode names * to utf-8 with @c WideCharToMultiByte(CP_UTF8, ...) before calling. * * The create flag KT
| 712 | * For other exceptions, see ktxTexture1_CreateFromStdioStream(). |
| 713 | */ |
| 714 | KTX_error_code |
| 715 | ktxTexture1_CreateFromNamedFile(const char* const filename, |
| 716 | ktxTextureCreateFlags createFlags, |
| 717 | ktxTexture1** newTex) |
| 718 | { |
| 719 | KTX_error_code result; |
| 720 | |
| 721 | if (newTex == NULL) |
| 722 | return KTX_INVALID_VALUE; |
| 723 | |
| 724 | ktxTexture1* tex = (ktxTexture1*)malloc(sizeof(ktxTexture1)); |
| 725 | if (tex == NULL) |
| 726 | return KTX_OUT_OF_MEMORY; |
| 727 | |
| 728 | result = ktxTexture1_constructFromNamedFile(tex, filename, createFlags); |
| 729 | if (result == KTX_SUCCESS) |
| 730 | *newTex = (ktxTexture1*)tex; |
| 731 | else { |
| 732 | free(tex); |
| 733 | *newTex = NULL; |
| 734 | } |
| 735 | return result; |
| 736 | } |
| 737 | |
| 738 | /** |
| 739 | * @memberof ktxTexture1 |