* @memberof ktxTexture2 @private * @~English * @brief Construct a ktxTexture from a named KTX file. * * The file name must be encoded in utf-8. On Windows convert unicode names * to utf-8 with @c WideCharToMultiByte(CP_UTF8, ...) before calling. * * See ktxTextureInt_constructFromStream for details. * * @param[in] This pointer to a ktxTextureInt-sized block of memory to *
| 1167 | * For other exceptions, see ktxTexture_constructFromStream(). |
| 1168 | */ |
| 1169 | static KTX_error_code |
| 1170 | ktxTexture2_constructFromNamedFile(ktxTexture2* This, |
| 1171 | const char* const filename, |
| 1172 | ktxTextureCreateFlags createFlags) |
| 1173 | { |
| 1174 | KTX_error_code result; |
| 1175 | ktxStream stream; |
| 1176 | FILE* file; |
| 1177 | |
| 1178 | if (This == NULL || filename == NULL) |
| 1179 | return KTX_INVALID_VALUE; |
| 1180 | |
| 1181 | file = ktxFOpenUTF8(filename, "rb"); |
| 1182 | if (!file) |
| 1183 | return KTX_FILE_OPEN_FAILED; |
| 1184 | |
| 1185 | result = ktxFileStream_construct(&stream, file, KTX_TRUE); |
| 1186 | if (result == KTX_SUCCESS) |
| 1187 | result = ktxTexture2_constructFromStream(This, &stream, createFlags); |
| 1188 | |
| 1189 | return result; |
| 1190 | } |
| 1191 | |
| 1192 | /** |
| 1193 | * @memberof ktxTexture2 @private |
no test coverage detected