I created a bufferedimage which i applied to a Rectangle to use as filling pattern to shape S. If i change S's position, the filling pattern changes with it instead of remaining "fixed". What could it be?
Image: (the pattern is a 3 stripes, all with the same aspect ratio) :
if (bannerPatternCreated == false) {
banner = new BufferedImage(size * 3, size * 3, BufferedImage.TYPE_INT_RGB);
Graphics2D gc = banner.createGraphics();
System.out.println("Creating banner...");
gc.setColor(Color.black);
gc.fillRect(0, 0, size, size * 3);
gc.setColor(Color.BLUE);
gc.fillRect(size, 0, size, size * 3);
gc.setColor(Color.WHITE);
gc.fillRect(size * 2, 0, size, size * 3);
gc.dispose();
bannerPatternCreated = true;
}
Rectangle patternPencil = new Rectangle(size, size);
g2.setPaint(new TexturePaint(banner, patternPencil));
Rectangle recto = new Rectangle(presentX-size, presentY-size, size, size);
g2.fill(recto);