Package org.spongepowered.api.map
Interface MapCanvas
-
- All Superinterfaces:
DataSerializable
public interface MapCanvas extends DataSerializable
AMapCanvasrepresents the image that is drawn on aItemTypes.FILLED_MAP.A canvas in vanilla Minecraft is 128x128 pixels.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceMapCanvas.BuilderA builder that creates aMapCanvas.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static MapCanvasblank()Creates aMapCanvaswhere all pixels are set toMapColorTypes.NONE.static MapCanvas.Builderbuilder()Creates a builder for creating a newMapCanvas.MapColorcolor(int x, int y)Gets theMapColorat the given location.MapCanvas.BuildertoBuilder()Creates aMapCanvas.Builderpopulated with the state of thisMapCanvas.java.awt.ImagetoImage()Generates anImagefrom thisMapCanvas.java.awt.ImagetoImage(java.awt.Color color)Generates anImagefrom thisMapCanvas, where any pixels that representMapColorTypes.NONEwill be replaced with the suppliedColor.-
Methods inherited from interface org.spongepowered.api.data.persistence.DataSerializable
contentVersion, toContainer
-
-
-
-
Method Detail
-
builder
static MapCanvas.Builder builder()
Creates a builder for creating a newMapCanvas.- Returns:
- A
MapCanvas.Builderto generate a new canvas.
-
blank
static MapCanvas blank()
Creates aMapCanvaswhere all pixels are set toMapColorTypes.NONE.- Returns:
- A blank canvas
-
color
MapColor color(int x, int y) throws java.lang.IllegalArgumentException
Gets theMapColorat the given location.- Parameters:
x- The x locationy- The y location- Returns:
- The
MapColorat the location - Throws:
java.lang.IllegalArgumentException- if either of the requested co-ordinates are out of bounds.
-
toImage
java.awt.Image toImage()
Generates anImagefrom thisMapCanvas.- Returns:
- An
Image
-
toImage
java.awt.Image toImage(java.awt.Color color)
Generates anImagefrom thisMapCanvas, where any pixels that representMapColorTypes.NONEwill be replaced with the suppliedColor.- Parameters:
color- theColorused in place ofMapColorTypes.NONE- Returns:
- An
Image
-
toBuilder
MapCanvas.Builder toBuilder()
Creates aMapCanvas.Builderpopulated with the state of thisMapCanvas.Changes to the returned builder will not affect this canvas.
- Returns:
- A
MapCanvas.Builder
-
-