Package org.spongepowered.api.map
Interface MapCanvas
-
- All Superinterfaces:
DataSerializable
public interface MapCanvas extends DataSerializable
AMapCanvas
represents 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 interface
MapCanvas.Builder
A builder that creates aMapCanvas
.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static MapCanvas
blank()
Creates aMapCanvas
where all pixels are set toMapColorTypes.NONE
.static MapCanvas.Builder
builder()
Creates a builder for creating a newMapCanvas
.MapColor
color(int x, int y)
Gets theMapColor
at the given location.MapCanvas.Builder
toBuilder()
Creates aMapCanvas.Builder
populated with the state of thisMapCanvas
.Image
toImage()
Image
toImage(Color color)
Generates anImage
from thisMapCanvas
, where any pixels that representMapColorTypes.NONE
will 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.Builder
to generate a new canvas.
-
blank
static MapCanvas blank()
Creates aMapCanvas
where all pixels are set toMapColorTypes.NONE
.- Returns:
- A blank canvas
-
color
MapColor color(int x, int y) throws IllegalArgumentException
Gets theMapColor
at the given location.- Parameters:
x
- The x locationy
- The y location- Returns:
- The
MapColor
at the location - Throws:
IllegalArgumentException
- if either of the requested co-ordinates are out of bounds.
-
toImage
Image toImage(Color color)
Generates anImage
from thisMapCanvas
, where any pixels that representMapColorTypes.NONE
will be replaced with the suppliedColor
.- Parameters:
color
- theColor
used in place ofMapColorTypes.NONE
- Returns:
- An
Image
-
toBuilder
MapCanvas.Builder toBuilder()
Creates aMapCanvas.Builder
populated with the state of thisMapCanvas
.Changes to the returned builder will not affect this canvas.
- Returns:
- A
MapCanvas.Builder
-
-