[LayaAirIDE 2.0]Texture2D.setPixels会导致图片质量变差了,获取原生的pixels没有进行改动。怎么回事呢?
代码如下:
var url = "res/textures/marry_frame_005.png";
url= Laya.URL.formatURL(url);
var imageSource=new Laya.Browser.window.Image();
var thisObj = this;
var onload=function (){
var tex=new Laya.Texture2D(imageSource.width,imageSource.height,1,false,true);
tex.wrapModeU=1;
tex.wrapModeV=1;
tex.loadImageSource(imageSource,true);
tex._setCreateURL(url);
var tex2=new Laya.Texture(tex);
tex2.url=url;
var image:Laya.Image = new Laya.Image();
image.source = tex2;
image.name = "waken";
image.size(823,492);
image.centerX=0;
image.centerY=1;
thisObj.addChild(image);
};
/**加载完图片后点击事件重新设置pixels*/
var imageNode:Laya.Image = this.getChildByName("waken") as Laya.Image;
var imageSprite:Laya.Sprite;
var uint8Array:Uint8Array = imageNode.source.bitmap.getPixels();
//console.log("0000000000000 == " + uint8Array.length);
imageNode.source.bitmap.setPixels(uint8Array,0);
var url = "res/textures/marry_frame_005.png";
url= Laya.URL.formatURL(url);
var imageSource=new Laya.Browser.window.Image();
var thisObj = this;
var onload=function (){
var tex=new Laya.Texture2D(imageSource.width,imageSource.height,1,false,true);
tex.wrapModeU=1;
tex.wrapModeV=1;
tex.loadImageSource(imageSource,true);
tex._setCreateURL(url);
var tex2=new Laya.Texture(tex);
tex2.url=url;
var image:Laya.Image = new Laya.Image();
image.source = tex2;
image.name = "waken";
image.size(823,492);
image.centerX=0;
image.centerY=1;
thisObj.addChild(image);
};
/**加载完图片后点击事件重新设置pixels*/
var imageNode:Laya.Image = this.getChildByName("waken") as Laya.Image;
var imageSprite:Laya.Sprite;
var uint8Array:Uint8Array = imageNode.source.bitmap.getPixels();
//console.log("0000000000000 == " + uint8Array.length);
imageNode.source.bitmap.setPixels(uint8Array,0);
没有找到相关结果
已邀请:
要回复问题请先登录
0 个回复