コード例 #1
0
ファイル: BasePaletteMapper.java プロジェクト: eswartz/emul
 /* (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);
 }
コード例 #2
0
ファイル: BasePaletteMapper.java プロジェクト: eswartz/emul
  /**
   * 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;
  }