|
Kanzi Graphics Engine
|
Image component. More...
#include "kzc_etc.h"#include <system/kzs_types.h>#include <system/debug/kzs_error.h>#include <system/kzs_header.h>Typedefs | |
| typedef kzsError(* | KzuImageLoadImageCallback )(struct KzcInputStream *inputStream, void *userData, struct KzcImage **out_image) |
| Function type definition for function that can load an image reference from .KZB input stream. More... | |
Functions | |
| kzsError | kzcImageCreate (const struct KzcMemoryManager *memoryManager, struct KzcImage **out_image) |
| Creates an image with no data. More... | |
| kzsException | kzcImageLoadPNG (const struct KzcMemoryManager *memoryManager, struct KzcInputStream *inputStream, kzBool flipInternally, struct KzcImage **out_image) |
| Loads image from PNG file. More... | |
| kzsException | kzcImageLoadJPEG (const struct KzcMemoryManager *memoryManager, struct KzcInputStream *inputStream, kzBool flipInternally, struct KzcImage **out_image) |
| Loads image from JPEG file. More... | |
| kzsError | kzcImageLoadRAW (const struct KzcMemoryManager *memoryManager, struct KzcInputStream *inputStream, kzBool flipInternally, kzUint width, kzUint height, enum KzcImageDataFormat colorFormat, struct KzcImage **out_image) |
| Loads image from RAW format. More... | |
| kzsError | kzcImageLoadMemory (const struct KzcMemoryManager *memoryManager, kzUint width, kzUint height, enum KzcImageDataFormat colorFormat, const void *data, struct KzcImage **out_image) |
| Loads image from memory. More... | |
| kzsError | kzcImageLoadMemoryAssignData (const struct KzcMemoryManager *memoryManager, kzUint width, kzUint height, enum KzcImageDataFormat colorFormat, void *data, struct KzcImage **out_image) |
| Creates image from data, data not copied. More... | |
| kzsException | kzcImageLoadResource (const struct KzcMemoryManager *memoryManager, kzString resourcePath, struct KzcImage **out_image) |
| Loads image from resource. More... | |
| kzsException | kzcImageLoadFile (const struct KzcMemoryManager *memoryManager, kzString filePath, struct KzcImage **out_image) |
| Loads image from file. More... | |
| kzsException | kzcImageLoadResourceFlipped (const struct KzcMemoryManager *memoryManager, kzString resourcePath, struct KzcImage **out_image) |
| Loads image from resource. More... | |
| kzsException | kzcImageLoadFileFlipped (const struct KzcMemoryManager *memoryManager, kzString filePath, struct KzcImage **out_image) |
| Loads image from file. More... | |
| kzsError | kzcImageCreateMipmapImage (const struct KzcMemoryManager *memoryManager, kzUint levelCount, struct KzcImage *const *mipmapImages, struct KzcImage **out_image) |
| Creates mipmap image out of list of mipmap images. More... | |
| kzsError | kzcImageDelete (struct KzcImage *image) |
| Deletes image. More... | |
| kzsException | kzcImageLoadPNGFromKZB (struct KzcImage *image, struct KzcInputStream *inputStream, kzBool flipInternally) |
| Loads PNG image from KZB. More... | |
| kzsError | kzcImageLoadJPEGFromKZB (struct KzcImage *image, struct KzcInputStream *inputStream, kzBool flipInternally) |
| Loads JPEG image from KZB. More... | |
| kzsError | kzcImageLoadETCFromKZB (struct KzcImage *image, struct KzcInputStream *inputStream, kzBool flippedInternally) |
| Loads ETC image from KZB. More... | |
| kzsError | kzcImageLoadDXTFromKZB (struct KzcImage *image, struct KzcInputStream *inputStream, kzBool flippedInternally) |
| Loads DXT image from KZB. More... | |
| kzsError | kzcImageLoadATCFromKZB (struct KzcImage *image, struct KzcInputStream *inputStream, kzBool flippedInternally) |
| Loads ATC compressed image from KZB. More... | |
| kzsError | kzcImageLoadPVRTCFromKZB (struct KzcImage *image, struct KzcInputStream *inputStream, kzBool flippedInternally) |
| Loads PVRTC compressed image from KZB. More... | |
| kzsError | kzcImageLoadRaw2DFromKZB (struct KzcImage *image, struct KzcInputStream *inputStream, kzBool flipInternally) |
| Loads RAW 2D image from KZB. More... | |
| kzsError | kzcImageCopySubImage (const struct KzcImage *targetImage, const struct KzcImage *sourceImage, kzUint targetRectX, kzUint targetRectY, kzUint sourceRectX, kzUint sourceRectY, kzUint width, kzUint height) |
| Copies data from sourceImage to targetImage. More... | |
| kzsError | kzcImageCopySubImageData (const struct KzcImage *targetImage, void *sourceData, kzUint targetRectX, kzUint targetRectY, kzUint sourceRectX, kzUint sourceRectY, kzUint sourceImageWidth, kzUint width, kzUint height) |
| Copies sourceImage data to targetImage. More... | |
| kzsError | kzcImageSavePNG (const struct KzcImage *image, struct KzcOutputStream *outputStream) |
| Saves an image to an output stream in the PNG format. More... | |
| kzsError | kzcImageSaveJPEG (const struct KzcImage *image, struct KzcOutputStream *outputStream, kzFloat quality) |
| Saves an image to an output stream in the JPEG format. More... | |
| kzsError | kzcImageSaveRAW (const struct KzcImage *image, struct KzcOutputStream *outputStream) |
| Saves raw image to specific output stream. More... | |
| kzUint | kzcImageGetWidth (const struct KzcImage *image) |
| Returns image width. More... | |
| kzUint | kzcImageGetHeight (const struct KzcImage *image) |
| Returns image height. More... | |
| void | kzcImageSetFlippedInternally (struct KzcImage *image, kzBool flipped) |
| Sets a flag to indicate that the data in the image is vertically flipped. More... | |
| kzBool | kzcImageIsFlippedInternally (const struct KzcImage *image) |
| Returns the flag which indicates if the data in the image is vertically flipped or not. More... | |
| void | kzcImageSetPremultipliedAlpha (struct KzcImage *image, kzBool premultipliedAlpha) |
| Sets a flag to indicate that the RGB data in the image has premultiplied alpha. More... | |
| kzBool | kzcImageIsPremultipliedAlpha (const struct KzcImage *image) |
| Returns the flag which indicates if the RGB data in the image has premultiplied alpha. More... | |
| enum KzcImageDataFormat | kzcImageGetDataFormat (const struct KzcImage *image) |
| Returns color format from image. More... | |
| void * | kzcImageGetData (const struct KzcImage *image) |
| Returns image data from image. More... | |
| kzUint | kzcImageGetDataSize (const struct KzcImage *image) |
| Returns the size of the image data from image. More... | |
| kzUint | kzcImageGetBytesPerPixelFromFormat (enum KzcImageDataFormat dataFormat) |
| Gets bytes per pixel from data format. More... | |
| kzUint | kzcImageGetMipmapLevelCount (const struct KzcImage *image) |
| Gets mipmap level count from image. More... | |
| struct KzcImage * | kzcImageGetMipmapLevel (const struct KzcImage *image, kzUint mipmapLevelIndex) |
| Gets mipmap level from image. More... | |
| kzBool | kzcImageIsMipmapImage (const struct KzcImage *image) |
| Returns if this image is mipmap image. More... | |
| kzsError | kzcImageCopy (const struct KzcMemoryManager *memoryManager, const struct KzcImage *sourceImage, struct KzcImage **out_targetImage) |
| Copy operator for image. More... | |
| kzsException | kzcImageConvert (struct KzcImage *sourceImage, enum KzcImageDataFormat colorFormat) |
| Converts an image to the specified image data format. More... | |
| kzsError | kzcImageConvertToETC (struct KzcImage *sourceImage, enum KzcEtcCompressionMode compressionMode) |
| Converts an image to the ETC compressed format. More... | |
| kzsError | kzcImageSetName (struct KzcImage *image, kzString name) |
| Sets name for the image. More... | |
| kzString | kzcImageGetName (const struct KzcImage *image) |
| Gets name of the image. More... | |
| kzsException | kzcImageBlit (const struct KzcImage *destination, const struct KzcImage *source, kzUint sourceOffsetX, kzUint sourceOffsetY, kzUint destOffsetX, kzUint destOffsetY, kzUint width, kzUint height) |
| Blit an image into another. More... | |
| kzsError | kzcImageResize (struct KzcImage *image, kzUint newWidth, kzUint newHeight, enum KzcImageResizeFilter resizeFilter) |
| Resizes image by specified parameters. More... | |
| kzsError | kzcImageCrop (struct KzcImage *image, kzUint x, kzUint y, kzUint width, kzUint height) |
| Crops image by using (x, y, width, height) area. More... | |
| kzsError | kzcImageFlipHorizontally (const struct KzcImage *image) |
| Flips image horizontally. More... | |
| kzsError | kzcImageFlipVertically (const struct KzcImage *image) |
| Flips image vertically. More... | |
| kzsError | kzcImagePremultiplyAlpha (const struct KzcImage *image) |
| Pre-multiplies the RGB data of the image with the alpha component. More... | |
| kzsError | kzcImageCreateMipmapLevels (struct KzcImage *image) |
| Creates mipmap levels for the given image. More... | |
| kzsError | kzcImageAssignMipmapLevels (struct KzcImage *image, kzUint levelCount, struct KzcImage *const *mipmapImages) |
| Assigns mipmap levels for the given images. More... | |
| kzsError | kzcImageCreateMipmapImages (const struct KzcMemoryManager *memoryManager, const struct KzcImage *image, struct KzcImage ***out_mipmapImages) |
| Creates mipmap images from source image and returns them. More... | |
| kzBool | kzcImageIsCompressedFormat (const struct KzcImage *image) |
| Returns is image is in compressed format. More... | |
| kzBool | kzcImageIsDataFormatCompressed (enum KzcImageDataFormat dataFormat) |
| Returns if image data format is in compressed format. More... | |
Image component.
Handles loading and saving images.
Copyright 2008-2019 by Rightware. All rights reserved.
| typedef kzsError(* KzuImageLoadImageCallback)(struct KzcInputStream *inputStream, void *userData, struct KzcImage **out_image) |
Function type definition for function that can load an image reference from .KZB input stream.
| enum KzcImageDataFormat |
List of data formats image may have.
| enum KzcImageResizeFilter |
| kzsError kzcImageCreate | ( | const struct KzcMemoryManager * | memoryManager, |
| struct KzcImage ** | out_image | ||
| ) |
Creates an image with no data.
| kzsException kzcImageLoadPNG | ( | const struct KzcMemoryManager * | memoryManager, |
| struct KzcInputStream * | inputStream, | ||
| kzBool | flipInternally, | ||
| struct KzcImage ** | out_image | ||
| ) |
Loads image from PNG file.
Color format is output in either RGB8 or RGBA8. The image is optionally flipped on load (to conform with OpenGL default texture coordinates).
| kzsException kzcImageLoadJPEG | ( | const struct KzcMemoryManager * | memoryManager, |
| struct KzcInputStream * | inputStream, | ||
| kzBool | flipInternally, | ||
| struct KzcImage ** | out_image | ||
| ) |
Loads image from JPEG file.
Color format is output in RGB8. The image is optionally flipped on load (to conform with OpenGL default texture coordinates).
| kzsError kzcImageLoadRAW | ( | const struct KzcMemoryManager * | memoryManager, |
| struct KzcInputStream * | inputStream, | ||
| kzBool | flipInternally, | ||
| kzUint | width, | ||
| kzUint | height, | ||
| enum KzcImageDataFormat | colorFormat, | ||
| struct KzcImage ** | out_image | ||
| ) |
Loads image from RAW format.
Width, height and format needs to be specified manually. Throws error if dimension and format mismatches the RAW file size. The image is optionally flipped on load (to conform with OpenGL default texture coordinates).
| kzsError kzcImageLoadMemory | ( | const struct KzcMemoryManager * | memoryManager, |
| kzUint | width, | ||
| kzUint | height, | ||
| enum KzcImageDataFormat | colorFormat, | ||
| const void * | data, | ||
| struct KzcImage ** | out_image | ||
| ) |
Loads image from memory.
Data is copied.
| kzsError kzcImageLoadMemoryAssignData | ( | const struct KzcMemoryManager * | memoryManager, |
| kzUint | width, | ||
| kzUint | height, | ||
| enum KzcImageDataFormat | colorFormat, | ||
| void * | data, | ||
| struct KzcImage ** | out_image | ||
| ) |
Creates image from data, data not copied.
| kzsException kzcImageLoadResource | ( | const struct KzcMemoryManager * | memoryManager, |
| kzString | resourcePath, | ||
| struct KzcImage ** | out_image | ||
| ) |
Loads image from resource.
PNG and JPEG are supported. If the image will be used as a 2D texture, consider using kzcImageLoadResourceFlipped instead.
| kzsException kzcImageLoadFile | ( | const struct KzcMemoryManager * | memoryManager, |
| kzString | filePath, | ||
| struct KzcImage ** | out_image | ||
| ) |
Loads image from file.
PNG and JPEG are supported. If the image will be used as a 2D texture, consider using kzcImageLoadFileFlipped instead.
| kzsException kzcImageLoadResourceFlipped | ( | const struct KzcMemoryManager * | memoryManager, |
| kzString | resourcePath, | ||
| struct KzcImage ** | out_image | ||
| ) |
Loads image from resource.
PNG and JPEG are supported. This function flips the image data vertically while loading to make it compatible with OpenGL 2D textures. If this function is used instead of kzcImageLoadResource, deploying the image to a 2D texture will be faster and use less memory.
| kzsException kzcImageLoadFileFlipped | ( | const struct KzcMemoryManager * | memoryManager, |
| kzString | filePath, | ||
| struct KzcImage ** | out_image | ||
| ) |
Loads image from file.
PNG and JPEG are supported. This function flips the image data vertically while loading to make it compatible with OpenGL 2D textures. If this function is used instead of kzcImageLoadFile, deploying the image to a 2D texture will be faster and use less memory.
| kzsError kzcImageCreateMipmapImage | ( | const struct KzcMemoryManager * | memoryManager, |
| kzUint | levelCount, | ||
| struct KzcImage *const * | mipmapImages, | ||
| struct KzcImage ** | out_image | ||
| ) |
Creates mipmap image out of list of mipmap images.
| kzsException kzcImageLoadPNGFromKZB | ( | struct KzcImage * | image, |
| struct KzcInputStream * | inputStream, | ||
| kzBool | flipInternally | ||
| ) |
Loads PNG image from KZB.
| kzsError kzcImageLoadJPEGFromKZB | ( | struct KzcImage * | image, |
| struct KzcInputStream * | inputStream, | ||
| kzBool | flipInternally | ||
| ) |
Loads JPEG image from KZB.
| kzsError kzcImageLoadETCFromKZB | ( | struct KzcImage * | image, |
| struct KzcInputStream * | inputStream, | ||
| kzBool | flippedInternally | ||
| ) |
Loads ETC image from KZB.
| kzsError kzcImageLoadDXTFromKZB | ( | struct KzcImage * | image, |
| struct KzcInputStream * | inputStream, | ||
| kzBool | flippedInternally | ||
| ) |
Loads DXT image from KZB.
| kzsError kzcImageLoadATCFromKZB | ( | struct KzcImage * | image, |
| struct KzcInputStream * | inputStream, | ||
| kzBool | flippedInternally | ||
| ) |
Loads ATC compressed image from KZB.
| kzsError kzcImageLoadPVRTCFromKZB | ( | struct KzcImage * | image, |
| struct KzcInputStream * | inputStream, | ||
| kzBool | flippedInternally | ||
| ) |
Loads PVRTC compressed image from KZB.
| kzsError kzcImageLoadRaw2DFromKZB | ( | struct KzcImage * | image, |
| struct KzcInputStream * | inputStream, | ||
| kzBool | flipInternally | ||
| ) |
Loads RAW 2D image from KZB.
| kzsError kzcImageCopySubImage | ( | const struct KzcImage * | targetImage, |
| const struct KzcImage * | sourceImage, | ||
| kzUint | targetRectX, | ||
| kzUint | targetRectY, | ||
| kzUint | sourceRectX, | ||
| kzUint | sourceRectY, | ||
| kzUint | width, | ||
| kzUint | height | ||
| ) |
Copies data from sourceImage to targetImage.
Data is copied from sourceImage area [sourceRectX, sourceRectY, sourceRectX + width, sourceRectY + height] to targetImage area [targetRectX, targetRectY, targetRectX + width, targetRectY + height] Error is returned if area is out of bounds of image.
| kzsError kzcImageCopySubImageData | ( | const struct KzcImage * | targetImage, |
| void * | sourceData, | ||
| kzUint | targetRectX, | ||
| kzUint | targetRectY, | ||
| kzUint | sourceRectX, | ||
| kzUint | sourceRectY, | ||
| kzUint | sourceImageWidth, | ||
| kzUint | width, | ||
| kzUint | height | ||
| ) |
Copies sourceImage data to targetImage.
| kzsError kzcImageSavePNG | ( | const struct KzcImage * | image, |
| struct KzcOutputStream * | outputStream | ||
| ) |
Saves an image to an output stream in the PNG format.
The only supported image formats are KZC_IMAGE_DATA_FORMAT_RGB_888 and KZC_IMAGE_DATA_FORMAT_RGBA_8888. Output stream must be closed manually.
| kzsError kzcImageSaveJPEG | ( | const struct KzcImage * | image, |
| struct KzcOutputStream * | outputStream, | ||
| kzFloat | quality | ||
| ) |
Saves an image to an output stream in the JPEG format.
Output stream must be closed manually. Quality within range [0,1]
| kzsError kzcImageSaveRAW | ( | const struct KzcImage * | image, |
| struct KzcOutputStream * | outputStream | ||
| ) |
Saves raw image to specific output stream.
Output image will be in raw byte format.
Sets a flag to indicate that the data in the image is vertically flipped.
Returns the flag which indicates if the data in the image is vertically flipped or not.
Sets a flag to indicate that the RGB data in the image has premultiplied alpha.
Returns the flag which indicates if the RGB data in the image has premultiplied alpha.
| enum KzcImageDataFormat kzcImageGetDataFormat | ( | const struct KzcImage * | image) |
Returns color format from image.
Returns the size of the image data from image.
| kzUint kzcImageGetBytesPerPixelFromFormat | ( | enum KzcImageDataFormat | dataFormat) |
Gets bytes per pixel from data format.
Gets mipmap level count from image.
Gets mipmap level from image.
Returns if this image is mipmap image.
| kzsError kzcImageCopy | ( | const struct KzcMemoryManager * | memoryManager, |
| const struct KzcImage * | sourceImage, | ||
| struct KzcImage ** | out_targetImage | ||
| ) |
Copy operator for image.
| kzsException kzcImageConvert | ( | struct KzcImage * | sourceImage, |
| enum KzcImageDataFormat | colorFormat | ||
| ) |
Converts an image to the specified image data format.
| sourceImage | The image to convert. |
| colorFormat | The image data format to convert to. Compressed formats are not supported. |
| kzsError kzcImageConvertToETC | ( | struct KzcImage * | sourceImage, |
| enum KzcEtcCompressionMode | compressionMode | ||
| ) |
Converts an image to the ETC compressed format.
| sourceImage | The image to convert. | |
| [in] | compressionMode | mode to use for compression. See kzc_etc.h for possible values. |
Gets name of the image.
KZ_NULL if not assigned.
| kzsException kzcImageBlit | ( | const struct KzcImage * | destination, |
| const struct KzcImage * | source, | ||
| kzUint | sourceOffsetX, | ||
| kzUint | sourceOffsetY, | ||
| kzUint | destOffsetX, | ||
| kzUint | destOffsetY, | ||
| kzUint | width, | ||
| kzUint | height | ||
| ) |
Blit an image into another.
The images must have the same format. Only the image data format KZC_IMAGE_DATA_FORMAT_RGBA_8888 is supported.
| destination | The image to write to. |
| source | The image to read from. |
| sourceOffsetX | X offset to the source. |
| sourceOffsetY | Y offset to the source. |
| destOffsetX | X offset to the destination. |
| destOffsetY | Y offset to the destination. |
| width | The width (in pixels) to blit. |
| height | The height (in pixels) to blit. |
| kzsError kzcImageResize | ( | struct KzcImage * | image, |
| kzUint | newWidth, | ||
| kzUint | newHeight, | ||
| enum KzcImageResizeFilter | resizeFilter | ||
| ) |
Resizes image by specified parameters.
If the image is a mipmap image, all the mipmap levels are lost.
Crops image by using (x, y, width, height) area.
Pre-multiplies the RGB data of the image with the alpha component.
Creates mipmap levels for the given image.
| kzsError kzcImageAssignMipmapLevels | ( | struct KzcImage * | image, |
| kzUint | levelCount, | ||
| struct KzcImage *const * | mipmapImages | ||
| ) |
Assigns mipmap levels for the given images.
| kzsError kzcImageCreateMipmapImages | ( | const struct KzcMemoryManager * | memoryManager, |
| const struct KzcImage * | image, | ||
| struct KzcImage *** | out_mipmapImages | ||
| ) |
Creates mipmap images from source image and returns them.
Returns is image is in compressed format.
| kzBool kzcImageIsDataFormatCompressed | ( | enum KzcImageDataFormat | dataFormat) |
Returns if image data format is in compressed format.