2015-09-11 270 views
1

我的图像是200px x 200px大小。当我试图将其绘制为100px x 100px时,图像呈现出令人难以置信且不可接受的状态。缩小图像质量损失

@Override 
public void render(SpriteBactch batch){ 
    batch.begin(); 
    batch.draw(img, 0, 0,100,100); 
    batch.end(); 
} 

当我DRAWIN这样的:

@Override 
public void render(SpriteBactch batch){ 
    batch.begin(); 
    batch.draw(img, 0, 0); 
    batch.end(); 
} 

它具有可接受的质量。我可以解决这个问题,怎么样?下面你可以找到从图像渲染截图:

enter image description here

+0

你是什么IMG?另外如果可能的话附上截图。缩小总是与一些质量松散有关,也许它就像它一样? –

+0

@ m.antkowicz试图把截图,但它不会让我因为我没有10个代表点,所以我上传图像在这里... http://s21.postimg.org/ef5hmdul3/problem.png 谢谢 – centenond

回答

2

尝试以应用纹理Linear TextureFilter

Texture texture = new Texture(... //creating your texture 

    texture.setFilter(TextureFilter.Linear, TextureFilter.Linear); //add this line 

    Sprite img = new Sprite(texture); 

请注意,当你缩放图片缩小总有质量松散的风险,所以你仍然可以不满意的结果。


要获取有关TextureFilter以及如何的一些信息来对付他们刚读:

http://www.badlogicgames.com/wordpress/?p=1403

+0

那么结果相当可以接受......谢谢先生! – centenond