FLTK logo

Re: [fltk.general] Transparent window

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.general  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: Transparent window Ian MacArthur Jun 14, 2022  
 
On Tuesday, 14 June 2022 at 07:25:59 UTC+1  Håvard  wrote:

I have noticed in test/cube.cxx there is a fl_button with the following color:
Fl::set_color(FL_FREE_COLOR, 255, 255, 0, 75);
That gives a transparent color and works for both fl_button and fl_group (probably many more) as long as they are children of fl_gl_window.

Are there any chance the same would work for fl_window ?

Not really - the key is that the GL render context can support alpha, whereas the stock 2D rendering APIs we use for windows do not. As a result, the button drawn in the GL scene can be translucent, but "the same" button drawn to a standard window will not.

Typically, to get translucent windows you need to have some form of compositing of the desktop as a whole, for example to deal with the background changing underneath your window, even if your window is not being redrawn, that sort of thing.
That was not available in "legacy" window manager systems, but it is fairly common now. (Though still far from universal, and not always cheap to do at runtime either!)

However, how it is used (and the runtime cost of doing so) varies a fair bit between systems, so it is not something that fltk has, at least not yet.
You can get some of that functionality if you are happy to add some platform specific code to your window.
There are tricky issues to this though - as my example shows, it is pretty easy to make a translucent window (where the window *and all its widgets* are translucent); but with the current system it is tricky to have fully-opaque widgets on an otherwise transparent window, or widgets with differing alpha, and that is not an easy thing to work around in the current schemes.


--
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/167fffa8-a31d-4379-869b-079e80e478bbn%40googlegroups.com.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.