libktx - The KTX Library 4.1.0
Libraries and tools to create and read KTX image texture files.
ktxTexture2 Class Reference

Class representing a KTX version 2 format texture. More...

#include <ktx.h>

Public Member Functions

KTX_error_code ktxTexture2_CompressAstcEx (ktxTexture2 *This, ktxAstcParams *params)
 Encode and compress a ktx texture with uncompressed images to astc. More...
 
KTX_error_code ktxTexture2_CompressAstc (ktxTexture2 *This, ktx_uint32_t quality)
 Encode and compress a ktx texture with uncompressed images to astc. More...
 
KTX_error_code ktxTexture2_CompressBasisEx (ktxTexture2 *This, ktxBasisParams *params)
 Encode and possibly Supercompress a KTX2 texture with uncompressed images. More...
 
KTX_error_code ktxTexture2_CompressBasis (ktxTexture2 *This, ktx_uint32_t quality)
 Supercompress a KTX2 texture with uncompressed images. More...
 
KTX_error_code ktxTexture2_TranscodeBasis (ktxTexture2 *This, ktx_transcode_fmt_e outputFormat, ktx_transcode_flags transcodeFlags)
 Transcode a KTX2 texture with BasisLZ/ETC1S or UASTC images. More...
 
KTX_error_code ktxTexture2_GLUpload (ktxTexture2 *This, GLuint *pTexture, GLenum *pTarget, GLenum *pGlerror)
 Create a GL texture object from a ktxTexture2 object. More...
 
KTX_error_code ktxTexture2_Create (ktxTextureCreateInfo *createInfo, ktxTextureCreateStorageEnum storageAllocation, ktxTexture2 **newTex)
 Create a new empty ktxTexture2. More...
 
KTX_error_code ktxTexture2_CreateCopy (ktxTexture2 *orig, ktxTexture2 **newTex)
 Create a ktxTexture2 by making a copy of a ktxTexture2. More...
 
KTX_error_code ktxTexture2_CreateFromStdioStream (FILE *stdioStream, ktxTextureCreateFlags createFlags, ktxTexture2 **newTex)
 Create a ktxTexture2 from a stdio stream reading from a KTX source. More...
 
KTX_error_code ktxTexture2_CreateFromNamedFile (const char *const filename, ktxTextureCreateFlags createFlags, ktxTexture2 **newTex)
 Create a ktxTexture2 from a named KTX file. More...
 
KTX_error_code ktxTexture2_CreateFromMemory (const ktx_uint8_t *bytes, ktx_size_t size, ktxTextureCreateFlags createFlags, ktxTexture2 **newTex)
 Create a ktxTexture2 from KTX-formatted data in memory. More...
 
KTX_error_code ktxTexture2_CreateFromStream (ktxStream *stream, ktxTextureCreateFlags createFlags, ktxTexture2 **newTex)
 Create a ktxTexture2 from KTX-formatted data from a stream. More...
 
void ktxTexture2_Destroy (ktxTexture2 *This)
 Destroy a ktxTexture2 object. More...
 
void ktxTexture2_GetComponentInfo (ktxTexture2 *This, uint32_t *pNumComponents, uint32_t *pComponentByteLength)
 Return information about the components of an image in a texture. More...
 
ktx_uint32_t ktxTexture2_GetNumComponents (ktxTexture2 *This)
 Return the number of components in an image of the texture. More...
 
KTX_error_code ktxTexture2_GetImageOffset (ktxTexture2 *This, ktx_uint32_t level, ktx_uint32_t layer, ktx_uint32_t faceSlice, ktx_size_t *pOffset)
 Find the offset of an image within a ktxTexture's image data. More...
 
ktx_uint32_t ktxTexture2_GetOETF (ktxTexture2 *This)
 Retrieve the opto-electrical transfer function of the images. More...
 
ktx_bool_t ktxTexture2_GetPremultipliedAlpha (ktxTexture2 *This)
 Retrieve whether the RGB components have been premultiplied by the alpha component. More...
 
ktx_bool_t ktxTexture2_NeedsTranscoding (ktxTexture2 *This)
 Query if the texture is in a transcodable format. More...
 
ktx_size_t ktxTexture2_GetDataSizeUncompressed (ktxTexture2 *This)
 Return the total size in bytes of the uncompressed data of a ktxTexture2. More...
 
ktx_size_t ktxTexture2_GetImageSize (ktxTexture2 *This, ktx_uint32_t level)
 Calculate & return the size in bytes of an image at the specified mip level. More...
 
KTX_error_code ktxTexture2_IterateLoadLevelFaces (ktxTexture2 *This, PFNKTXITERCB iterCb, void *userdata)
 Iterate over the images in a ktxTexture2 object while loading the image data. More...
 
KTX_error_code ktxTexture2_LoadImageData (ktxTexture2 *This, ktx_uint8_t *pBuffer, ktx_size_t bufSize)
 Load all the image data from the ktxTexture2's source. More...
 
KTX_error_code ktxTexture2_VkUploadEx (ktxTexture2 *This, ktxVulkanDeviceInfo *vdi, ktxVulkanTexture *vkTexture, VkImageTiling tiling, VkImageUsageFlags usageFlags, VkImageLayout finalLayout)
 Create a Vulkan image object from a ktxTexture2 object. More...
 
KTX_error_code ktxTexture2_VkUpload (ktxTexture2 *This, ktxVulkanDeviceInfo *vdi, ktxVulkanTexture *vkTexture)
 Create a Vulkan image object from a ktxTexture2 object. More...
 
VkFormat ktxTexture2_GetVkFormat (ktxTexture2 *This)
 Return the VkFormat enum of a ktxTexture2 object. More...
 
KTX_error_code ktxTexture2_SetImageFromStdioStream (ktxTexture2 *This, ktx_uint32_t level, ktx_uint32_t layer, ktx_uint32_t faceSlice, FILE *src, ktx_size_t srcSize)
 Set image for level, layer, faceSlice from a stdio stream source. More...
 
KTX_error_code ktxTexture2_SetImageFromMemory (ktxTexture2 *This, ktx_uint32_t level, ktx_uint32_t layer, ktx_uint32_t faceSlice, const ktx_uint8_t *src, ktx_size_t srcSize)
 Set image for level, layer, faceSlice from an image in memory. More...
 
KTX_error_code ktxTexture2_WriteToStream (ktxTexture2 *This, ktxStream *dststr)
 Write a ktxTexture object to a ktxStream in KTX format. More...
 
KTX_error_code ktxTexture2_WriteToStdioStream (ktxTexture2 *This, FILE *dstsstr)
 Write a ktxTexture object to a stdio stream in KTX format. More...
 
KTX_error_code ktxTexture2_WriteToNamedFile (ktxTexture2 *This, const char *const dstname)
 Write a ktxTexture object to a named file in KTX format. More...
 
KTX_error_code ktxTexture2_WriteToMemory (ktxTexture2 *This, ktx_uint8_t **ppDstBytes, ktx_size_t *pSize)
 Write a ktxTexture object to block of memory in KTX format. More...
 
KTX_error_code ktxTexture2_DeflateZstd (ktxTexture2 *This, ktx_uint32_t compressionLevel)
 Deflate the data in a ktxTexture2 object using Zstandard. More...
 

Data Fields

struct ktxTexture2_private * _private
 

Detailed Description

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.

Examples
glloader.c.

Field Documentation

◆ _private

struct ktxTexture2_private* ktxTexture2::_private

Private data.