Ejemplo n.º 1
0
  public void paint(Graphics g, int localX, int localY, int width, int height) {
    if (pixmap == null || !this.isEnabled()) return;

    int x = localX + (int) ((double) (width - pixmap.getWidth()) / 2d);
    int y = localY + (int) ((double) (height - pixmap.getHeight()) / 2d);

    if (useAlternateBlending) {
      g.getOpenGL().enableAlternateBlending(true);
      g.setColor(
          new Color(
              modulationColor.getRed() * modulationColor.getAlpha(),
              modulationColor.getGreen() * modulationColor.getAlpha(),
              modulationColor.getBlue() * modulationColor.getAlpha(),
              modulationColor.getAlpha()));
      g.drawImage(pixmap, x, y);
      g.getOpenGL().enableAlternateBlending(false);
    } else {
      g.setColor(modulationColor);
      g.drawImage(pixmap, x, y);
    }
  }