MCPcopy Create free account
hub / github.com/KhronosGroup/KTX-Software / ktxTexture1_CreateFromNamedFile

Function ktxTexture1_CreateFromNamedFile

lib/texture1.c:714–736  ·  view source on GitHub ↗

* @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

Source from the content-addressed store, hash-verified

712 * For other exceptions, see ktxTexture1_CreateFromStdioStream().
713 */
714KTX_error_code
715ktxTexture1_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

Callers 2

TESTFunction · 0.85

Calls 1

Tested by 1

TESTFunction · 0.68