var uint8Y = new Uint8Array(this.currentY.buffer),
this.texture2D.initWithData(uint8Y,cc.Texture2D.PIXEL_FORMAT_I8,codedWidth,height,size);
为什么没有效果?
var uint8Y = new Uint8Array(this.currentY.buffer),
this.texture2D.initWithData(uint8Y,cc.Texture2D.PIXEL_FORMAT_I8,codedWidth,height,size);
为什么没有效果?
目前它接受的是 uint16 数组,并且有诸多限制,比如不能在 Canvas 模式下使用,实际上这个 API 只是内部使用,如果需要用 data,建议转换成 base64 格式,并创建 Image 对象,再使用 initWithElement 来创建 Texture
如果用image对象 打包成android后 也没法用呢
能给个demo吗?微信接口返回的图片数据流怎么在cocoscreator里面显示啊
2.4.x 版本中可以这样用:
const buff = new Uint8Array(data)
texture2.initWithData(buff, cc.Texture2D.PixelFormat.RGBA8888, srcTexture.width, srcTexture.height)