私は Java Canvas を使用しており、1 秒間に約 20 回呼び出される draw メソッドがあります。画像の配列を反復処理し、ウィンドウ サイズに応じてそれらの scaledInstance を描画します。
g.drawImage(img.getScaledInstance(
(short)Math.round(rect.width * yVector),
(short)Math.round(rect.height * yVector),
Image.SCALE_SMOOTH),
(short)Math.round(rect.x * xVector),
(short)Math.round(rect.y * yVector), null);
パフォーマンスは本当に悪いです。私はバッファ戦略を使用しており、これが BufferedImage である画像の宣言方法です。
try {
image = ImageIO.read(new File("resources/drawable/" + src));
img = (BufferedImage)image.getImage();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}