public class SmoothingRenderer
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static int[] |
BORDER_CORNER_EXCLUDE
Corner excludes due to borders.
|
private static int |
BORDER_EAST
Border weight for east.
|
private static int |
BORDER_NORTH
Border weight for north.
|
private static int |
BORDER_SOUTH
Border weight for south.
|
private static int[] |
BORDER_WEIGHT
Weight (x coordinate) in smoothing face of a corner.
|
private static int |
BORDER_WEST
Border weight for west.
|
private static int |
CORNER_NORTHEAST
Corner weight for northeast.
|
private static int |
CORNER_NORTHWEST
Corner weight for northwest.
|
private static int |
CORNER_SOUTHEAST
Corner weight for southeast.
|
private static int |
CORNER_SOUTHWEST
Corner weight for southwest.
|
private static int[] |
CORNER_WEIGHT
Weight (x coordinate) in smoothing face of a corner.
|
private boolean[] |
done
Marks the indexes that have been painted.
|
private static int[] |
DX
X offset for map coordinate calculation.
|
private static int[] |
DY
Y offset for map coordinate calculation.
|
private FacesProvider |
facesProvider
The
FacesProvider for looking up faces. |
private boolean[] |
isUnknownImage
Temporary variable.
|
private CfMapSquare[][] |
layerNode
Surrounding
CfMapSquare map squares} having non-zero smooth
levels. |
private int[] |
smoothFace
Face index of the smooth face corresponding to
layerNode . |
private SmoothFaces |
smoothFaces
The
SmoothFaces to use. |
private int[] |
smoothValue
Smooth values corresponding to
layerNode . |
Modifier | Constructor and Description |
---|---|
protected |
SmoothingRenderer(SmoothFaces smoothFaces,
FacesProvider facesProvider)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
private static void |
drawImage(java.awt.Graphics graphics,
int dstX,
int dstY,
int srcX,
int srcY,
javax.swing.ImageIcon imageIcon,
int tileSize)
Draws a
tileSize x tileSize part of an ImageIcon . |
void |
paintSmooth(java.awt.Graphics graphics,
int x,
int y,
int px,
int py,
int layer,
CfMap map,
int tileSize)
Draw the smoothing information at given position of map, for a given
limit smoothlevel, at a given layer.
|
@NotNull private static final int[] BORDER_CORNER_EXCLUDE
private static final int BORDER_EAST
private static final int BORDER_NORTH
private static final int BORDER_SOUTH
@NotNull private static final int[] BORDER_WEIGHT
private static final int BORDER_WEST
private static final int CORNER_NORTHEAST
private static final int CORNER_NORTHWEST
private static final int CORNER_SOUTHEAST
private static final int CORNER_SOUTHWEST
@NotNull private static final int[] CORNER_WEIGHT
@NotNull private final boolean[] done
@NotNull private static final int[] DX
@NotNull private static final int[] DY
@NotNull private final FacesProvider facesProvider
FacesProvider
for looking up faces.@NotNull private final boolean[] isUnknownImage
@NotNull private final CfMapSquare[][] layerNode
CfMapSquare
map squares} having non-zero smooth
levels.@NotNull private final int[] smoothFace
layerNode
. Maps
index to face index.@NotNull private final SmoothFaces smoothFaces
SmoothFaces
to use.@NotNull private final int[] smoothValue
layerNode
. Maps index to smooth
value.protected SmoothingRenderer(@NotNull SmoothFaces smoothFaces, @NotNull FacesProvider facesProvider)
smoothFaces
- the smooth faces to usefacesProvider
- the face provider for looking up facesprivate static void drawImage(@NotNull java.awt.Graphics graphics, int dstX, int dstY, int srcX, int srcY, @NotNull javax.swing.ImageIcon imageIcon, int tileSize)
tileSize
x tileSize
part of an ImageIcon
.graphics
- the graphics to paint todstX
- the x coordinate to paint todstY
- the y coordinate to paint tosrcX
- the x coordinate to copy from imageIcon
srcY
- the y coordinate to copy from imageIcon
imageIcon
- the image icon to copy fromtileSize
- the size in pixels to copypublic void paintSmooth(@NotNull java.awt.Graphics graphics, int x, int y, int px, int py, int layer, @NotNull CfMap map, int tileSize)
graphics
- where to draw (graphics)x
- the x-coordinate of the map square to draw, in map coordinatesy
- the y-coordinate of the map square to draw, in map coordinatespx
- the x offset for paintingpy
- the y offset paintinglayer
- the layer to paintmap
- the rendered maptileSize
- the size of one tile in pixel