XU XUv0.16.0

#image/gif

导入方式: #image/gif

公开 API: 3 函数, 0 方法, 1 类型, 0 常量, 0 方法集

GIF 首帧解码与 RGBA 编码。

struct GIF

XuAPI
pub struct GIF {
    pub width int
    pub height int
    pub img image.RGBA
}

用途

承载 width、height、img 等属性的结构体。

公开字段

width int
字段(int)
height int
字段(int)
img image.RGBA
字段(image.RGBA)

decode

XuAPI
pub fn decode(src &string) GIF

用途

从编码数据中还原原始数据。失败时抛出错误,调用方需处理或继续传播。

参数

src &string
源数据(只读借用,调用方仍持有原值;类型 &string)

返回值

GIF — 该类型的值

at

XuAPI
pub fn at(g &GIF, x int, y int) color.RGBA

用途

执行 at 处理。

参数

g &GIF
g(只读借用,调用方仍持有原值;类型 &GIF)
x int
值(int)
y int
值(int)

返回值

color.RGBA — 该类型的值

encode_rgba

XuAPI
pub fn encode_rgba(img &image.RGBA, pal &[]color.RGBA) string

用途

编码 rgba 数据。失败时抛出错误,调用方需处理或继续传播。

参数

img &image.RGBA
img(只读借用,调用方仍持有原值;类型 &image.RGBA)
pal &[]color.RGBA
pal(只读借用,调用方仍持有原值;类型 &[]color.RGBA)

返回值

string — 结果字符串