开发者工具版本:1.06.2412050
操作系统:windows,cocos creator
出现问题:使用wx.createCanvas画的图,在微信开发工具中可以正常输出展示,在真机中就不能展示
代码:
@property(Billboard)
public selfBillboard: Billboard = new Billboard();
private _ctx:CanvasRenderingContext2D = null;
private _selfImg: ImageAsset = new ImageAsset();
private _selfTexture: Texture2D = new Texture2D();
let cc = wx.createCanvas();
cc.width = this.canvasWidth + this._iconSize.width;
cc.height = this.canvasWidth / this.whRatio;
this._ctx = cc.getContext("2d");
//这里随便画一些东西
this._selfImg.reset(this._ctx.canvas);
this._selfTexture.image = this._selfImg;
this.selfBillboard.texture = this._selfTexture;
上面的代码在模拟器中就能正常展示出来内容,在真机中就不行
问题已解决,上下文设置fillStyle颜色的时候要使用rgba模式,不能用十六进制