public class MapBuffer
extends java.lang.Object
Constructor and Description |
---|
MapBuffer() |
Modifier and Type | Method and Description |
---|---|
void |
clearBuffer()
Forces all tiles to be redrawn on the next draw operation.
|
void |
copyPixels(int[] data,
int srcPos,
int x,
int z,
int size)
Copies a contiguous block of pixels into the buffer.
|
void |
drawBuffered(javafx.scene.canvas.GraphicsContext gc)
Draws the current buffered map to a map canvas (via a GraphicsContext).
|
void |
drawTile(WorldMapLoader mapLoader,
ChunkPosition chunk)
Redraws the given tile.
|
void |
drawTileCached(WorldMapLoader mapLoader,
ChunkPosition chunk)
Attempts to draw the tile using cached image.
|
ChunkView |
getView() |
Block |
highlightBlock() |
javafx.scene.paint.Color |
highlightColor() |
boolean |
highlightEnabled() |
void |
redrawView(WorldMapLoader mapLoader)
Redraw all tiles in the current view.
|
void |
renderPng(java.io.File targetFile)
Write the map to a PNG image.
|
void |
updateView(ChunkView newView,
WorldMapLoader loader)
Called when this render buffer should buffer another view.
|
public void updateView(ChunkView newView, WorldMapLoader loader)
public ChunkView getView()
public void drawTile(WorldMapLoader mapLoader, ChunkPosition chunk)
public void drawTileCached(WorldMapLoader mapLoader, ChunkPosition chunk)
public void redrawView(WorldMapLoader mapLoader)
public void copyPixels(int[] data, int srcPos, int x, int z, int size)
public void drawBuffered(javafx.scene.canvas.GraphicsContext gc)
Drawing the image would be much simpler if we could rely on JavaFX for scaling the image, unfortunately if JavaFX is used to scale the image it will use a blurry upscaling algorithm which looks bad for the 2D map. It is not possible to disable the JavaFX scaling interpolation, so we do our own scaling here instead.
public boolean highlightEnabled()
public Block highlightBlock()
public javafx.scene.paint.Color highlightColor()
public void clearBuffer()
public void renderPng(java.io.File targetFile) throws java.io.IOException
java.io.IOException