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. https://docs.oracle.com/javase/8/docs/api/java/awt/Window.html#setShape-java.awt.Shape-

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.