Esempio n. 1
0
 /* (non-Javadoc)
  * @see org.ejs.gui.images.IPaletteMapper#getPixelForGreyscaleMode(int)
  */
 @Override
 public int getPixelForGreyscaleMode(int pixel) {
   byte[] rgb = {0, 0, 0};
   ColorMapUtils.pixelToRGB(pixel, rgb);
   rgb = getRgbToGreyForGreyscaleMode(rgb);
   return ColorMapUtils.rgb8ToPixel(rgb);
 }
Esempio n. 2
0
  /**
   * Get RGB pixel for each palette entry. The pixels are calculated lazily in case the palette
   * changes (this is called only after the mapping is complete).
   *
   * @return
   */
  protected int[] getPalettePixels() {
    if (palettePixels == null) {

      palettePixels = new int[numColors];

      for (int x = 0; x < numColors; x++) {
        byte[] nrgb = palette[x];
        if (isColorMappedGreyscale) nrgb = getRgbToGreyForGreyscaleMode(nrgb);
        palettePixels[x] = ColorMapUtils.rgb8ToPixel(nrgb);
      }
    }
    return palettePixels;
  }