XU XUv0.16.0

#image/png

导入方式: #image/png

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

PNG 编解码(8 位、非隔行)。

encode_rgba

XuAPI
pub fn encode_rgba(img &image.RGBA) string

用途

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

参数

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

返回值

string — 结果字符串

decode

XuAPI
pub fn decode(src &string) image.RGBA

用途

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

参数

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

返回值

image.RGBA — 该类型的值

decode_rgba8

XuAPI
pub fn decode_rgba8(src &[]u8) image.RGBA8

用途

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

参数

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

返回值

image.RGBA8 — 该类型的值

decode_rgba8_string

XuAPI
pub fn decode_rgba8_string(src &string) image.RGBA8

用途

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

参数

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

返回值

image.RGBA8 — 该类型的值

encode_rgba_bytes

XuAPI
pub fn encode_rgba_bytes(pixels &string,width int,height int) string

用途

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

参数

pixels &string
pixels(只读借用,调用方仍持有原值;类型 &string)
width int
width(int)
height int
height(int)

返回值

string — 结果字符串

encode_rgba8_string

XuAPI
pub fn encode_rgba8_string(img &image.RGBA8) string

用途

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

参数

img &image.RGBA8
img(只读借用,调用方仍持有原值;类型 &image.RGBA8)

返回值

string — 结果字符串

encode_rgba8

XuAPI
pub fn encode_rgba8(img &image.RGBA8) []u8

用途

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

参数

img &image.RGBA8
img(只读借用,调用方仍持有原值;类型 &image.RGBA8)

返回值

[]u8 — 切片结果