20 package net.sf.gridarta.var.crossfire.gui.map.renderer;
22 import java.awt.Color;
23 import java.awt.Graphics;
24 import java.awt.Point;
25 import java.awt.Rectangle;
26 import java.awt.image.BufferedImage;
27 import javax.swing.ImageIcon;
37 import org.jetbrains.annotations.NotNull;
68 private final Point
offset =
new Point();
83 super(mapModel, null);
91 throw new IllegalStateException();
100 final BufferedImage image =
new BufferedImage(viewWidth, viewHeight, BufferedImage.TYPE_INT_ARGB);
101 final Graphics g = image.getGraphics();
112 throw new IllegalStateException();
118 g.setColor(Color.white);
120 final Point point =
new Point();
121 for (point.y = 0; point.y < mapSize.
getHeight(); point.y++) {
122 for (point.x = 0; point.x < mapSize.
getWidth(); point.x++) {
133 private void paintSquare(@NotNull
final Graphics graphics, @NotNull
final Point point) {
144 final ImageIcon img = node.getNormalImage();
159 smoothingRenderer.
paintSmooth(graphics, point, 1, layer + 1,
true, 0, 0);
170 throw new IllegalStateException();
Renders maps without MapGrid.
final Point offset
Temporary variable.
A MapModel reflects the data of a map.
Graphical User Interface of Gridarta.
final MapModel< GameObject, MapArchObject, Archetype > mapModel
The map model to render.
static final String SMOOTHLEVEL
The name of the "smoothlevel" attribute.
int SQUARE_HEIGHT
The height of a square in pixels.
MapArchObject contains the specific meta data about a map that is stored in the map-arch, at the very beginning of the map file.
Handles the Crossfire variants of GameObjects and Archetypes.
void paintComponent(@NotNull final Graphics g)
Handles the Crossfire GameObjects.
Renderer for smoothed faces as used by Crossfire.
void forceRepaint()
Repaint the view because some view parameters may have changed.
Base package of all Gridarta classes.
Abstract base class for classes implementing MapRenderer.
Implements Crossfire archetypes.
SimpleFlatMapRenderer(@NotNull final MapModel< GameObject, MapArchObject, Archetype > mapModel, @NotNull final ResourceIcons resourceIcons, @NotNull final SmoothingRenderer smoothingRenderer)
Creates a new instance.
MapSquare< G, A, R > getMapSquare(@NotNull Point pos)
Get the square at a specified location.
int getWidth()
Returns the width of the area.
Defines common UI constants used in different dialogs and all used icon files.
Rectangle getSquareBounds(@NotNull final Point p)
Returns coordinates, length and width of map square.
Base classes for rendering maps.
Main package of Gridarta4Crossfire, contains all classes specific to the Crossfire version of the Gri...
static final String INVISIBLE
The name of the "invisible" attribute.
BufferedImage getFullImage()
Returns an image of the entire map view.
void paintSquare(@NotNull final Graphics graphics, @NotNull final Point point)
Paint one square.
static final long serialVersionUID
The serial version UID.
A getMapArchObject()
Returns the Map Arch Object with the meta information about the map.
Creates ImageIcon instances from resources.
static final String SQUARE_EMPTY
ImageIcon getResourceIcon(@NotNull final String iconName)
Returns the image icon for the given icon name.
int getHeight()
Returns the height of the area.
boolean getSquareLocationAt(@NotNull final Point point, @NotNull final Point retPoint)
Returns the map location at the given point.
int SQUARE_WIDTH
The width of a square in pixels.
void paintSmooth(@NotNull final Graphics graphics, @NotNull final Point pos, final int level, final int firstLayer, final boolean allLayers, final int borderOffsetX, final int borderOffsetY)
Draw the smoothing information at given position of map, for a given limit smoothlevel, at a given layer.
The class Size2D represents a 2d rectangular area.
final ResourceIcons resourceIcons
The ResourceIcons for creating icons.
final SmoothingRenderer smoothingRenderer
The SmoothingRenderer for rendering smoothed faces.