Kanzi  3.9.4
Kanzi Engine API
Texture

Textures are digital images that you can use to show content in Image nodes, to set the look of textured materials, and to show content in Texture Brush brushes. More...

Collaboration diagram for Texture:

Classes

class  kanzi::BitmapImage
 Image is the basic runtime primitive to load, hold, and convert image data in memory. More...
 
struct  kanzi::LibJPEGParameters
 Parameters that Kanzi passes to libjpeg to use when loading jpg image files. More...
 
struct  kanzi::LibPNGParameters
 Parameters that Kanzi passes to libpng to use when loading png image files. More...
 
class  kanzi::Texture
 Textures provide images that can be used with image nodes, texture brushes and materials for use in 3D rendering or material brushes. More...
 

Enumerations

enum  kanzi::ImageResizeFilter { kanzi::ResizeFilterNearestNeighbor, kanzi::ResizeFilterBilinear, kanzi::ResizeFilterWeightedAverage }
 Image resizing filter methods. More...
 

Functions

unsigned int kanzi::calculateMipmapLevelCount (unsigned int width, unsigned int height)
 Calculates number of mipmap levels for provided image size. More...
 
TextureSharedPtr kanzi::createTextureFromMemory (Domain *domain, unsigned int width, unsigned int height, GraphicsFormat sourceFormat, const void *data, GraphicsFormat destinationFormat, string_view name)
 Loads a new image from memory and creates a texture out of it. More...
 
unsigned int kanzi::getGLTextureImageTarget (TextureType type, unsigned int face)
 
unsigned int kanzi::getGLTextureTarget (TextureType type)
 
BitmapImageUniquePtr kanzi::imageLoadJPEG (File &file, string_view name="")
 Loads a JPEG image from an input stream. More...
 
BitmapImageUniquePtr kanzi::imageLoadJPEG (File &file, const LibJPEGParameters &libjpegParameters, string_view name="")
 Loads a JPEG image from an input stream. More...
 
BitmapImageUniquePtr kanzi::imageLoadPNG (File &file, string_view name="")
 Loads a PNG image from an input stream. More...
 
BitmapImageUniquePtr kanzi::imageLoadPNG (File &file, const LibPNGParameters &libpngParameters, string_view name="")
 Loads a PNG image from an input stream. More...
 
void kanzi::imageSaveJPEG (const BitmapImage &image, File &file, float quality=1.0f)
 Saves an image as a JPEG to an output stream. More...
 
void kanzi::imageSavePNG (const BitmapImage &image, File &file)
 Saves an image as a PNG to an output stream. More...
 
void kanzi::imageSavePNGPaletted (const BitmapImage &image, File &file)
 Saves an image as a paletted PNG to an output stream. More...
 
void kanzi::swap (Texture &texture1, Texture &texture2)
 

Detailed Description

Textures are digital images that you can use to show content in Image nodes, to set the look of textured materials, and to show content in Texture Brush brushes.

You can create textures from common image file formats.

Enumeration Type Documentation

◆ ImageResizeFilter

Image resizing filter methods.

Enumerator
ResizeFilterNearestNeighbor 

Nearest neighbor filter.

ResizeFilterBilinear 

Bilinear filter.

ResizeFilterWeightedAverage 

Weighted average filter.

Function Documentation

◆ imageLoadPNG() [1/2]

BitmapImageUniquePtr kanzi::imageLoadPNG ( File file,
string_view  name = "" 
)

Loads a PNG image from an input stream.

Parameters
fileThe input file to read from.
name(Optional) A name for the image.
Returns
Unique pointer to the loaded image.

◆ imageLoadPNG() [2/2]

BitmapImageUniquePtr kanzi::imageLoadPNG ( File file,
const LibPNGParameters libpngParameters,
string_view  name = "" 
)

Loads a PNG image from an input stream.

Parameters
fileThe input file from which to read.
libpngParametersThe parameters that Kanzi passes to libpng.
name(Optional) A name for the image.
Returns
Unique pointer to the loaded image.
Since
Kanzi 3.9.3

◆ imageLoadJPEG() [1/2]

BitmapImageUniquePtr kanzi::imageLoadJPEG ( File file,
string_view  name = "" 
)

Loads a JPEG image from an input stream.

Parameters
fileThe input file to read from.
name(Optional) A name for the image.
Returns
Unique pointer to the loaded image.

◆ imageLoadJPEG() [2/2]

BitmapImageUniquePtr kanzi::imageLoadJPEG ( File file,
const LibJPEGParameters libjpegParameters,
string_view  name = "" 
)

Loads a JPEG image from an input stream.

Parameters
fileThe input file from which to read.
libjpegParametersThe parameters that Kanzi passes to libjpeg.
name(Optional) A name for the image.
Returns
Unique pointer to the loaded image.
Since
Kanzi 3.9.3

◆ imageSavePNG()

void kanzi::imageSavePNG ( const BitmapImage image,
File file 
)

Saves an image as a PNG to an output stream.

Parameters
imageThe image.
fileThe output file to write to.

◆ imageSavePNGPaletted()

void kanzi::imageSavePNGPaletted ( const BitmapImage image,
File file 
)

Saves an image as a paletted PNG to an output stream.

Parameters
imageThe image.
fileThe output file to write to.

◆ imageSaveJPEG()

void kanzi::imageSaveJPEG ( const BitmapImage image,
File file,
float  quality = 1.0f 
)

Saves an image as a JPEG to an output stream.

Parameters
imageThe image.
fileThe output file to write to.
qualityThe JPEG compression quality between 0..1, 1 being the best quality.

◆ swap()

void kanzi::swap ( Texture texture1,
Texture texture2 
)
inline

◆ getGLTextureImageTarget()

unsigned int kanzi::getGLTextureImageTarget ( TextureType  type,
unsigned int  face 
)

◆ getGLTextureTarget()

unsigned int kanzi::getGLTextureTarget ( TextureType  type)

◆ createTextureFromMemory()

TextureSharedPtr kanzi::createTextureFromMemory ( Domain domain,
unsigned int  width,
unsigned int  height,
GraphicsFormat  sourceFormat,
const void *  data,
GraphicsFormat  destinationFormat,
string_view  name 
)

Loads a new image from memory and creates a texture out of it.

Parameters
domainDomain to use.
widthWidth of the image.
heightHeight of the image.
sourceFormatGraphics surface format of the source data.
dataPointer to the source data in memory.
destinationFormatGraphics surface format to convert image data to. Use sourceFormat to skip surface format conversion.
nameName for the texture.
Returns
A shared pointer to the created texture.

◆ calculateMipmapLevelCount()

unsigned int kanzi::calculateMipmapLevelCount ( unsigned int  width,
unsigned int  height 
)

Calculates number of mipmap levels for provided image size.

Parameters
widthWidth of the image.
heightHeight of the image.
Returns
Number of mipmap levels for image of given size.