Skip to content

Instantly share code, notes, and snippets.

@metaphore
Last active March 22, 2023 07:04
Show Gist options
  • Save metaphore/ce78cafbd1ebdde02903 to your computer and use it in GitHub Desktop.
Save metaphore/ce78cafbd1ebdde02903 to your computer and use it in GitHub Desktop.
[LibGDX] Resize texture on load
Pixmap pixmap200 = new Pixmap(Gdx.files.internal("200x200.png"));
Pixmap pixmap100 = new Pixmap(100, 100, pixmap200.getFormat());
pixmap100.drawPixmap(pixmap200,
0, 0, pixmap200.getWidth(), pixmap200.getHeight(),
0, 0, pixmap100.getWidth(), pixmap100.getHeight()
);
Texture texture = new Texture(pixmap100);
pixmap200.dispose();
pixmap100.dispose();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment