static BufferedImage renderTiledBackground(S tileImageID, int w, int h) { ret renderTiledBackground(tileImageID, w, h, 0, 0); } static BufferedImage renderTiledBackground(S tileImageID, int w, int h, int shiftX, int shiftY) { BufferedImage tileImage = loadImage2(tileImageID); BufferedImage img = newBufferedImage(w, h, Color.black); Graphics2D g = img.createGraphics(); int tw = tileImage.getWidth(), th = tileImage.getHeight(); for (int x = mod(shiftX-1, tw)-tw+1; x < w; x += tw) for (int y = mod(shiftY-1, th)-th+1; y < h; y += th) g.drawImage(tileImage, x, y, null); g.dispose(); ret img; }