nanogui: Alpha blending problem


Previous by date: 25 Oct 2006 00:03:36 +0100 Using flnx with nano-X for framebuffer support without mouse, pratish ganguly
Next by date: 25 Oct 2006 00:03:36 +0100 Re: Alpha blending problem, Greg Haerr
Previous in thread: 25 Oct 2006 00:03:36 +0100 Re: Alpha blending problem, kajdas.att.net
Next in thread: 25 Oct 2006 00:03:36 +0100 Re: Alpha blending problem, Greg Haerr

Subject: RE: Alpha blending problem
From: "Martin Kajdas" ####@####.####
Date: 25 Oct 2006 00:03:36 +0100
Message-Id: <CF2BB830A62F914F848E5AD5FFF57AC229158B@mkmail.MKPROD.COM>

I fixed (hacked) this problem (in nxlib-0.45) and this is what I have
found.
This is really a XGetImage and XPutImage problem in nxlib.

The FLTK blending does XGetImage() to read the background, which calls
GrReadArea (nxlib) in microwindows and the image returned is in the
wrong format.
XGetImage expects 4 byte format and the GrReadArea returns hardware
format, in my case 5:6:5 RGB (2 bytes per pixel).
There should be 2 unused bytes between every 2 data bytes.
For 5:6:5 RGB, it should be:
0000:RGB 0000:RGB ...
but is:
RGB:RGB RGB:RGB ...

This causes the data to be only half the size of the array and the
background is valid for the top half of the image and black for the
bottom.

I added a loop that spreads the array data in XGetImage() after the call
to GrReadArea and then it works.
This makes me believe that the XGetImage function does not work for
<=16bit resolutions.

The question are: 
Is there a conversion routine that does this?
Where the conversion should be done? (in XGetImage?)


The second problem is with XPutImage function in nxlib-0.45.
It does not draw pixels when foreground and background are zero (black).
This problem is similar to XDrawString which would not draw for the same
condition.
I already reported and fixed this problem.
This would be OK if the background was already black but in my case it
is not and the black pixels are simply not drawn (transparent).
I fixed it by changing the background color for this case but I think
there should be a better way to take care of this problem in XPutImage
and XDrawString.
Any suggestions?

Martin


-----Original Message-----
From: ####@####.#### ####@####.####
Sent: Saturday, October 21, 2006 7:52 AM
To: ####@####.####
Cc: Martin Kajdas
Subject: Re: Alpha blending problem


I have some more information.
The Alpha blending is done by the FLTK and not by the Microwindows.
Then, the FLTK calls the XputImage() to do the drawing with the blended
image.
The only problem with the image is that the blended pixels which should
be black are transparent and possibly other problems that I cannot see.
This appears to be one of those cases where the color conversion from
X11 to Microwindows colors (255 <-> 0) does not work.
I thought this was already fixed but there must be another case.

I believe that the black color is 0, what is the transparent color?
Any other suggestions where to look for this problem?

Martin

Previous by date: 25 Oct 2006 00:03:36 +0100 Using flnx with nano-X for framebuffer support without mouse, pratish ganguly
Next by date: 25 Oct 2006 00:03:36 +0100 Re: Alpha blending problem, Greg Haerr
Previous in thread: 25 Oct 2006 00:03:36 +0100 Re: Alpha blending problem, kajdas.att.net
Next in thread: 25 Oct 2006 00:03:36 +0100 Re: Alpha blending problem, Greg Haerr


Powered by ezmlm-browse 0.20.