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

Image layer class. More...

Functions

struct KzuImageLayer * kzuImageLayerFromLayer (const struct KzuLayer *layer)
 Convert from layer to image layer. More...
 
struct KzuLayerkzuImageLayerToLayer (const struct KzuImageLayer *imageLayer)
 Convert from image layer to layer. More...
 
kzBool kzuLayerIsImageLayer (const struct KzuLayer *layer)
 Returns KZ_TRUE if the layer is an image layer. More...
 
kzsError kzuImageLayerCreate (const struct KzcMemoryManager *memoryManager, kzString name, struct KzuUIDomain *uiDomain, struct KzuImageLayer **out_imageLayer)
 Create an image layer. More...
 
kzsError kzuImageLayerRegisterToFactory (const struct KzuFactory *factory)
 Register image layer to the factory. More...
 
struct KzuTexturekzuImageLayerGetTexture (const struct KzuImageLayer *layer)
 Return the texture of an image layer. More...
 
kzsError kzuImageLayerSetTexture (struct KzuImageLayer *imageLayer, struct KzuTexture *texture)
 Set the texture for this image layer. More...
 

Variables

const KzuObjectType KZU_OBJECT_TYPE_IMAGE_LAYER
 Object type for image layers. More...
 

Detailed Description

Image layer class.

KzuImageLayer is used to display a texture.

Image Layer Messages

KzuImageLayer does not send or receive any messages.

Image Layer Properties

KZU_PROPERTY_TYPE_IMAGE_LAYER_TEXTURE string property specifies a resource ID for the texture to display. The kzuImageLayerSetTexture function can be used to override the texture set by this property.

Image Layer Example Code

The following code shows one way of displaying a PNG image with Kanzi.

kzsError result;
struct KzcImage* image;
struct KzuImageTexture* texture;
struct KzuImageLayer* imageLayer;
result = kzcImageLoadFileFlipped(memoryManager, "testImage.png", &image);
result = kzuImageTextureCreateFromImage(resourceManager, "image name", image, KZU_TEXTURE_FILTER_BILINEAR,
KZU_TEXTURE_WRAP_CLAMP, 0.0f, &texture);
result = kzuImageLayerCreate(memoryManager, "image layer", uiDomain, &imageLayer);
result = kzuImageLayerSetTexture(imageLayer, kzuImageTextureToTexture(texture));
// Add imageLayer to a viewport such as the one returned by kzaApplicationGetRootLayer() to display the texture.
// Do something else...
// Free texture and the image data.
// Destroy the image layer.

Copyright 2008-2019 by Rightware. All rights reserved.

Function Documentation

struct KzuImageLayer* kzuImageLayerFromLayer ( const struct KzuLayer layer)

Convert from layer to image layer.

struct KzuLayer* kzuImageLayerToLayer ( const struct KzuImageLayer *  imageLayer)

Convert from image layer to layer.

kzBool kzuLayerIsImageLayer ( const struct KzuLayer layer)

Returns KZ_TRUE if the layer is an image layer.

Parameters
layerThe layer.
Returns
KZ_TRUE if the layer is an image layer, otherwise KZ_FALSE.
kzsError kzuImageLayerCreate ( const struct KzcMemoryManager memoryManager,
kzString  name,
struct KzuUIDomain uiDomain,
struct KzuImageLayer **  out_imageLayer 
)

Create an image layer.

Parameters
memoryManagerMemory manager to use.
nameName of the new image layer.
uiDomainThe UI domain.
out_imageLayerA pointer that is set to point to the new image layer.
Returns
KZS_SUCCESS on success.
kzsError kzuImageLayerRegisterToFactory ( const struct KzuFactory factory)

Register image layer 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.
Returns
KZS_SUCCESS on success.
struct KzuTexture* kzuImageLayerGetTexture ( const struct KzuImageLayer *  layer)

Return the texture of an image layer.

Parameters
layerThe image layer.
Returns
The texture.
kzsError kzuImageLayerSetTexture ( struct KzuImageLayer *  imageLayer,
struct KzuTexture texture 
)

Set the texture for this image layer.

Parameters
imageLayerThe image layer.
textureThe texture resource.
Returns
KZS_SUCCESS on success.

Variable Documentation

const KzuObjectType KZU_OBJECT_TYPE_IMAGE_LAYER

Object type for image layers.