[java] Drawing without 'container' like a Frame

Started by
5 comments, last by egwenejs 18 years, 9 months ago
Hello guys ^_^ Here is my problem : I want to draw on my screen, in half transparency, an image A. I said 'on the screen' cause I do not want to draw it in a some kind of window (Frame or other)! The goal is simply to have a webcam images flow rendered anytime on my screen, and in half transparency so that I can still do something else -like reading posts frlom GameDev! Hope you can help!
Advertisement
Hoo,

I think this can be done, since I can get the main GraphicsDevice (the parent, i.e. my 'screen') with :

GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice graph_device= ge.getDefaultScreenDevice();

Now the problem is how do I draw on it... ?
With the default Java libraries it can't be done, you MUST have a window of some type to draw on, Java does not allow access to the screen itself.

There may be a 3rd party library, however. Who knows what some diligent, unemployed soul has created to satiate his or her taste for tinkering.

[Formerly "capn_midnight". See some of my projects. Find me on twitter tumblr G+ Github.]

Quote:
With the default Java libraries it can't be done, you MUST have a window of some type to draw on, Java does not allow access to the screen itself.

Yes but a window can be borderless (and backgroundless if I remember well). If you size it up to screen size you're on your way. If I remember well I did this with the AWT Window class.

Greetz,

Illco
I'll have a look at this!

However, I'm afraid that, since it's still a Window, it must have the focus. And that would cause trouble, since I'd like to be able to do anything (like chatting, programmin, or whatever) with this still visible ABOVE anything else.

I'll have a look at OGL. I know it's not meant not hit the Framebuffer, but I'll try to find something anyway.

Oh, again. I have found some Java VNC server/client, so there must be a way to acces the framebuffer...
Windows and Frames in Java cannot have transparent backgrounds. Like capn_midnight says, you would have to find a 3rd party library or figure out how to do it with JNI.
"None of us learn in a vacuum; we all stand on the shoulders of giants such as Wirth and Knuth and thousands of others. Lend your shoulders to building the future!" - Michael Abrash[JavaGaming.org][The Java Tutorial][Slick][LWJGL][LWJGL Tutorials for NeHe][LWJGL Wiki][jMonkey Engine]
Instead of drawing straight on the screen - just have a frameless window, grab what's under it and render that to your window and alpha blend the webcam image on top. Seems do-able to me. Also by manipulating a couple flags on window creation you can make your window always on top. Well, good luck and stuff

This topic is closed to new replies.

Advertisement