Skip to content

color_t

概述

颜色。

函数

函数名称说明
color_a获取alpha通道的值。
color_b获取蓝色通道的值。
color_cast转换为color对象。
color_create创建color对象。
color_destroy销毁color对象。
color_from_str创建color对象。
color_g获取绿色通道的值。
color_get_color获取颜色值。
color_hex_str获取16进制格式表示的颜色
color_init初始化颜色对象。
color_r获取红色通道的值。
color_rgba_str获取rgba格式表示的颜色

属性

属性名称类型说明
coloruint32_t颜色的数值。
rgbargba_t颜色的RGBA值。

color_a 函数

  • 函数功能:

获取alpha通道的值。

主要供脚本语言使用。

  • 函数原型:
uint8_t color_a (color_t* c);
  • 参数说明:
参数类型说明
返回值uint8_t返回alpha通道的值。
ccolor_t*color对象。

color_b 函数

  • 函数功能:

获取蓝色通道的值。

主要供脚本语言使用。

  • 函数原型:
uint8_t color_b (color_t* c);
  • 参数说明:
参数类型说明
返回值uint8_t返回蓝色通道的值。
ccolor_t*color对象。

color_cast 函数

  • 函数功能:

转换为color对象。

供脚本语言使用。

  • 函数原型:
color_t* color_cast (color_t* color);
  • 参数说明:
参数类型说明
返回值color_t*color对象。
colorcolor_t*color对象。

color_create 函数

  • 函数功能:

创建color对象。

主要供脚本语言使用。

  • 函数原型:
color_t* color_create (uint8_t r, uint8_t g, uint8_t b, uint8_t a);
  • 参数说明:
参数类型说明
返回值color_t*color对象。
ruint8_t红色通道。
guint8_t绿色通道。
buint8_t蓝色通道。
auint8_talpha通道。

color_destroy 函数

  • 函数功能:

销毁color对象。

主要供脚本语言使用。

  • 函数原型:
ret_t color_destroy (color_t* c);
  • 参数说明:
参数类型说明
返回值ret_t返回RET_OK表示成功,否则表示失败。
ccolor_t*color对象。

color_from_str 函数

  • 函数功能:

创建color对象。

主要供脚本语言使用。

  • 函数原型:
color_t* color_from_str (color_t* c, const char* str);
  • 参数说明:
参数类型说明
返回值color_t*color对象。
ccolor_t*color对象。
strconst char*css类似的颜色值。

color_g 函数

  • 函数功能:

获取绿色通道的值。

主要供脚本语言使用。

  • 函数原型:
uint8_t color_g (color_t* c);
  • 参数说明:
参数类型说明
返回值uint8_t返回绿色通道的值。
ccolor_t*color对象。

color_get_color 函数

  • 函数功能:

获取颜色值。

主要供脚本语言使用。

  • 函数原型:
uint32_t color_get_color (color_t* c);
  • 参数说明:
参数类型说明
返回值uint32_t返回颜色值。
ccolor_t*color对象。

color_hex_str 函数

  • 函数功能:

获取16进制格式表示的颜色

  • 函数原型:
const char* color_hex_str (color_t c, char* str);
  • 参数说明:
参数类型说明
返回值const char*获取16进制字符串表示的颜色。
ccolor_tcolor对象。
strchar*内存。

color_init 函数

  • 函数功能:

初始化颜色对象。

  • 函数原型:
color_t color_init (uint8_t r, uint8_t g, uint8_t b, uint8_t a);
  • 参数说明:
参数类型说明
返回值color_t颜色对象。
ruint8_t红色。
guint8_t绿色。
buint8_t蓝色。
auint8_talpha。

color_r 函数

  • 函数功能:

获取红色通道的值。

主要供脚本语言使用。

  • 函数原型:
uint8_t color_r (color_t* c);
  • 参数说明:
参数类型说明
返回值uint8_t返回红色通道的值。
ccolor_t*color对象。

color_rgba_str 函数

  • 函数功能:

获取rgba格式表示的颜色

  • 函数原型:
const char* color_rgba_str (color_t c, char* str);
  • 参数说明:
参数类型说明
返回值const char*获取rgba格式表示的颜色。
ccolor_tcolor对象。
strchar*内存。

color 属性

颜色的数值。

  • 类型:uint32_t
特性是否支持
可直接读取
可直接修改
可脚本化

rgba 属性

颜色的RGBA值。

  • 类型:rgba_t
特性是否支持
可直接读取
可直接修改