30 BK.Image 图片

优质
小牛编辑
110浏览
2023-12-01

方法

打开图片 loadImage(path, format)

参数类型名称备注
pathstring图片文件路径
formatnumberRGB格式(可选)

返回值:

类型名称备注
ObjectBK.Image对象

例子:

var image = BK.Image.loadImage("GameRes://resource/texture/icon.png");

保存图片 saveImage(buffer, width, height, path, type)

参数类型名称备注
ObjectBK.Buffer对象图片缓存
widthnumber图片宽
heightnumber图片高
pathstring图片名
typestring图片后缀

返回值:

类型名称备注
boolean写成功与否

例子:

var succ = BK.Image.saveImage(buff, this.size.width, this.size.height, path, type);