简体   繁体   English

Java Slick scale没有抗锯齿的图像

[英]Java Slick scale Image without anti-aliasing

In the Slick library (based off of LWJGL), you can scale images after you load them with getScaledCopy , but it will apply anti-aliasing. 在Slick库(基于LWJGL)中,您可以在使用getScaledCopy加载图像后缩放图像,但它将应用消除锯齿。 I want the edges to stay rough; 我希望边缘保持粗糙; I'm making pixel art. 我正在制作像素艺术品。 How can I do this? 我怎样才能做到这一点?

Based on the comments: 根据评论:

The documentation implies that the filter property of Image s controls how images are scaled. 该文档暗示Imagefilter属性控制图像的缩放方式。 To scale an image without smoothing, use the nearest neighbour filter : 要在不平滑的情况下缩放图像,请使用最近邻居过滤器

Image original = …;
original.setFilter(Image.FILTER_NEAREST);
Image scaled = original.getScaledCopy();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM