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