Per-pixel translucency support in Bionicpup64

Moderator: Forum moderators

Post Reply
User avatar
Phoenix
Posts: 341
Joined: Fri Feb 12, 2021 2:03 am
Location: Canada
Has thanked: 4 times
Been thanked: 48 times

Per-pixel translucency support in Bionicpup64

Post by Phoenix »

I am looking to have per-pixel translucency support, but I'm uncertain as to which software I have to replace or change. The desktop environment (nonexistent I suppose), the WM, the compositor?
This is on bionicpup64, 8.0 with the standard graphical desktop.
I have already tried xfce which didn't work.
The code below checks whether per-pixel translucency is supported or not.

Code: Select all

// PPTDemo.java
import java.awt.Color;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class PPTDemo extends JFrame
{
   public PPTDemo ()
   {
      super ("Per-Pixel Translucency Demo");
      JPanel gradPanel = new JPanel ()
                         {
                             // Transparent red
                             Color colorA = new Color (255, 0, 0, 0);
                             // Solid red
                             Color colorB = new Color (255, 0, 0, 255);
                             protected void paintComponent (Graphics g)
                             {
                                 Graphics2D g2d = (Graphics2D) g;
                                 GradientPaint gp;
                                 gp = new GradientPaint (0.0f, 0.0f, colorA,
                                                         0.0f, getHeight (),
                                                         colorB, true);
                                 g2d.setPaint (gp);
                                 g2d.fillRect (0, 0, getWidth (),
                                               getHeight ());
                                 
                             }
                         };
      gradPanel.setPreferredSize (new Dimension (300, 200));
      gradPanel.setLayout (new BoxLayout (gradPanel, BoxLayout.Y_AXIS));
      JButton btnClose = new JButton ("Close");
      ActionListener al;
      al = new ActionListener ()
           {
               public void actionPerformed (ActionEvent ae)
               {
                  System.exit (0);
               }
           };
      btnClose.addActionListener (al);
      btnClose.setAlignmentX (0.5f);
      gradPanel.add (Box.createVerticalGlue ());
      gradPanel.add (btnClose);
      gradPanel.add (Box.createVerticalGlue ());
      setContentPane (gradPanel);
      if (!getGraphicsConfiguration ().isTranslucencyCapable ())
      {
          System.err.println ("per-pixel translucency not in effect for "+
                              "this graphics configuration");
          System.exit (0);
      }
      setBackground (new Color (0, 0, 0, 0)); // Achieve per-pixel
                                              // translucency.
      pack ();
      setLocationRelativeTo (null);
      setVisible (true);
   }
   public static void main (String [] args)
   {
      Runnable r;
      r = new Runnable ()
          {
              public void run ()
              {
                 GraphicsEnvironment ge;
                 ge = GraphicsEnvironment.getLocalGraphicsEnvironment ();
                 if (!ge.getDefaultScreenDevice ().
                         isWindowTranslucencySupported
                           (GraphicsDevice.WindowTranslucency.
                                           PERPIXEL_TRANSLUCENT))
                 {
                     System.err.println ("per-pixel translucency isn't "+
                                         "supported");
                     return;
                 }
                 new PPTDemo ();
              }
          };
      EventQueue.invokeLater (r);
   }
}

Note: I did make a post on this and later deleted, but realized there wasn't anywhere else where this would fit.. so yeah.

IRC: firepup | Time to hack Puppy!

User avatar
rockedge
Site Admin
Posts: 6378
Joined: Mon Dec 02, 2019 1:38 am
Location: Connecticut,U.S.A.
Has thanked: 2579 times
Been thanked: 2534 times
Contact:

Re: Per-Pixel translucency support

Post by rockedge »

doesn't this require Java support?

Post Reply

Return to “Bionic”