Kanzi Graphics Engine
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
kzu_image_texture.h File Reference

2D image texture. More...

Functions

kzsError kzuImageTextureCreate (const struct KzuResourceManager *resourceManager, kzString name, struct KzuResourceLoader *loader, struct KzuImageTexture **out_imageTexture)
 Creates a 2D image texture that loads the data when needed using the given resource loader. More...
 
kzsError kzuImageTextureRegisterToFactory (const struct KzuFactory *factory)
 Registers image texture type to the factory. More...
 
kzsError kzuImageTextureCreateFromImage (const struct KzuResourceManager *resourceManager, kzString name, const struct KzcImage *image, enum KzuTextureFilter filter, enum KzuTextureWrap wrap, kzFloat anisotropy, struct KzuImageTexture **out_imageTexture)
 Creates a 2D image texture from the given image. More...
 
kzsError kzuImageTextureCreateFromMemory (const struct KzuResourceManager *resourceManager, kzString name, enum KzuTextureChannels channels, kzUint width, kzUint height, const kzByte *data, enum KzuTextureFilter filter, enum KzuTextureWrap wrap, kzFloat anisotropy, struct KzuImageTexture **out_imageTexture)
 Creates a 2D image texture from a byte array. More...
 
kzsError kzuImageTextureInitializeFromImage (struct KzuImageTexture *imageTexture, const struct KzcImage *image, enum KzuTextureFilter filter, enum KzuTextureWrap wrap, kzFloat anisotropy)
 Initializes a 2D image texture from an image with the given arguments. More...
 
kzsError kzuImageTextureInitializeFromMemory (struct KzuImageTexture *imageTexture, enum KzuTextureChannels channels, kzUint width, kzUint height, const kzByte *data, enum KzuTextureFilter filter, enum KzuTextureWrap wrap, kzFloat anisotropy)
 Initializes a 2D image texture from memory with the given arguments. More...
 
struct KzuTexturekzuImageTextureToTexture (const struct KzuImageTexture *imageTexture)
 Converts 2D image texture to texture. More...
 
struct KzuImageTexturekzuImageTextureFromTexture (const struct KzuTexture *texture)
 Converts texture to 2D image texture. More...
 
struct KzuGPUResourcekzuImageTextureToGPUResource (const struct KzuImageTexture *imageTexture)
 Converts 2D image texture to GPU resource. More...
 
struct KzuImageTexturekzuImageTextureFromGPUResource (const struct KzuGPUResource *gpuResource)
 Converts GPU resource to 2D image texture. More...
 
struct KzuResourcekzuImageTextureToResource (const struct KzuImageTexture *imageTexture)
 Converts 2D image texture to resource. More...
 
struct KzuImageTexturekzuImageTextureFromResource (const struct KzuResource *resource)
 Converts resource to 2D image texture. More...
 
voidkzuImageTextureGetData (const struct KzuImageTexture *imageTexture)
 Gets the image data of a 2D image texture. More...
 
kzsError kzuImageTextureUpdateSubData (const struct KzuImageTexture *imageTexture, const kzByte *data, kzUint x, kzUint y, kzUint width, kzUint height)
 Updates a part of the image texture's data. More...
 

Variables

const KzuResourceType KZU_RESOURCE_TYPE_IMAGE_TEXTURE
 Resource type identifier for 2D image texture. More...
 

Detailed Description

2D image texture.

Copyright 2008-2019 by Rightware. All rights reserved.

Function Documentation

kzsError kzuImageTextureCreate ( const struct KzuResourceManager resourceManager,
kzString  name,
struct KzuResourceLoader loader,
struct KzuImageTexture **  out_imageTexture 
)

Creates a 2D image texture that loads the data when needed using the given resource loader.

The new image texture starts with reference count of one, use kzuResourceRelease to free the resource.

Parameters
resourceManagerThe resource manager to use.
nameName of the new image texture.
loaderResource loader to use for loading the resource.
out_imageTextureA pointer that is set to point to the new image texture.
kzsError kzuImageTextureRegisterToFactory ( const struct KzuFactory factory)

Registers image texture type to the factory.

This is normally called from kzaApplicationCreate and needs to be done before calling any of the creation functions.

Parameters
factoryThe factory to use.
kzsError kzuImageTextureCreateFromImage ( const struct KzuResourceManager resourceManager,
kzString  name,
const struct KzcImage image,
enum KzuTextureFilter  filter,
enum KzuTextureWrap  wrap,
kzFloat  anisotropy,
struct KzuImageTexture **  out_imageTexture 
)

Creates a 2D image texture from the given image.

The created texture takes ownership of the image. If this is not desired, use kzcImageCopy to create a copy of the image before passing it to the texture.

Parameters
resourceManagerThe resource manager to use.
nameName of the new image texture.
imageThe image (data) to use in the texture. The created texture takes ownership of the image.
filterTexture filter to use. See KzuTextureFilter.
wrapTexture wrapping mode to use. See KzuTextureWrap.
anisotropySet anisotropic filtering level of texture. Values <= 1.0f disable the feature.
out_imageTextureA pointer that is set to point to the new image texture.
kzsError kzuImageTextureCreateFromMemory ( const struct KzuResourceManager resourceManager,
kzString  name,
enum KzuTextureChannels  channels,
kzUint  width,
kzUint  height,
const kzByte data,
enum KzuTextureFilter  filter,
enum KzuTextureWrap  wrap,
kzFloat  anisotropy,
struct KzuImageTexture **  out_imageTexture 
)

Creates a 2D image texture from a byte array.

Parameters
resourceManagerThe resource manager to use.
nameName of the new image texture.
channelsThe channels contained in the data. See KzuTextureChannels.
widthThe width of the image.
heightThe height of the image.
dataPointer to the byte array of channel_count * width * height bytes.
filterTexture filter to use. See KzuTextureFilter.
wrapTexture wrapping mode to use. See KzuTextureWrap.
anisotropySet anisotropic filtering level of texture. Values <= 1.0f disable the feature.
out_imageTextureA pointer that is set to point to the new image texture.
kzsError kzuImageTextureInitializeFromImage ( struct KzuImageTexture imageTexture,
const struct KzcImage image,
enum KzuTextureFilter  filter,
enum KzuTextureWrap  wrap,
kzFloat  anisotropy 
)

Initializes a 2D image texture from an image with the given arguments.

The texture takes ownership of the image.

See Also
kzuImageTextureCreate for creating the 2D image texture.
Parameters
imageTextureAn image texture previously created with e.g. kzuImageTextureCreate.
imageThe image (data) to use in the texture. The texture takes ownership of the image.
filterTexture filter to use. See KzuTextureFilter.
wrapTexture wrapping mode to use. See KzuTextureWrap.
anisotropySet anisotropic filtering level of texture. Values <= 1.0f disable the feature.
kzsError kzuImageTextureInitializeFromMemory ( struct KzuImageTexture imageTexture,
enum KzuTextureChannels  channels,
kzUint  width,
kzUint  height,
const kzByte data,
enum KzuTextureFilter  filter,
enum KzuTextureWrap  wrap,
kzFloat  anisotropy 
)

Initializes a 2D image texture from memory with the given arguments.

See Also
kzuImageTextureCreate for creating the 2D image texture.
Parameters
imageTextureAn image texture previously created with e.g. kzuImageTextureCreate.
channelsThe channels contained in the data. See KzuTextureChannels.
widthThe width of the image.
heightThe height of the image.
dataPointer to the byte array of channel_count * width * height bytes.
filterTexture filter to use. See KzuTextureFilter.
wrapTexture wrapping mode to use. See KzuTextureWrap.
anisotropySet anisotropic filtering level of texture. Values <= 1.0f disable the feature.
struct KzuTexture* kzuImageTextureToTexture ( const struct KzuImageTexture imageTexture)

Converts 2D image texture to texture.

struct KzuImageTexture* kzuImageTextureFromTexture ( const struct KzuTexture texture)

Converts texture to 2D image texture.

struct KzuGPUResource* kzuImageTextureToGPUResource ( const struct KzuImageTexture imageTexture)

Converts 2D image texture to GPU resource.

struct KzuImageTexture* kzuImageTextureFromGPUResource ( const struct KzuGPUResource gpuResource)

Converts GPU resource to 2D image texture.

struct KzuResource* kzuImageTextureToResource ( const struct KzuImageTexture imageTexture)

Converts 2D image texture to resource.

struct KzuImageTexture* kzuImageTextureFromResource ( const struct KzuResource resource)

Converts resource to 2D image texture.

void* kzuImageTextureGetData ( const struct KzuImageTexture imageTexture)

Gets the image data of a 2D image texture.

Returns the base mipmap level only.

kzsError kzuImageTextureUpdateSubData ( const struct KzuImageTexture imageTexture,
const kzByte data,
kzUint  x,
kzUint  y,
kzUint  width,
kzUint  height 
)

Updates a part of the image texture's data.

Updates the base mipmap level only. Not effective on compressed textures.

Parameters
imageTextureAn image texture previously created with e.g. kzuImageTextureCreate.
dataPointer to the byte array of channel_count * width * height bytes.
xThe x-coordinate of the part to update.
yThe y-coordinate of the part to update.
widthWidth of the part to update.
heightHeight of the part to update.

Variable Documentation

const KzuResourceType KZU_RESOURCE_TYPE_IMAGE_TEXTURE

Resource type identifier for 2D image texture.