Displaying pixels outside of the sketch window

Is this possible in Processing to display a shape or an image outside of the boundaries of the sketch window? Is that something regular Java can do?

Thank you!

1 Like

I’m leaning very much towards “No, that is not possible.”, mainly because it would be a major security concern.

1 Like

It shouldn‘t be possible to Display Pixels outside the Sketch, But you can create a Second „window“ and make the surrounding bounds „invisibile“ and apply the background from your Screen Image to that window as background and create your shape there, But it is very complicated to do and might not really be what you are looking for.

Edit : wasn‘t sure if this is possible, But apparently you can also set the Shape of the window, so you don‘t Need to change the background to what is behind the screen displayed (which might cause some problems). Note that this is very difficult to do, if you don‘t know what you‘re doing and might cause a lot of Problems.

Here‘s some code on how it works :
https://processing.org/discourse/beta/num_1245794206.html

2 Likes

Note that this was added to the official AWT classes since that post - eg. Window (Java Platform SE 8 )

Depending on whether the background is expected to keep updating there is also the “solution” used in the Swing Hacks book and elsewhere of a fullscreen undecorated window filled with a screen capture using Robot (Java Platform SE 8 )

All of this is going to be renderer dependent too. As far as I know it is possible to make a JOGL window transparent, but whether P2D / P3D let you access the required code to do that is another matter!

3 Likes

Thanks! I didn’t know about shaped or translucent windows.