CocoonJS:抗锯齿功能不起作用(预渲染)

时间:2013-12-31 02:13:48

标签: javascript html5 canvas prerender cocoonjs

我在使用CocoonJS进行画布预渲染方面存在很大问题 一个问题是,当我渲染到离屏画布时,抗锯齿根本不起作用。

这是一个例子:
我使用以下代码创建一个主画布:

if (navigator.isCocoonJS) {
    CocoonJS.App.setAntialias(true);
}
me.canvas = document.createElement(navigator.isCocoonJS ? 'screencanvas' : 'canvas');
document.body.appendChild(me.canvas);
me.ctx= me.canvas.getContext("2d");

稍后,我渲染应该预渲染的图像:

    create: function(image,width,height) {
        var multiplier = 1;
        this.baseWidth = width;
        this.baseHeight = height;
        this.canvas=document.createElement('canvas');
        this.canvas.width=spiel.PathImage.buffer.nextHigherBase2(width*multiplier);
        this.canvas.height=spiel.PathImage.buffer.nextHigherBase2(height*multiplier);
        this.ctx=this.canvas.getContext('2d');
        /* ... draw image */
        return this;
    }

完成此操作后,我渲染图像:

ctx.drawImage(can.canvas,0,0,can.baseWidth,can.baseHeight,x,y,width,height);

这是CocoonJS Launcher 1.4(前层)中的结果:

enter image description here

这就是它应该是什么样子(Google Chrome): enter image description here

0 个答案:

没有答案
相关问题