gx

gx模块比较简单,主要维护了颜色,图像和字体配置这三个结构体,目前主要给gg模块使用

  • Color //颜色

    1. pub struct Color {
    2. pub:
    3. r int
    4. g int
    5. b int
    6. }

    gx.rgb(r, g, b int) Color //创建颜色

    c.eq(b Color) bool //判断2个颜色是否相等

    c.str() string //颜色的字符串输出

    同时维护了一些标准的颜色常量:

    gx.blue

    gx.red

  • Image //图像

    1. pub struct Image {
    2. mut:
    3. obj voidptr //图像数据的首字节指针
    4. pub:
    5. id int //图像id
    6. width int //图像宽度
    7. height int //图像高度
    8. }

    i.is_empty() bool //判断图像对象是否为空

  • FontCfg //字体配置

    1. pub struct TextCfg {
    2. pub:
    3. color Color
    4. size int
    5. align int
    6. max_width int
    7. family string
    8. bold bool
    9. mono bool
    10. }