nanogui: transparancy


Previous by date: 28 Jun 2001 14:38:59 -0000 Re: use windows id's for buttons?, Jordan Crouse
Next by date: 28 Jun 2001 14:38:59 -0000 Re: return code of keystroke, Jordan Crouse
Previous in thread: 28 Jun 2001 14:38:59 -0000 transparancy, Nikolaj Berntsen
Next in thread: 28 Jun 2001 14:38:59 -0000 Re: transparancy, Alex Holden

Subject: Re: [nanogui] transparancy
From: Jordan Crouse ####@####.####
Date: 28 Jun 2001 14:38:59 -0000
Message-Id: <01062808401301.20533@cosmic>

> We would like to compose an image by drawing a background and a number of
> items like buttons or other objects on top. The buttons will have odd
> shapes and the image of the button could contain a color that should be
> handled as transparent to the background. All images are JPEGS.

Oops...  I don't know if we can handle transparentices in JPEGS.  Can anyone 
comment on that?  

 > A special problem occurs when these windows are handled in a windows
> situation with expose events causing a redraw - here the transparent part
> of the button may need to have the background redrawn - but this does not
> happen by itself - any solutions to this? We could handle it by GrUnMap'ing
> and GrMap'ing the window with the transparent button (presumeably), but is
> it the fastest / most elegant way?

So what you are saying is that you want a image with a transparent hole in a 
window that is above another window with a background image?    In 
Microwindows, you can't have a "transparent" window.  Each window is given a 
solid background color.  On an exposure or redraw, the whole rectangle is 
drawn with the background color, and then the user code draws the contents on 
top of it.  There is no way to position a regular window over another window 
and see the contents filter through.  

This is because Microwindows was not developed with the concept of a z-order 
so it is virtually impossible to determine how the contents of the underlying 
windows should be displayed.  Greg and I have discussed this several times, 
and we agree this is a daunting task.

There are several somewhat sneaky ways around this:

1.  Draw the image or item directly on the background window, and then place 
an GrInputWindow above it to easily get the events that you need. The 
disadvantage here is that you need to calculate the position of the icon 
relative to the other window, which can be annoying.

2.  Every time you need to redraw the window, copy the contents of the 
background into your window, and draw the image above it.  This has obvious 
speed issues.

3.  Hit the code and see if you can find an elegant way to give us 
transparent windows without a whole ton of pain and suffering.

Good luck!
Jordan

Previous by date: 28 Jun 2001 14:38:59 -0000 Re: use windows id's for buttons?, Jordan Crouse
Next by date: 28 Jun 2001 14:38:59 -0000 Re: return code of keystroke, Jordan Crouse
Previous in thread: 28 Jun 2001 14:38:59 -0000 transparancy, Nikolaj Berntsen
Next in thread: 28 Jun 2001 14:38:59 -0000 Re: transparancy, Alex Holden


Powered by ezmlm-browse 0.20.