libktx Reference 4.3.2
Libraries and tools to create and read KTX image texture files.
|
Base class representing a texture. More...
#include <ktx.h>
Public Types | |
enum | ktxTextureCreateStorageEnum |
Enum for requesting, or not, allocation of storage for images. More... | |
enum | ktxTextureCreateFlagBits |
Flags for requesting services during creation. More... | |
typedef KTX_error_code(* | PFNKTXITERCB) (int miplevel, int face, int width, int height, int depth, ktx_uint64_t faceLodSize, void *pixels, void *userdata) |
Signature of function called by the ktxTexture_Iterate* functions to receive image data. | |
typedef ktx_uint32_t | ktxTextureCreateFlags |
Type for TextureCreateFlags parameters. | |
Public Member Functions | |
KTX_error_code | ktxTexture_GLUpload (ktxTexture *This, GLuint *pTexture, GLenum *pTarget, GLenum *pGlerror) |
Create a GL texture object from a ktxTexture1 object. | |
KTX_error_code | ktxTexture_CreateFromStream (ktxStream *pStream, ktxTextureCreateFlags createFlags, ktxTexture **newTex) |
Create a ktx1 or ktx2 texture according to the stream data. | |
KTX_error_code | ktxTexture_CreateFromStdioStream (FILE *stdioStream, ktxTextureCreateFlags createFlags, ktxTexture **newTex) |
Create a ktxTexture1 or ktxTexture2 from a stdio stream according to the stream data. | |
KTX_error_code | ktxTexture_CreateFromNamedFile (const char *const filename, ktxTextureCreateFlags createFlags, ktxTexture **newTex) |
Create a ktxTexture1 or ktxTexture2 from a named KTX file according to the file contents. | |
KTX_error_code | ktxTexture_CreateFromMemory (const ktx_uint8_t *bytes, ktx_size_t size, ktxTextureCreateFlags createFlags, ktxTexture **newTex) |
Create a ktxTexture1 or ktxTexture2 from KTX-formatted data in memory according to the data contents. | |
ktx_uint8_t * | ktxTexture_GetData (ktxTexture *This) |
Return a pointer to the texture image data. | |
ktx_size_t | ktxTexture_GetDataSize (ktxTexture *This) |
Return the total size of the texture image data in bytes. | |
ktx_uint32_t | ktxTexture_GetElementSize (ktxTexture *This) |
Return the size in bytes of an elements of a texture's images. | |
KTX_error_code | ktxTexture_IterateLevelFaces (ktxTexture *This, PFNKTXITERCB iterCb, void *userdata) |
Iterate over the levels or faces in a ktxTexture object. | |
ktx_uint32_t | ktxTexture_GetRowPitch (ktxTexture *This, ktx_uint32_t level) |
Return pitch betweeb rows of a texture image level in bytes. | |
KTX_error_code | ktxTexture_VkUploadEx_WithSuballocator (ktxTexture *This, ktxVulkanDeviceInfo *vdi, ktxVulkanTexture *vkTexture, VkImageTiling tiling, VkImageUsageFlags usageFlags, VkImageLayout finalLayout, ktxVulkanTexture_subAllocatorCallbacks *subAllocatorCallbacks) |
Create a Vulkan image object from a ktxTexture object. | |
KTX_error_code | ktxTexture_VkUploadEx (ktxTexture *This, ktxVulkanDeviceInfo *vdi, ktxVulkanTexture *vkTexture, VkImageTiling tiling, VkImageUsageFlags usageFlags, VkImageLayout finalLayout) |
Create a Vulkan image object from a ktxTexture object. | |
KTX_error_code | ktxTexture_VkUpload (ktxTexture *texture, ktxVulkanDeviceInfo *vdi, ktxVulkanTexture *vkTexture) |
Create a Vulkan image object from a ktxTexture object. | |
VkFormat | ktxTexture_GetVkFormat (ktxTexture *This) |
Return the VkFormat enum of a ktxTexture object. | |
Static Public Member Functions | |
static ktxAstcParams | astcDefaultOptions () |
Creates default ASTC parameters. | |
static VkFormat | astcVkFormat (ktx_uint32_t block_size, bool sRGB) |
Should be used to get VkFormat from ASTC block enum. | |
static astcenc_profile | astcEncoderAction (const ktxAstcParams ¶ms, const uint32_t *bdb) |
Creates valid ASTC encoder action from string. | |
static astcenc_swizzle | astcSwizzle (const ktxAstcParams ¶ms) |
Creates valid ASTC encoder swizzle from string. | |
Data Fields | |
class_id | classId |
Identify the class type. | |
struct ktxTexture_vtbl * | vtbl |
Pointer to the class's vtble. | |
struct ktxTexture_vvtbl * | vvtbl |
Pointer to the class's vtble for Vulkan functions. | |
struct ktxTexture_protected * | _protected |
Opaque pointer to the class's protected variables. | |
ktx_bool_t | isArray |
ktx_bool_t | isCubemap |
ktx_bool_t | generateMipmaps |
ktx_uint32_t | baseWidth |
Width of the texture's base level. | |
ktx_uint32_t | baseHeight |
Height of the texture's base level. | |
ktx_uint32_t | baseDepth |
Depth of the texture's base level. | |
ktx_uint32_t | numDimensions |
Number of dimensions in the texture: 1, 2 or 3. | |
ktx_uint32_t | numLevels |
Number of mip levels in the texture. | |
ktx_uint32_t | numFaces |
Number of faces: 6 for cube maps, 1 otherwise. | |
struct { | |
} | orientation |
Describes the logical orientation of the images in each dimension. | |
ktxHashList | kvDataHead |
Head of the hash list of metadata. | |
ktx_uint32_t | kvDataLen |
Length of the metadata, if it has been extracted in its raw form, otherwise 0. | |
ktx_uint8_t * | kvData |
Pointer to the metadata, if it has been extracted in its raw form, otherwise NULL. | |
ktx_size_t | dataSize |
Byte length of the texture's uncompressed image data. | |
ktx_uint8_t * | pData |
Pointer to the start of the image data. | |
Base class representing a texture.
ktxTextures should be created only by one of the provided functions and these fields should be considered read-only.
typedef ktx_uint32_t ktxTextureCreateFlags |
Type for TextureCreateFlags parameters.
typedef KTX_error_code(* PFNKTXITERCB) (int miplevel, int face, int width, int height, int depth, ktx_uint64_t faceLodSize, void *pixels, void *userdata) |
Signature of function called by the ktxTexture_Iterate*
functions to receive image data.
The function parameters are used to pass values which change for each image. Obtain values which are uniform across all images from the ktxTexture
object.
[in] | miplevel | MIP level from 0 to the max level which is dependent on the texture size. |
[in] | face | usually 0; for cube maps, one of the 6 cube faces in the order +X, -X, +Y, -Y, +Z, -Z, 0 to 5. |
[in] | width | width of the image. |
[in] | height | height of the image or, for 1D textures textures, 1. |
[in] | depth | depth of the image or, for 1D & 2D textures, 1. |
[in] | faceLodSize | number of bytes of data pointed at by pixels . |
[in] | pixels | pointer to the image data. |
[in,out] | userdata | pointer for the application to pass data to and from the callback function. |
Flags for requesting services during creation.
Enum for requesting, or not, allocation of storage for images.
|
static |
Creates default ASTC parameters.
|
static |
Creates valid ASTC encoder action from string.
|
static |
Creates valid ASTC encoder swizzle from string.
|
static |
Should be used to get VkFormat from ASTC block enum.
baseWidth |
Width of the texture's base level.
n
classId |
Identify the class type.
Since there are no public ktxTexture constructors, this can only have values of ktxTexture1_c or ktxTexture2_c.
generateMipmaps |
KTX_TRUE if mipmaps should be generated for the texture by ktxTexture_GLUpload() or ktxTexture_VkUpload().
isArray |
KTX_TRUE if the texture is an array texture, i.e, a GL_TEXTURE_*_ARRAY target is to be used.
isCubemap |
KTX_TRUE if the texture is a cubemap or cubemap array.
KTX_TRUE if the texture's format is a block compressed format.
numLevels |
Number of mip levels in the texture.
Number of array layers in the texture.
Must be 1, if generateMipmaps
is KTX_TRUE. Can be less than a full pyramid but always starts at the base level.
orientation |
Describes the logical orientation of the images in each dimension.
ktxOrientationX for X, ktxOrientationY for Y and ktxOrientationZ for Z.
vvtbl |
Pointer to the class's vtble for Vulkan functions.
A separate vtble is used so this header does not need to include vulkan.h.