接口 MapCanvas
地图渲染器并表现为地图上渲染器的一层.-
方法概要
修饰符和类型方法说明void画一张图片到地图上,如果必要的话,图像将被裁剪.void使用你想要的格式渲染文字到地图上.换行符(\n)会移动到下一行并返回原来的列, 字体颜色可以使用带字符的数字来改变如"§12;",这会把字体颜色换为颜色表中 第12个颜色(参考MapPalette).bytegetBasePixel(int x, int y) 已过时。getBasePixelColor(int x, int y) 从画布下方的图层获取一个像素。获取与该画布相关联的游标集合.获取画布依附的地图.bytegetPixel(int x, int y) 已过时。魔法值, 请使用getPixelColor(int, int)getPixelColor(int x, int y) 从画布获取一个像素。voidsetCursors(@NotNull MapCursorCollection cursors) 设置与该画布相关联的游标集合,自从地图游标集合(MapCursorCollection)提供后这个方法通常不需要被调用.voidsetPixel(int x, int y, byte color) 已过时。魔法值, 请使用setPixelColor(int, int, Color)voidsetPixelColor(int x, int y, @Nullable Color color) 向画布绘制一个像素。
-
方法详细资料
-
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.
提供的颜色可能会被转换为地图颜色范围内的另一种颜色。 这意味着
getPixelColor(int, int)返回的颜色可能与设置的颜色不同。如果使用 null 作为颜色,则地图上会显示
getBasePixelColor(int, int)返回的颜色。- 参数:
x- x 坐标,从 0 到 127。y- y 坐标,从 0 到 127。color- 颜色。
-
getPixelColor
从画布获取一个像素。原文:Get a pixel from the canvas.
如果此画布在给定位置没有设置颜色,则返回 null, 地图上会显示
getBasePixelColor(int, int)返回的颜色。- 参数:
x- x 坐标,从 0 到 127。y- y 坐标,从 0 到 127。- 返回:
- 颜色,如果未设置颜色则为 null。
-
getBasePixelColor
从画布下方的图层获取一个像素。原文:Get a pixel from the layers below this canvas.
- 参数:
x- x 坐标,从 0 到 127。y- y 坐标,从 0 到 127。- 返回:
- 颜色。
-
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)