Class MapBuffer
java.lang.Object
studio.magemonkey.codex.mccore.gui.MapImage
studio.magemonkey.codex.mccore.gui.MapBuffer
A specific MapImage used to represent a full map canvas
and draw to it as efficiently as possible.
Just as a comparison between render methods: - Built in MapCanvas.drawImage: ~40ms for 128x128 image - Slow MapBuffer method: ~ 0.08ms for 128x128 image - Fast MapBuffer method: ~ 0.001ms for 128x128 image
In other words: - Slow MapBuffer method is ~500x faster than MapCanvas.drawImage - Fast MapBuffer method is ~40,000x faster than MapCanvas.drawImage
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionMapBuffer(org.bukkit.map.MapView view) Initializes a new MapBuffer with a size of 128x128 that acts as a buffer for the given MapView -
Method Summary
Modifier and TypeMethodDescriptionvoiddrawTo(org.bukkit.map.MapCanvas canvas) Efficiently draws the buffer to the canvasbooleanChecks whether or not fast drawing is supported.Methods inherited from class studio.magemonkey.codex.mccore.gui.MapImage
clear, drawColorString, drawImg, drawString, drawTo, fill, getColor, getData, getHeight, getWidth, init, matchColor
-
Field Details
-
bounds
protected final int[] bounds -
dirty
protected boolean dirty
-
-
Constructor Details
-
MapBuffer
public MapBuffer(org.bukkit.map.MapView view) Initializes a new MapBuffer with a size of 128x128 that acts as a buffer for the given MapView
-
-
Method Details
-
fastDrawSupported
public boolean fastDrawSupported()Checks whether or not fast drawing is supported. Fast drawing can handle thousands of draws every tick while normal drawing can only handle about 50-100 maximum.- Returns:
- true if fast drawing is supported on this server, false otherwise
-
drawTo
public void drawTo(org.bukkit.map.MapCanvas canvas) Efficiently draws the buffer to the canvas- Parameters:
canvas- canvas to draw to
-