i using webgl based framework pixi.js game , try apply bicubic scaling filter. performance isn't important in case.
here can see example made css:
please check chrome optimized jsfiddle.
this code linear scaled image:
var stage = new pixi.stage(0xffffff, true); var bg = pixi.sprite.fromimage("image.png"); bg.scale.x = .125; bg.scale.y = .25; stage.addchild(bg); var renderer = pixi.autodetectrenderer(93, 79); document.body.appendchild(renderer.view); var texturehasloaded = false; checkiftexturehasloaded(); function checkiftexturehasloaded(){ if (bg.texture.basetexture.hasloaded){ texturehasloaded = true; rendertexture(); } if (!texturehasloaded){ requestanimframe(checkiftexturehasloaded); } } function rendertexture(){ renderer.render(stage); }
for pixi.js versions 3.0 , above default scaling can set changing pixi.scale_modes.default:
pixi.scale_modes.default = pixi.scale_modes.nearest;
for pixi.js versions 1.5.0 , above constants have been moved , scaling set as:
pixi.scalemodes.default = pixi.scalemodes.nearest;
Comments
Post a Comment