接口 MapCanvas
地图渲染器
并表现为地图上渲染器的一层.-
方法概要
修饰符和类型方法说明void
画一张图片到地图上,如果必要的话,图像将被裁剪.void
使用你想要的格式渲染文字到地图上.换行符(\n)会移动到下一行并返回原来的列, 字体颜色可以使用带字符的数字来改变如"§12;",这会把字体颜色换为颜色表中 第12个颜色(参考MapPalette
).byte
getBasePixel
(int x, int y) 已过时。getBasePixelColor
(int x, int y) Get a pixel from the layers below this canvas.获取与该画布相关联的游标集合.获取画布依附的地图.byte
getPixel
(int x, int y) 已过时。魔法值, 请使用getPixelColor(int, int)
getPixelColor
(int x, int y) Get a pixel from the canvas.void
setCursors
(@NotNull MapCursorCollection cursors) 设置与该画布相关联的游标集合,自从地图游标集合(MapCursorCollection)提供后这个方法通常不需要被调用.void
setPixel
(int x, int y, byte color) 已过时。魔法值, 请使用setPixelColor(int, int, Color)
void
setPixelColor
(int x, int y, @Nullable Color color) Draw a pixel to the canvas.
-
方法详细资料
-
getMapView
获取画布依附的地图.原文:Get the map this canvas is attached to.
- 返回:
- 画布依附的地图控件
-
getCursors
获取与该画布相关联的游标集合.原文:Get the cursor collection associated with this canvas.
- 返回:
- 与该画布相关联的游标集合
-
setCursors
设置与该画布相关联的游标集合,自从地图游标集合(MapCursorCollection)提供后这个方法通常不需要被调用.原文:Set the cursor collection associated with this canvas. This does not usually need to be called since a MapCursorCollection is already provided.
- 参数:
cursors
- 与画布相关联的游标集合
-
setPixelColor
Draw a pixel to the canvas.The provided color might be converted to another color, which is in the map color range. This means, that
getPixelColor(int, int)
might return another color than set. If null is used as color, then the color returned bygetBasePixelColor(int, int)
is shown on the map.- 参数:
x
- The x coordinate, from 0 to 127.y
- The y coordinate, from 0 to 127.color
- The color.
-
getPixelColor
Get a pixel from the canvas. If no color is set at the given position for this canvas, then null is returned and the color returned bygetBasePixelColor(int, int)
is shown on the map.- 参数:
x
- The x coordinate, from 0 to 127.y
- The y coordinate, from 0 to 127.- 返回:
- The color, or null if no color is set.
-
getBasePixelColor
Get a pixel from the layers below this canvas.- 参数:
x
- The x coordinate, from 0 to 127.y
- The y coordinate, from 0 to 127.- 返回:
- The color.
-
setPixel
已过时。魔法值, 请使用setPixelColor(int, int, Color)
画一个像素到画布上.原文:Draw a pixel to the canvas.
- 参数:
x
- x坐标值,从0到127y
- y坐标值,从0到127color
- 颜色,参考MapPalette
-
getPixel
已过时。魔法值, 请使用getPixelColor(int, int)
获取画布上的一个像素.原文:Get a pixel from the canvas.
- 参数:
x
- x坐标值,从0到127y
- y坐标值,从0到127- 返回:
- 颜色. 参阅
MapPalette
.
-
getBasePixel
已过时。魔法值, 请使用getBasePixelColor(int, int)
获取画布下层的一个像素.原文:Get a pixel from the layers below this canvas.
- 参数:
x
- x坐标值,从0到127y
- y坐标值,从0到127- 返回:
- 颜色. 参阅
MapPalette
.
-
drawImage
画一张图片到地图上,如果必要的话,图像将被裁剪.原文:Draw an image to the map. The image will be clipped if necessary.
- 参数:
x
- 图片的x坐标y
- 图片的y坐标image
- 要画的图片
-
drawText
使用你想要的格式渲染文字到地图上.换行符(\n)会移动到下一行并返回原来的列, 字体颜色可以使用带字符的数字来改变如"§12;",这会把字体颜色换为颜色表中 第12个颜色(参考MapPalette
).原文:Render text to the map using fancy formatting. Newline (\n) characters will move down one line and return to the original column, and the text color can be changed using sequences such as "§12;", replacing 12 with the palette index of the color (see
MapPalette
).- 参数:
x
- 开始渲染的列y
- 开始渲染的行font
- 使用的字体text
- 要渲染的格式化文字
-
getBasePixelColor(int, int)