nanogui: Thread: transparancy


[<<] [<] Page 1 of 1 [>] [>>]
Subject: transparancy
From: Nikolaj Berntsen ####@####.####
Date: 28 Jun 2001 06:41:47 -0000
Message-Id: <510819110362D211ABFD00A0C9A2BE4A016107FB@mail.visionik.dk>

Dear <you know what to write here>!

For the slide show programme we are developing for the STB using nano-X we
have to deal with transparancy.

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.

We would like to hear if anybody has oppinions on  how to do this in the
smartest technical way.

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?


Happy Computing
K. Nikolaj Berntsen  Technical Consultant
--------------------------------------------------------------
AGENCY.COM Interactive TV

Islands Brygge 57, DK-2300 Copenhagen S
T: +45 3693 6000  F: +45 3693 6001  
Direct: +45 3693 6120  
E: ####@####.####  www.agency.com 
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
Subject: Re: [nanogui] transparancy
From: Alex Holden ####@####.####
Date: 28 Jun 2001 14:44:52 -0000
Message-Id: <Pine.LNX.4.10.10106281541480.16543-100000@linuxhacker>

On Thu, 28 Jun 2001, Jordan Crouse wrote:
> Oops...  I don't know if we can handle transparentices in JPEGS.  Can anyone 
> comment on that?  

http://www.faqs.org/faqs/jpeg-faq/part1/section-12.html

> Each window is given a solid background color.

Or an image if you've set one with GrSetBackgroundPixmap().

-- 
------- Alex Holden -------
http://www.linuxhacker.org/
 http://www.robogeeks.org/

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

On Thursday 28 June 2001 08:44, Alex Holden mentioned:
> On Thu, 28 Jun 2001, Jordan Crouse wrote:
> > Oops...  I don't know if we can handle transparentices in JPEGS.  Can
> > anyone comment on that?
>
> http://www.faqs.org/faqs/jpeg-faq/part1/section-12.html

Doh!  I made the idiot mistake of assuming that since most of the popular 
formats have transparency, then so does JPEG.  That was not bright of me.

> > Each window is given a solid background color.
>
> Or an image if you've set one with GrSetBackgroundPixmap().

This is true.  But thats an image that you specified, and *NOT* necessarily 
the contents of a lower window.

Jordan
[<<] [<] Page 1 of 1 [>] [>>]


Powered by ezmlm-browse 0.20.