Ejemplo n.º 1
0
  public void generarFondo(Component componente) {
    boolean dibujarFondo = false;
    Rectangle med = this.getBounds();
    Rectangle areaDibujo = this.getBounds();
    BufferedImage tmp;
    GraphicsConfiguration gc =
        GraphicsEnvironment.getLocalGraphicsEnvironment()
            .getDefaultScreenDevice()
            .getDefaultConfiguration();

    if (Principal.fondoBlur) {
      dibujarFondo = true;
    }
    if (dibujarFondo) {
      JRootPane root = SwingUtilities.getRootPane(this);
      blurBuffer = GraphicsUtilities.createCompatibleImage(Principal.sysAncho, Principal.sysAlto);
      Graphics2D g2 = blurBuffer.createGraphics();
      g2.setClip(med);
      blurBuffer = blurBuffer.getSubimage(med.x, med.y, med.width, med.height);
      ((Escritorio) Principal.getEscritorio()).getFrameEscritorio().paint(g2);
      g2.dispose();
      backBuffer = blurBuffer;
      // blurBuffer = toGrayScale(blurBuffer);
      blurBuffer = GraphicsUtilities.createThumbnailFast(blurBuffer, getWidth() / 2);
      blurBuffer = new GaussianBlurFilter(4).filter(blurBuffer, null);
      g2 = (Graphics2D) blurBuffer.getGraphics();
      g2.setColor(new Color(0, 0, 0, 195));
      g2.fillRect(0, 0, Principal.sysAncho, Principal.sysAlto);
      listo = true;
    }
  }
Ejemplo n.º 2
0
  public void paintComponent(Graphics g) {

    if (Principal.fondoBlur) {
      if (isVisible() && blurBuffer != null && listo) {
        Graphics2D g2 = (Graphics2D) g.create();
        g2.setRenderingHint(
            RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
        g2.drawImage(backBuffer, 0, 0, null);
        g2.setComposite(AlphaComposite.SrcOver.derive(alpha));
        g2.drawImage(blurBuffer, 0, 0, getWidth(), getHeight(), null);
        g2.dispose();
      }
    }
  }
Ejemplo n.º 3
0
  public void paintComponent(Graphics g) {

    if (!Principal.fondoBlur) {
      if (isVisible() && blurBuffer != null) {
        Graphics2D g2 = (Graphics2D) g.create();
        g2.setRenderingHint(
            RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
        g2.drawImage(backBuffer, 0, 0, null);
        g2.setComposite(AlphaComposite.SrcOver.derive(alpha));
        g2.drawImage(blurBuffer, 0, 0, getWidth(), getHeight(), null);
        g2.setColor(new Color(55, 55, 255, 150));
        g2.fillRect(0, 0, getBounds().width, getBounds().height);
        g2.dispose();
      }
    } else {
      Graphics2D g2d = (Graphics2D) g;
      g2d.drawImage(fondo, 0, 0, null);
    }
  }