使用ArrayBufferView到ImageAsset问题

之前在2.4版本使用renderTexture的initWithData處理没问题,3.0后使用官方范例无法正常显示

    let yImageAsset = new ImageAsset({
        _data: y,
        _compressed: false,
        format: Texture2D.PixelFormat.I8,
        width: this.widthHalf,
        height: this.heightHalf
    })

    let yTexture = new Texture2D();
    yTexture.image = yImageAsset;
    this.sprite.spriteFrame = new SpriteFrame();
    let temp = new SpriteFrame();
    temp.texture = yTexture;
    this.sprite.spriteFrame = temp;

测试过data部分[0,0,0]也无法显示
请问各位大佬有方法解决吗?

1赞

同问,3.0版本之后initWithData()方法没有了,该如何获取图片的像素,需要对像素进行变色、变透明操作,谁有解决方法给推荐一下.

找到一些信息正在尝试解决
画板demo可以参考一下,里边有相关的代码
https://github.com/cocos-creator/CococsCreator-public-technology-solutions/tree/3.4.0-release/demo/Creator3.4.0_2D_DrawingBoard
这个文档也可以参考