Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix blurry player skin #49

Merged
merged 1 commit into from
Jul 14, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -720,9 +720,12 @@ protected PopOver initInfo() {

private ImageView getSkin(String url) {
log.debug("Loading player skin from: " + url);
Image image = new Image(url);
// Download the image and set the requested size to 64 * 16, as 64 is the original image size and we need to
// scale this by 16 to extract the 8 pixels (8 of the original 64, now 8 * 16 pixels) from the scaled image,
// to reach 128 pixels in the extracted result.
Image image = new Image(url, 64 * 16, 64 * 16, true, false);
PixelReader reader = image.getPixelReader();
image = new WritableImage(reader, 8, 8, 8, 8);
image = new WritableImage(reader, 8 * 16, 8 * 16, 8 * 16, 8 * 16);

ImageView graphic = new ImageView(image);
graphic.setSmooth(false);
Expand Down