美文网首页
鸿蒙~ArkUI 基础 pixelMap

鸿蒙~ArkUI 基础 pixelMap

作者: 胡修波 | 来源:发表于2023-12-28 19:16 被阅读0次
    • pixelMap 创建
    private pixelMapReader = undefined
    
      createPixelMap() {
        let color = new ArrayBuffer(4 * 96 * 96);
        var buffer = new Uint8Array(color);
        for (var i = 0; i < buffer.length; i++) {
          buffer[i] = (i + 1) % 255;
        }
        let opts = {
          alphaType: 0,
          editable: true,
          pixelFormat: 4,
          scaleMode: 1,
          size: { height: 96, width: 96 }
        }
        const promise = image.createPixelMap(color, opts);
        promise.then((data) => {
          console.info(TAG,'create pixmap has info message: ' + JSON.stringify(data))
          this.pixelMapReader = data;
        })
    }
    

    相关文章

      网友评论

          本文标题:鸿蒙~ArkUI 基础 pixelMap

          本文链接:https://www.haomeiwen.com/subject/qzfxndtx.html