.TH "ktxTexture2" 3 "Sun Jun 14 2026 18:00:57" "Version 0.0.0" "libktx Reference" \" -*- nroff -*- .ad l .nh .SH NAME ktxTexture2 \- Class representing a KTX version 2 format texture\&. .SH SYNOPSIS .br .PP .PP \fR#include \fP .SS "Public Member Functions" .in +1c .ti -1c .RI "\fBKTX_error_code\fP \fBktxTexture2_CompressAstcEx\fP (\fBktxTexture2\fP *This, \fBktxAstcParams\fP *params)" .br .RI "Encode and compress a ktx texture with uncompressed images to astc\&. " .ti -1c .RI "\fBKTX_error_code\fP \fBktxTexture2_CompressAstc\fP (\fBktxTexture2\fP *This, ktx_uint32_t quality)" .br .RI "Encode and compress a ktx texture with uncompressed images to astc\&. " .ti -1c .RI "\fBKTX_error_code\fP \fBktxTexture2_CompressBasisEx\fP (\fBktxTexture2\fP *This, \fBktxBasisParams\fP *params)" .br .RI "Encode and possibly Supercompress a KTX2 texture with uncompressed images\&. " .ti -1c .RI "\fBKTX_error_code\fP \fBktxTexture2_CompressBasis\fP (\fBktxTexture2\fP *This, ktx_uint32_t quality)" .br .RI "Supercompress a KTX2 texture with uncompressed images\&. " .ti -1c .RI "\fBKTX_error_code\fP \fBktxTexture2_TranscodeBasis\fP (\fBktxTexture2\fP *This, \fBktx_transcode_fmt_e\fP outputFormat, ktx_transcode_flags transcodeFlags)" .br .RI "Transcode a KTX2 texture with BasisLZ/ETC1S or UASTC images\&. " .ti -1c .RI "\fBKTX_error_code\fP \fBktxTexture2_GLUpload\fP (\fBktxTexture2\fP *This, GLuint *pTexture, GLenum *pTarget, GLenum *pGlerror)" .br .RI "Create a GL texture object from a \fBktxTexture2\fP object\&. " .ti -1c .RI "\fBKTX_error_code\fP \fBktxTexture2_Create\fP (const \fBktxTextureCreateInfo\fP *const createInfo, ktxTextureCreateStorageEnum storageAllocation, \fBktxTexture2\fP **newTex)" .br .RI "Create a new empty \fBktxTexture2\fP\&. " .ti -1c .RI "\fBKTX_error_code\fP \fBktxTexture2_CreateCopy\fP (\fBktxTexture2\fP *orig, \fBktxTexture2\fP **newTex)" .br .RI "Create a \fBktxTexture2\fP by making a copy of a \fBktxTexture2\fP\&. " .ti -1c .RI "\fBKTX_error_code\fP \fBktxTexture2_CreateFromStdioStream\fP (FILE *stdioStream, ktxTextureCreateFlags createFlags, \fBktxTexture2\fP **newTex)" .br .RI "Create a \fBktxTexture2\fP from a stdio stream reading from a KTX source\&. " .ti -1c .RI "\fBKTX_error_code\fP \fBktxTexture2_CreateFromNamedFile\fP (const char *const filename, ktxTextureCreateFlags createFlags, \fBktxTexture2\fP **newTex)" .br .RI "Create a \fBktxTexture2\fP from a named KTX file\&. " .ti -1c .RI "\fBKTX_error_code\fP \fBktxTexture2_CreateFromMemory\fP (const ktx_uint8_t *bytes, ktx_size_t size, ktxTextureCreateFlags createFlags, \fBktxTexture2\fP **newTex)" .br .RI "Create a \fBktxTexture2\fP from KTX-formatted data in memory\&. " .ti -1c .RI "\fBKTX_error_code\fP \fBktxTexture2_CreateFromStream\fP (\fBktxStream\fP *stream, ktxTextureCreateFlags createFlags, \fBktxTexture2\fP **newTex)" .br .RI "Create a \fBktxTexture2\fP from KTX-formatted data from a stream\&. " .ti -1c .RI "void \fBktxTexture2_Destroy\fP (\fBktxTexture2\fP *This)" .br .RI "Destroy a \fBktxTexture2\fP object\&. " .ti -1c .RI "void \fBktxTexture2_GetComponentInfo\fP (\fBktxTexture2\fP *This, uint32_t *pNumComponents, uint32_t *pComponentByteLength)" .br .RI "Return information about the components of an image in a texture\&. " .ti -1c .RI "ktx_uint32_t \fBktxTexture2_GetNumComponents\fP (\fBktxTexture2\fP *This)" .br .RI "Return the number of components in an image of the texture\&. " .ti -1c .RI "\fBKTX_error_code\fP \fBktxTexture2_GetImageOffset\fP (\fBktxTexture2\fP *This, ktx_uint32_t level, ktx_uint32_t layer, ktx_uint32_t faceSlice, ktx_size_t *pOffset)" .br .RI "Find the offset of an image within a \fBktxTexture\fP's image data\&. " .ti -1c .RI "khr_df_transfer_e \fBktxTexture2_GetTransferFunction_e\fP (\fBktxTexture2\fP *This)" .br .RI "Retrieve the transfer function of the images\&. " .ti -1c .RI "khr_df_transfer_e \fBktxTexture2_GetOETF_e\fP (\fBktxTexture2\fP *This)" .br .RI "Retrieve the transfer function of the images\&. " .ti -1c .RI "ktx_uint32_t \fBktxTexture2_GetOETF\fP (\fBktxTexture2\fP *This)" .br .RI "Retrieve the transfer function of the images\&. " .ti -1c .RI "khr_df_model_e \fBktxTexture2_GetColorModel_e\fP (\fBktxTexture2\fP *This)" .br .RI "Retrieve the DFD color model of the images\&. " .ti -1c .RI "ktx_bool_t \fBktxTexture2_GetPremultipliedAlpha\fP (\fBktxTexture2\fP *This)" .br .RI "Retrieve whether the RGB components have been premultiplied by the alpha component\&. " .ti -1c .RI "khr_df_primaries_e \fBktxTexture2_GetPrimaries_e\fP (\fBktxTexture2\fP *This)" .br .RI "Retrieve the color primaries of the images\&. " .ti -1c .RI "ktx_bool_t \fBktxTexture2_NeedsTranscoding\fP (\fBktxTexture2\fP *This)" .br .RI "Query if the images are in a transcodable format\&. " .ti -1c .RI "\fBktx_error_code_e\fP \fBktxTexture2_SetOETF\fP (\fBktxTexture2\fP *This, khr_df_transfer_e tf)" .br .RI "Set the transfer function for the images in a texture\&. " .ti -1c .RI "\fBktx_error_code_e\fP \fBktxTexture2_SetPrimaries\fP (\fBktxTexture2\fP *This, khr_df_primaries_e primaries)" .br .RI "Set the primaries for the images in a texture\&. " .ti -1c .RI "ktx_size_t \fBktxTexture2_GetDataSizeUncompressed\fP (\fBktxTexture2\fP *This)" .br .RI "Return the total size in bytes of the uncompressed data of a \fBktxTexture2\fP\&. " .ti -1c .RI "ktx_size_t \fBktxTexture2_GetImageSize\fP (\fBktxTexture2\fP *This, ktx_uint32_t level)" .br .RI "Calculate & return the size in bytes of an image at the specified mip level\&. " .ti -1c .RI "ktx_size_t \fBktxTexture2_GetLevelSize\fP (\fBktxTexture2\fP *This, ktx_uint32_t level)" .br .RI "Calculate & return the size in bytes of all the images in the specified mip level\&. " .ti -1c .RI "\fBKTX_error_code\fP \fBktxTexture2_IterateLevels\fP (\fBktxTexture2\fP *This, PFNKTXITERCB iterCb, void *userdata)" .br .RI "Iterate over the mip levels in a \fBktxTexture2\fP object\&. " .ti -1c .RI "\fBKTX_error_code\fP \fBktxTexture2_IterateLoadLevelFaces\fP (\fBktxTexture2\fP *This, PFNKTXITERCB iterCb, void *userdata)" .br .RI "Iterate over the images in a \fBktxTexture2\fP object while loading the image data\&. " .ti -1c .RI "\fBktx_error_code_e\fP \fBktxTexture2_LoadImageData\fP (\fBktxTexture2\fP *This, ktx_uint8_t *pBuffer, ktx_size_t bufSize)" .br .RI "Load all the image data from the \fBktxTexture2\fP's source\&. " .ti -1c .RI "\fBktx_error_code_e\fP \fBktxTexture2_LoadDeflatedImageData\fP (\fBktxTexture2\fP *This, ktx_uint8_t *pBuffer, ktx_size_t bufSize)" .br .RI "Load all the image data from the \fBktxTexture2\fP's source without inflatiion\&.\&. " .ti -1c .RI "\fBKTX_error_code\fP \fBktxTexture2_VkUploadEx_WithSuballocator\fP (\fBktxTexture2\fP *This, \fBktxVulkanDeviceInfo\fP *vdi, \fBktxVulkanTexture\fP *vkTexture, VkImageTiling tiling, VkImageUsageFlags usageFlags, VkImageLayout finalLayout, \fBktxVulkanTexture_subAllocatorCallbacks\fP *subAllocatorCallbacks)" .br .RI "Create a Vulkan image object from a \fBktxTexture2\fP object\&. " .ti -1c .RI "\fBKTX_error_code\fP \fBktxTexture2_VkUploadEx\fP (\fBktxTexture2\fP *This, \fBktxVulkanDeviceInfo\fP *vdi, \fBktxVulkanTexture\fP *vkTexture, VkImageTiling tiling, VkImageUsageFlags usageFlags, VkImageLayout finalLayout)" .br .RI "Create a Vulkan image object from a \fBktxTexture2\fP object\&. " .ti -1c .RI "\fBKTX_error_code\fP \fBktxTexture2_VkUpload\fP (\fBktxTexture2\fP *This, \fBktxVulkanDeviceInfo\fP *vdi, \fBktxVulkanTexture\fP *vkTexture)" .br .RI "Create a Vulkan image object from a \fBktxTexture2\fP object\&. " .ti -1c .RI "VkFormat \fBktxTexture2_GetVkFormat\fP (\fBktxTexture2\fP *This)" .br .RI "Return the VkFormat enum of a \fBktxTexture2\fP object\&. " .ti -1c .RI "\fBKTX_error_code\fP \fBktxTexture2_SetImageFromStdioStream\fP (\fBktxTexture2\fP *This, ktx_uint32_t level, ktx_uint32_t layer, ktx_uint32_t faceSlice, FILE *src, ktx_size_t srcSize)" .br .RI "Set image for level, layer, faceSlice from a stdio stream source\&. " .ti -1c .RI "\fBKTX_error_code\fP \fBktxTexture2_SetImageFromMemory\fP (\fBktxTexture2\fP *This, ktx_uint32_t level, ktx_uint32_t layer, ktx_uint32_t faceSlice, const ktx_uint8_t *src, ktx_size_t srcSize)" .br .RI "Set image for level, layer, faceSlice from an image in memory\&. " .ti -1c .RI "\fBKTX_error_code\fP \fBktxTexture2_WriteToStream\fP (\fBktxTexture2\fP *This, \fBktxStream\fP *dststr)" .br .RI "Write a \fBktxTexture\fP object to a \fBktxStream\fP in KTX format\&. " .ti -1c .RI "\fBKTX_error_code\fP \fBktxTexture2_WriteToStdioStream\fP (\fBktxTexture2\fP *This, FILE *dstsstr)" .br .RI "Write a \fBktxTexture\fP object to a stdio stream in KTX format\&. " .ti -1c .RI "\fBKTX_error_code\fP \fBktxTexture2_WriteToNamedFile\fP (\fBktxTexture2\fP *This, const char *const dstname)" .br .RI "Write a \fBktxTexture\fP object to a named file in KTX format\&. " .ti -1c .RI "\fBKTX_error_code\fP \fBktxTexture2_WriteToMemory\fP (\fBktxTexture2\fP *This, ktx_uint8_t **ppDstBytes, ktx_size_t *pSize)" .br .RI "Write a \fBktxTexture\fP object to block of memory in KTX format\&. " .ti -1c .RI "\fBKTX_error_code\fP \fBktxTexture2_DeflateZstd\fP (\fBktxTexture2\fP *This, ktx_uint32_t compressionLevel)" .br .RI "Deflate the data in a \fBktxTexture2\fP object using Zstandard\&. " .ti -1c .RI "\fBKTX_error_code\fP \fBktxTexture2_DeflateZLIB\fP (\fBktxTexture2\fP *This, ktx_uint32_t compressionLevel)" .br .RI "Deflate the data in a \fBktxTexture2\fP object using miniz (ZLIB)\&. " .in -1c .SS "Data Fields" .in +1c .ti -1c .RI "struct ktxTexture2_private * \fB_private\fP" .br .in -1c .SH "Detailed Description" .PP Class representing a KTX version 2 format texture\&. ktxTextures should be created only by one of the ktxTexture_Create* functions and these fields should be considered read-only\&. .PP \fBExamples\fP .in +1c \fBglloader\&.c\fP\&. .SH "Field Documentation" .PP .SS "struct ktxTexture2_private* _private" Private data\&. .SH "Author" .PP Generated automatically by Doxygen for libktx Reference from the source code\&.