20 package net.sf.gridarta.gui.map.renderer;
22 import java.awt.Color;
23 import java.awt.Graphics;
24 import java.awt.Graphics2D;
25 import java.awt.Point;
26 import java.awt.Rectangle;
27 import java.awt.image.BufferedImage;
35 import org.jetbrains.annotations.NotNull;
70 private final Point
origin =
new Point();
89 final Rectangle rec =
new Rectangle(0, 0, mapSize.
getWidth(), mapSize.
getHeight());
90 final Point pos =
new Point();
91 final Point endPos = rec.getLocation();
92 endPos.translate(rec.width, rec.height);
93 for (pos.y = rec.y; pos.y < endPos.y; pos.y++) {
96 for (pos.x = rec.x; pos.x < endPos.x; pos.x++) {
104 for (
final G node : square) {
105 paint(graphics, xStart, yStart, node);
122 protected abstract void paint(@NotNull Graphics2D graphics2D,
int xStart,
int yStart, @NotNull G gameObject);
135 throw new IllegalStateException(
"operation not supported");
141 throw new IllegalStateException(
"operation not supported");
155 final BufferedImage image =
new BufferedImage(viewWidth, viewHeight, BufferedImage.TYPE_INT_ARGB);
156 final Graphics2D graphics = image.createGraphics();
158 graphics.fillRect(0, 0, viewWidth, viewHeight);
167 throw new IllegalStateException(
"operation not supported");
178 throw new IllegalStateException(
"unsupported operation");