Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
MapCanvas.java
1 package org.bukkit.map;
2 
3 import java.awt.Image;
4 
5 /**
6  * Represents a canvas for drawing to a map. Each canvas is associated with a
7  * specific {@link MapRenderer} and represents that renderer's layer on the
8  * map.
9  */
10 public interface MapCanvas {
11 
12  /**
13  * Get the map this canvas is attached to.
14  *
15  * @return The MapView this canvas is attached to.
16  */
17  public MapView getMapView();
18 
19  /**
20  * Get the cursor collection associated with this canvas.
21  *
22  * @return The MapCursorCollection associated with this canvas.
23  */
25 
26  /**
27  * Set the cursor collection associated with this canvas. This does not
28  * usually need to be called since a MapCursorCollection is already
29  * provided.
30  *
31  * @param cursors The MapCursorCollection to associate with this canvas.
32  */
33  public void setCursors(MapCursorCollection cursors);
34 
35  /**
36  * Draw a pixel to the canvas.
37  *
38  * @param x The x coordinate, from 0 to 127.
39  * @param y The y coordinate, from 0 to 127.
40  * @param color The color. See {@link MapPalette}.
41  */
42  public void setPixel(int x, int y, byte color);
43 
44  /**
45  * Get a pixel from the canvas.
46  *
47  * @param x The x coordinate, from 0 to 127.
48  * @param y The y coordinate, from 0 to 127.
49  * @return The color. See {@link MapPalette}.
50  */
51  public byte getPixel(int x, int y);
52 
53  /**
54  * Get a pixel from the layers below this canvas.
55  *
56  * @param x The x coordinate, from 0 to 127.
57  * @param y The y coordinate, from 0 to 127.
58  * @return The color. See {@link MapPalette}.
59  */
60  public byte getBasePixel(int x, int y);
61 
62  /**
63  * Draw an image to the map. The image will be clipped if necessary.
64  *
65  * @param x The x coordinate of the image.
66  * @param y The y coordinate of the image.
67  * @param image The Image to draw.
68  */
69  public void drawImage(int x, int y, Image image);
70 
71  /**
72  * Render text to the map using fancy formatting. Newline (\n) characters
73  * will move down one line and return to the original column, and the text
74  * color can be changed using sequences such as "ยง12;", replacing 12 with
75  * the palette index of the color (see {@link MapPalette}).
76  *
77  * @param x The column to start rendering on.
78  * @param y The row to start rendering on.
79  * @param font The font to use.
80  * @param text The formatted text to render.
81  */
82  public void drawText(int x, int y, MapFont font, String text);
83 
84 }
void setCursors(MapCursorCollection cursors)
MapCursorCollection getCursors()
byte getBasePixel(int x, int y)
void drawImage(int x, int y, Image image)
byte getPixel(int x, int y)
void setPixel(int x, int y, byte color)
void drawText(int x, int y, MapFont font, String text)