 |
Gridarta Editor
|
Go to the documentation of this file.
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();
91 throw new IllegalStateException(
"unsupported operation");
107 final BufferedImage image =
new BufferedImage(viewWidth, viewHeight, BufferedImage.TYPE_INT_ARGB);
108 final Graphics g = image.getGraphics();
119 throw new IllegalStateException(
"unsupported operation");
125 g.setColor(Color.white);
127 final Point point =
new Point();
128 for (point.y = 0; point.y < mapSize.
getHeight(); point.y++) {
129 for (point.x = 0; point.x < mapSize.
getWidth(); point.x++) {
140 private void paintSquare(@NotNull
final Graphics graphics, @NotNull
final Point point) {
141 if (
mapModel.getMapSquare(point).isEmpty()) {
151 final ImageIcon img = node.getNormalImage();
177 throw new IllegalStateException(
"unsupported operation");
int getWidth()
Returns the width of the area.
Rectangle getSquareBounds(@NotNull final Point p)
Returns coordinates, length and width of map square.
static final long serialVersionUID
The serial version UID.
A MapModel reflects the data of a map.
Base package of all Gridarta classes.
final Point offset
Temporary variable.
boolean getSquareLocationAt(@NotNull final Point point, @NotNull final Point retPoint)
Returns the map location at the given point.
static final String SQUARE_EMPTY
Graphical User Interface of Gridarta.
Abstract base class for classes implementing MapRenderer.
void paintComponent(@NotNull final Graphics g)
void paintSquare(@NotNull final Graphics graphics, @NotNull final Point point)
Paint one square.
Defines common UI constants used in different dialogs and all used icon files.
int getHeight()
Returns the height of the area.
Implements Crossfire archetypes.
MapArchObject contains the specific meta data about a map that is stored in the map-arch,...
Main package of Gridarta4Crossfire, contains all classes specific to the Crossfire version of the Gri...
int SQUARE_WIDTH
The width of a square in pixels.
final ResourceIcons resourceIcons
The ResourceIcons for creating icons.
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,...
void closeNotify()
Must be called when this renderer is not used anymore.
static final String SMOOTHLEVEL
The name of the "smoothlevel" attribute.
ImageIcon getResourceIcon(@NotNull final String iconName)
Returns the image icon for the given icon name.
static final String INVISIBLE
The name of the "invisible" attribute.
Renderer for smoothed faces as used by Crossfire.
Base classes for rendering maps.
Handles the Crossfire variants of GameObjects and Archetypes.
void forceRepaint()
Repaint the view because some view parameters may have changed.
Size2D getImageSize()
Returns the size of an image of the entire map view in pixels.
Handles the Crossfire GameObjects.
final MapModel< GameObject, MapArchObject, Archetype > mapModel
The map model to render.
Creates ImageIcon instances from resources.
Renders maps without MapGrid.
SimpleFlatMapRenderer(@NotNull final MapModel< GameObject, MapArchObject, Archetype > mapModel, @NotNull final ResourceIcons resourceIcons, @NotNull final SmoothingRenderer smoothingRenderer)
Creates a new instance.
BufferedImage getFullImage()
Returns an image of the entire map view.
final SmoothingRenderer smoothingRenderer
The SmoothingRenderer for rendering smoothed faces.
The class Size2D represents a 2d rectangular area.
int SQUARE_HEIGHT
The height of a square in pixels.