* @memberof ktxTexture1 * @~English * @brief Create a ktxTexture1 from KTX-formatted data from a `ktxStream`. * * The address of a newly created texture reflecting the contents of the * serialized KTX data is written to the location pointed at by @p newTex. * * The create flag KTX_TEXTURE_CREATE_LOAD_IMAGE_DATA_BIT should not be set, * if the ktxTexture1 is ultimately to be uploaded to Ope
| 815 | * For exceptions, see ktxTexture1_CreateFromStdioStream(). |
| 816 | */ |
| 817 | KTX_error_code |
| 818 | ktxTexture1_CreateFromStream(ktxStream* pStream, |
| 819 | ktxTextureCreateFlags createFlags, |
| 820 | ktxTexture1** newTex) |
| 821 | { |
| 822 | KTX_error_code result; |
| 823 | if (newTex == NULL) |
| 824 | return KTX_INVALID_VALUE; |
| 825 | |
| 826 | ktxTexture1* tex = (ktxTexture1*)malloc(sizeof(ktxTexture1)); |
| 827 | if (tex == NULL) |
| 828 | return KTX_OUT_OF_MEMORY; |
| 829 | |
| 830 | result = ktxTexture1_constructFromStream(tex, pStream, createFlags); |
| 831 | if (result == KTX_SUCCESS) |
| 832 | *newTex = (ktxTexture1*)tex; |
| 833 | else { |
| 834 | free(tex); |
| 835 | *newTex = NULL; |
| 836 | } |
| 837 | return result; |
| 838 | } |
| 839 | |
| 840 | /** |
| 841 | * @memberof ktxTexture1 |