wx_human_seg 3.0.0
Typedefs | Enumerations | Functions
wx_image_c_api.h File Reference
#include <stdint.h>
#include <stddef.h>
#include "wx_api.h"

Go to the source code of this file.

Typedefs

typedef enum WXImageDataFormat_e WXImageDataFormat_e
 
typedef struct WXImage_t WXImage_t
 

Enumerations

enum  WXImageDataFormat_e {
  WXImgDF_UNK = 0 , WXImgDF_RGB = 1 , WXImgDF_RGBA , WXImgDF_ALPHA8 ,
  WXImgDF_FLOAT32
}
 

Functions

WX_API int WXImage_FromFile (const char *fileName, WXImage_t **img_p)
 
WX_API int WXImage_FromEncodedData (const uint8_t *data, size_t size, WXImage_t **img_p)
 
WX_API int WXImage_FromColor (int width, int height, uint8_t r, uint8_t g, uint8_t b, WXImage_t **img_p)
 
WX_API int WXImage_FromBuffer (int width, int height, const uint8_t *rgbData, WXImage_t **img_p)
 
WX_API void WXImage_Release (WXImage_t *img)
 
WX_API int WXImage_ToFile (WXImage_t *img, const char *fileName)
 
WX_API int WXImage_ToEncodedData (WXImage_t *img, const char *imgType, uint8_t *encodedData, size_t encodedDataCapcity, size_t *encodedDataSize)
 
WX_API int WXImage_Width (WXImage_t *img)
 
WX_API int WXImage_Height (WXImage_t *img)
 
WX_API uint8_t * WXImage_Data (WXImage_t *img)
 
WX_API WXImageDataFormat_e WXImage_DataFormat (WXImage_t *img)
 

Detailed Description

SDK图片操作API

Typedef Documentation

◆ WXImage_t

typedef struct WXImage_t WXImage_t

WXImage_t结构

See also
wonxai::WXImage

◆ WXImageDataFormat_e

WXImage_t 图像数据格式

Enumeration Type Documentation

◆ WXImageDataFormat_e

WXImage_t 图像数据格式

Enumerator
WXImgDF_UNK 

未知格式

WXImgDF_RGB 

三通道RGB格式

WXImgDF_RGBA 

四通道RGBA格式

WXImgDF_ALPHA8 

单通道ALPHA格式

WXImgDF_FLOAT32 

单通道浮点值

Function Documentation

◆ WXImage_Data()

WX_API uint8_t * WXImage_Data ( WXImage_t img)

返回图片数据,调用者不能从外面释放,也不需要单独释放

◆ WXImage_DataFormat()

WX_API WXImageDataFormat_e WXImage_DataFormat ( WXImage_t img)

返回图片数据格式

◆ WXImage_FromBuffer()

WX_API int WXImage_FromBuffer ( int  width,
int  height,
const uint8_t *  rgbData,
WXImage_t **  img_p 
)

根据给定的图像像素数据,创建WXImage_t对象

See also
wonxai::WXImage::fromBuffer
Returns
  成功 - 0
  失败 - 错误码

◆ WXImage_FromColor()

WX_API int WXImage_FromColor ( int  width,
int  height,
uint8_t  r,
uint8_t  g,
uint8_t  b,
WXImage_t **  img_p 
)

创建一副纯色图,颜色值由r,g,b三个值指定

See also
wonxai::WXImage::fromColor
Returns
  成功 - 0
  失败 - 错误码

◆ WXImage_FromEncodedData()

WX_API int WXImage_FromEncodedData ( const uint8_t *  data,
size_t  size,
WXImage_t **  img_p 
)

从图片文件数据创建一个WXImage_t对象

See also
wonxai::WXImage::fromEncodedData
Returns
  成功 - 0
  失败 - 错误码

◆ WXImage_FromFile()

WX_API int WXImage_FromFile ( const char *  fileName,
WXImage_t **  img_p 
)

从文件创建一个WXImage_t对象

See also
wonxai::WXImage::fromFile
Returns
  成功 - 0
  失败 - 错误码

◆ WXImage_Height()

WX_API int WXImage_Height ( WXImage_t img)

返回图片高度

◆ WXImage_Release()

WX_API void WXImage_Release ( WXImage_t img)

释放一个WXImage_t 对象

◆ WXImage_ToEncodedData()

WX_API int WXImage_ToEncodedData ( WXImage_t img,
const char *  imgType,
uint8_t *  encodedData,
size_t  encodedDataCapcity,
size_t *  encodedDataSize 
)

将图片保存为编码后的数据,支持jpg和png格式

See also
wonxai::WXImage::toEncodedData
Note
encodedData的空间由调用者自行分配和管理
Parameters
[in]imgWXImage对象
[in]imgType图片编码类型:jpg or png
[out]encodedData- 用于接收编码后的二进制数据
[in]encodedDataCapcity- encodedData空间长度
[out]encodedDataSize- 返回的编码后的图片数据的长度
Returns
  成功 - 0
  失败 - 错误码

◆ WXImage_ToFile()

WX_API int WXImage_ToFile ( WXImage_t img,
const char *  fileName 
)

将图片保存到文件,支持jpg和png图片

◆ WXImage_Width()

WX_API int WXImage_Width ( WXImage_t img)

返回图片宽度