FormIt C++ API  v23.0.0 (2023.0.0)
FormIt::Utils API

Description

Classes

class  FormIt::Utils::UtilsImage
 FormIt::Utils::UtilsImage class. More...
 
struct  FormIt::Utils::Span< T >
 Provides a "view" into a container/array. More...
 

Functions

Guid FormIt::Utils::NewGuid ()
 NewGuid() function. More...
 
Guid FormIt::Utils::GuidFromString (const 1::string &str)
 GuidFromString() function. More...
 
::string FormIt::Utils::GuidToHexString (const Guid &guid)
 GuidToHexString() function. More...
 
FORMIT_CORE_EXPORT::string FormIt::Utils::CreateTextureFileFromData (const 1::vector< char > &data, const 1::string &fileName, bool bForceRemake=false)
 Create the texture cache file from a texture's bit data. More...
 
FORMIT_CORE_EXPORT::shared_ptr< FormIt::Utils::UtilsImageFormIt::Utils::LoadImageData (const 1::string &aRootFolder, const 1::string &filename, bool swapredblue=false, bool flip=false)
 Create an Image object from an input file (JPEG or PNG) More...
 
FORMIT_CORE_EXPORT::shared_ptr< FormIt::Utils::UtilsImageFormIt::Utils::DecodeImage (unsigned char *data, int size, bool swapredblue=false, bool flip=false)
 Create an Image object from input image data (JPEG or PNG format) More...
 
FORMIT_CORE_EXPORT::vector< unsigned char > FormIt::Utils::EncodeImagePNG (1::vector< unsigned char > &imgData, size_t width, size_t height, size_t bytesPerPixel)
 Create PNG formatted data from raw rgb (bytesPerPixel == 3) or rgba (bytesPerPixel == 4) pixel data. More...
 
FORMIT_CORE_EXPORT::vector< char > FormIt::Utils::EncodeImageJPG (unsigned char *imageData, size_t image_width, size_t image_height, size_t bytesPerPixel, bool encodeAlphaOnly, int quality=80)
 Create JPG formatted data from raw rgb (bytesPerPixel == 3) or rgba (bytesPerPixel == 4) pixel data. More...
 

Function Documentation

FORMIT_CORE_EXPORT ::string FormIt::Utils::CreateTextureFileFromData ( const 1::vector< char > &  data,
const 1::string &  fileName,
bool  bForceRemake = false 
)

Create the texture cache file from a texture's bit data.

It is assumed that the data is in png or jpg format

Parameters
[in]data
[in]fileName
[in]bForceRemake
FORMIT_CORE_EXPORT ::shared_ptr<FormIt::Utils::UtilsImage> FormIt::Utils::DecodeImage ( unsigned char *  data,
int  size,
bool  swapredblue = false,
bool  flip = false 
)

Create an Image object from input image data (JPEG or PNG format)

Parameters
[out]data
[in]size
[in]swapredblue
[in]flip
FORMIT_CORE_EXPORT ::vector<char> FormIt::Utils::EncodeImageJPG ( unsigned char *  imageData,
size_t  image_width,
size_t  image_height,
size_t  bytesPerPixel,
bool  encodeAlphaOnly,
int  quality = 80 
)

Create JPG formatted data from raw rgb (bytesPerPixel == 3) or rgba (bytesPerPixel == 4) pixel data.

jpg quality 0 ... 100

Parameters
imageDataVector of R,G,B or R,G,B-A order data
image_widthNumber of columns in image
image_heightNumber of rows in image
bytesPerPixelshould be 3 (RGB) or 4 (RGBA)
encodeAlphaOnlyif true, the alpha channel of the input will be used to create a grayscale jpg
qualityassuming there is an alpha channel. Otherwise the RGB channels will be used
FORMIT_CORE_EXPORT ::vector<unsigned char> FormIt::Utils::EncodeImagePNG ( 1::vector< unsigned char > &  imgData,
size_t  width,
size_t  height,
size_t  bytesPerPixel 
)

Create PNG formatted data from raw rgb (bytesPerPixel == 3) or rgba (bytesPerPixel == 4) pixel data.

Parameters
[out]imgData
[in]width
[in]height
[in]bytesPerPixel
Guid FormIt::Utils::GuidFromString ( const 1::string &  str)

GuidFromString() function.

Parameters
[in]str
::string FormIt::Utils::GuidToHexString ( const Guid guid)

GuidToHexString() function.

Parameters
[in]guid
FORMIT_CORE_EXPORT ::shared_ptr<FormIt::Utils::UtilsImage> FormIt::Utils::LoadImageData ( const 1::string &  aRootFolder,
const 1::string &  filename,
bool  swapredblue = false,
bool  flip = false 
)

Create an Image object from an input file (JPEG or PNG)

Parameters
[in]aRootFolder
[in]filename
[in]swapredblue
[in]flip
Guid FormIt::Utils::NewGuid ( )

NewGuid() function.