add isometric head renderer
Some checks failed
Deploy App / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Failing after 30s

This commit is contained in:
Lee
2024-04-11 03:08:17 +01:00
parent 557c0facb7
commit 8e5adf337a
13 changed files with 284 additions and 70 deletions

View File

@ -0,0 +1,25 @@
package cc.fascinated.common;
import jakarta.validation.constraints.NotNull;
import java.awt.*;
import java.awt.geom.AffineTransform;
import java.awt.image.BufferedImage;
public class ImageUtils {
/**
* Resize an image.
*
* @param src the source image
* @param scale the scale factor
* @return the scaled image
*/
public static BufferedImage resize(@NotNull final BufferedImage src, final double scale) {
BufferedImage scaled = new BufferedImage((int) (src.getWidth() * scale), (int) (src.getHeight() * scale), BufferedImage.TYPE_INT_ARGB);
Graphics2D graphics = scaled.createGraphics();
graphics.drawImage(src, AffineTransform.getScaleInstance(scale, scale), null);
graphics.dispose();
return scaled;
}
}