GraphDisplay with Transparent Background

Forum for software developers to discuss BCI2000 software development
Locked
krleach
Posts: 4
Joined: 26 Dec 2011, 15:40

GraphDisplay with Transparent Background

Post by krleach » 26 Dec 2011, 15:53

Hello,

I am pretty new to developing BCI2000 software and I am working on an application module similar to P3Speller. I would like to set the background of the display window (mrDisplay which is a member of StimulusTask, accessed by the Display() method) to transparent or no background, so that the stimuli will be drawn over whatever is currently displayed on the desktop. I have found ways to set the background to different colors, but no ways to set the background to nothing or transparent. Is this possible, or will I need to create a window of my own to achieve this functionality? I have explored using OpenGL and windows programming to create a window but am having trouble obtaining the correct handles to do so. I'd greatly appreciate any input on this.

jawilson
Posts: 109
Joined: 28 Feb 2005, 16:31

Re: GraphDisplay with Transparent Background

Post by jawilson » 28 Dec 2011, 15:40

This is difficult to accomplish. I was able to make the entire window transparent easily, but I assume you don't want the stimuli to be transparent.

It may be simpler to create a background image, and display the stimuli over that instead of the desktop. This would also allow you to keep track of what images were used in the parameters/data file. Is there a reason this wouldn't work?

Adam

krleach
Posts: 4
Joined: 26 Dec 2011, 15:40

Re: GraphDisplay with Transparent Background

Post by krleach » 28 Dec 2011, 23:35

Thanks for the reply, Adam. I need the user to be able to see what is behind the window (the desktop), because the "target" of this module that the user needs to select is actually an area on the desktop. Because of this, I don't believe that using a background image would work unless I could generate an image of the desktop before each sequence at runtime. I suppose if I could make the window semi transparent that would work too.

What would be ideal is the functionality detailed here http://doc.qt.nokia.com/qq/qq16-background.html, in the second image of the clock where the widget seems to have a fully transparent background with non-transparent objects drawn on to it. I'm just having trouble isolating exactly how to do that in qt, and then applying that to BCI2000's already made classes.

jawilson
Posts: 109
Joined: 28 Feb 2005, 16:31

Re: GraphDisplay with Transparent Background

Post by jawilson » 29 Dec 2011, 09:58

Got it! Make sure you have the most recent version of BCI2000 from SVN for this to work, probably with your changes removed.
This adds an Application parameter called WindowBackgroundTransparency, which you check to make the background transparent. Remember, I wrote this in about an hour, so I can't guarantee that it is bug free, but it seems to work for me.

I cannot seem to add attachments, so here is a dropbox link:
http://dl.dropbox.com/u/13544740/transp ... atch.patch
Let me know when you have the file, so I can delete it.

You can apply the patch by right-clicking the BCI2000/src folder, and select TortoiseSVN->Apply Patch option, then select the attached patch file. (See http://tortoisesvn.net/docs/release/Tor ... patch.html for more info.)

Let me know if this works!
Adam

krleach
Posts: 4
Joined: 26 Dec 2011, 15:40

Re: GraphDisplay with Transparent Background

Post by krleach » 29 Dec 2011, 11:56

Awesome, thanks! I've downloaded the patch, I will try it out this afternoon when I have some time to work. I appreciate the help on this Adam!

krleach
Posts: 4
Joined: 26 Dec 2011, 15:40

Re: GraphDisplay with Transparent Background

Post by krleach » 30 Dec 2011, 13:29

I've just applied the patch, it works perfectly :D. Once again, thank you very much for the help.

jawilson
Posts: 109
Joined: 28 Feb 2005, 16:31

Re: GraphDisplay with Transparent Background

Post by jawilson » 30 Dec 2011, 13:51

Excellent! I may see if we can get this incorporated into the core distribution.
Adam

Locked

Who is online

Users browsing this forum: No registered users and 21 guests