org.bukkit.map
Class MapPalette

java.lang.Object
  extended by org.bukkit.map.MapPalette

public final class MapPalette
extends Object

Represents the palette that map items use.


Field Summary
static byte BLUE
           
static byte BROWN
           
static byte DARK_BROWN
           
static byte DARK_GRAY
           
static byte DARK_GREEN
           
static byte GRAY_1
           
static byte GRAY_2
           
static byte LIGHT_BROWN
           
static byte LIGHT_GRAY
           
static byte LIGHT_GREEN
           
static byte PALE_BLUE
           
static byte RED
           
static byte TRANSPARENT
          The base color ranges.
static byte WHITE
           
 
Method Summary
static Color getColor(byte index)
          Get the value of the given color in the palette.
static byte[] imageToBytes(Image image)
          Convert an Image to a byte[] using the palette.
static byte matchColor(Color color)
          Get the index of the closest matching color in the palette to the given color.
static byte matchColor(int r, int g, int b)
          Get the index of the closest matching color in the palette to the given color.
static BufferedImage resizeImage(Image image)
          Resize an image to 128x128.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TRANSPARENT

public static final byte TRANSPARENT
The base color ranges. Each entry corresponds to four colors of varying shades with values entry to entry + 3.

See Also:
Constant Field Values

LIGHT_GREEN

public static final byte LIGHT_GREEN
See Also:
Constant Field Values

LIGHT_BROWN

public static final byte LIGHT_BROWN
See Also:
Constant Field Values

GRAY_1

public static final byte GRAY_1
See Also:
Constant Field Values

RED

public static final byte RED
See Also:
Constant Field Values

PALE_BLUE

public static final byte PALE_BLUE
See Also:
Constant Field Values

GRAY_2

public static final byte GRAY_2
See Also:
Constant Field Values

DARK_GREEN

public static final byte DARK_GREEN
See Also:
Constant Field Values

WHITE

public static final byte WHITE
See Also:
Constant Field Values

LIGHT_GRAY

public static final byte LIGHT_GRAY
See Also:
Constant Field Values

BROWN

public static final byte BROWN
See Also:
Constant Field Values

DARK_GRAY

public static final byte DARK_GRAY
See Also:
Constant Field Values

BLUE

public static final byte BLUE
See Also:
Constant Field Values

DARK_BROWN

public static final byte DARK_BROWN
See Also:
Constant Field Values
Method Detail

resizeImage

public static BufferedImage resizeImage(Image image)
Resize an image to 128x128.

Parameters:
image - The image to resize.
Returns:
The resized image.

imageToBytes

public static byte[] imageToBytes(Image image)
Convert an Image to a byte[] using the palette.

Parameters:
image - The image to convert.
Returns:
A byte[] containing the pixels of the image.

matchColor

public static byte matchColor(int r,
                              int g,
                              int b)
Get the index of the closest matching color in the palette to the given color.

Parameters:
r - The red component of the color.
b - The blue component of the color.
g - The green component of the color.
Returns:
The index in the palette.

matchColor

public static byte matchColor(Color color)
Get the index of the closest matching color in the palette to the given color.

Parameters:
color - The Color to match.
Returns:
The index in the palette.

getColor

public static Color getColor(byte index)
Get the value of the given color in the palette.

Parameters:
index - The index in the palette.
Returns:
The Color of the palette entry.


Copyright © 2013. All Rights Reserved.