Interface MapPalette


public interface MapPalette
Map pixels and their colors.

A map pixel is one byte: a MapColor id times four, plus a MapShade. Pixels 0-3 are transparent; the client draws the 244 pixels 4-247 each in a different color.

Since:
0.1.0
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final byte
    The transparent pixel.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    argb(byte pixel)
    Returns the color the client draws a pixel with.
    byte
    closest(int rgb)
    Finds the pixel whose color is the closest to a color, as the eye perceives it.
    byte
    Finds the pixel whose color is the closest to a color, as the eye perceives it.
    color(byte pixel)
    Returns the base color of a pixel, MapColor.NONE when it is transparent.
    boolean
    isTransparent(byte pixel)
    Returns whether the client draws a pixel transparent.
    byte
    pixel(MapColor color)
    Packs a color in its normal shade into a pixel.
    byte
    pixel(MapColor color, MapShade shade)
    Packs a color and a shade into a pixel.
    shade(byte pixel)
    Returns the shade of a pixel.
  • Field Details

    • TRANSPARENT

      static final byte TRANSPARENT
      The transparent pixel. A canvas starts filled with it.
      See Also:
  • Method Details

    • pixel

      byte pixel(MapColor color, MapShade shade)
      Packs a color and a shade into a pixel.
      Parameters:
      color - the color
      shade - the shade
      Returns:
      the pixel, TRANSPARENT when the color is MapColor.NONE
      Since:
      0.1.0
    • pixel

      byte pixel(MapColor color)
      Packs a color in its normal shade into a pixel.
      Parameters:
      color - the color
      Returns:
      the pixel, TRANSPARENT when the color is MapColor.NONE
      Since:
      0.1.0
    • color

      MapColor color(byte pixel)
      Returns the base color of a pixel, MapColor.NONE when it is transparent.
      Parameters:
      pixel - the pixel
      Returns:
      the base color of a pixel, MapColor.NONE when it is transparent
      Since:
      0.1.0
    • shade

      MapShade shade(byte pixel)
      Returns the shade of a pixel.
      Parameters:
      pixel - the pixel
      Returns:
      the shade of a pixel
      Since:
      0.1.0
    • isTransparent

      boolean isTransparent(byte pixel)
      Returns whether the client draws a pixel transparent.
      Parameters:
      pixel - the pixel
      Returns:
      whether the client draws a pixel transparent
      Since:
      0.1.0
    • argb

      int argb(byte pixel)
      Returns the color the client draws a pixel with.
      Parameters:
      pixel - the pixel
      Returns:
      the color as 0xAARRGGBB: opaque, or 0 when the pixel is transparent
      Since:
      0.1.0
    • closest

      byte closest(int rgb)
      Finds the pixel whose color is the closest to a color, as the eye perceives it.
      Parameters:
      rgb - a color as 0xRRGGBB; an alpha channel is ignored
      Returns:
      the closest opaque pixel
      Since:
      0.1.0
    • closest

      byte closest(RGBLike color)
      Finds the pixel whose color is the closest to a color, as the eye perceives it.
      Parameters:
      color - the color; an alpha channel is ignored
      Returns:
      the closest opaque pixel
      Since:
      0.1.0