|
Replies:
11
-
Last Post:
Aug 15, 2008 3:21 AM
by: Davy Preuveneers
|
Threads:
[
Previous
|
Next
]
|
|
|
|
|
|
Phoneme advanced, personal profile, PNG images
Posted:
Jul 29, 2008 4:57 AM
|
|
|
Hello, list. I am using PNG images in my application but when I read them with the Toolkit and paste them on a Graphics object, the alpha band is not read properly, so the pixels are either transparent or opaque, but not semi-transparent. is this a known bug/issue? Is there a workaround?
I am using Davy's CAB installer (advanced, personal profile, on Windows Mobile 5)
Thanks, Lucas
|
|
|
|
|
|
|
|
|
Re: Phoneme advanced, personal profile, PNG images
Posted:
Aug 11, 2008 5:51 PM
in response to: jldominguez
|
|
|
phonemeadvanced@mobileandembedded.org wrote: > This is more or less what I mean: > > https://correo.prodevelop.es/descarga/mobile/png_alpha.jpg > > Seems like phoneMe's toolkit is reading just one bit of the alpha band, so if the alpha band is >= 128, it's opaque, and if alpha > Cheers > Lucas >
Hi Davy,
Do you happen to know whether Windows Mobile 5.0 (or PocketPC 2003) can support alpha blending (with a bit depth of 128)?
Thanks, Hinkmond
--------------------------------------------------------------------- To unsubscribe, e-mail: advanced-unsubscribe@phoneme.dev.java.net For additional commands, e-mail: advanced-help@phoneme.dev.java.net
|
|
|
|
|
|
|
|
Re: Phoneme advanced, personal profile, PNG images
Posted:
Aug 12, 2008 1:15 AM
in response to: Hinkmond Wong
|
|
|
On Tuesday 12 August 2008, Hinkmond Wong wrote: > phonemeadvanced@mobileandembedded.org wrote: > > This is more or less what I mean: > > > > https://correo.prodevelop.es/descarga/mobile/png_alpha.jpg > > > > Seems like phoneMe's toolkit is reading just one bit of the alpha band, > > so if the alpha band is >= 128, it's opaque, and if alpha > transparent (or viceversa) > > > > Cheers > > Lucas > > Hi Davy, > > Do you happen to know whether Windows Mobile 5.0 (or PocketPC 2003) can > support alpha blending (with a bit depth of 128)?
I am afraid it doesn't. I just tested the following image with the IE browser on WM2003, WM5 and WM6, and the transparency of the image is quite different in my desktop browser.
http://www.w3.org/Graphics/PNG/alphatest.png
Regards, Davy
--------------------------------------------------------------------- To unsubscribe, e-mail: advanced-unsubscribe@phoneme.dev.java.net For additional commands, e-mail: advanced-help@phoneme.dev.java.net
|
|
|
|
|
|
|
|
Re: Phoneme advanced, personal profile, PNG images
Posted:
Aug 12, 2008 5:56 PM
in response to: Davy Preuveneers
|
|
|
Davy Preuveneers wrote: > On Tuesday 12 August 2008, Hinkmond Wong wrote: > > Do you happen to know whether Windows Mobile 5.0 (or PocketPC 2003) can > support alpha blending (with a bit depth of 128)? > > > I am afraid it doesn't. I just tested the following image with the IE browser > on WM2003, WM5 and WM6, and the transparency of the image is quite different > in my desktop browser. > > http://www.w3.org/Graphics/PNG/alphatest.png >
Hi Davy,
Thanks for the confirmation test.
Lucas, sorry but that's not our phoneME causing the issue you are seeing the 1-bit alpha blending on Windows Mobile. That's a native Windows Mobile issue.
Hinkmond
--------------------------------------------------------------------- To unsubscribe, e-mail: advanced-unsubscribe@phoneme.dev.java.net For additional commands, e-mail: advanced-help@phoneme.dev.java.net
|
|
|
|
|
|
|
|
|
|
Re: Phoneme advanced, personal profile, PNG images
Posted:
Aug 14, 2008 1:22 PM
in response to: jldominguez
|
|
|
phonemeadvanced@mobileandembedded.org wrote: > Hi. This is in more detail what I mean: > > http://gvsigmobileonopenmoko.files.wordpress.com/2008/08/message.pdf > > Thanks, > Lucas >
Hi Lucas,
I think you are seeing that the IBM J9 must be doing their alpha blending in buffered image processing in their runtime library instead of using the Windows Mobile native functions to do the alpha blending.
Currently, in phoneME there is no Java side image processing to support alpha blending on Windows Mobile. If you or some other developer on this forum would like to volunteer to work on that, let us know and we can help you get started and take back your contribution for the phoneME project.
It would be a good isolated task to work as to help our open source project and others needing the same functionality.
Thanks,
Hinkmond
--------------------------------------------------------------------- To unsubscribe, e-mail: advanced-unsubscribe@phoneme.dev.java.net For additional commands, e-mail: advanced-help@phoneme.dev.java.net
|
|
|
|
|
|
|
|
Re: Phoneme advanced, personal profile, PNG images
Posted:
Aug 14, 2008 2:31 PM
in response to: Hinkmond Wong
|
|
|
|
|
On Thursday 14 August 2008, Hinkmond Wong wrote: > phonemeadvanced@mobileandembedded.org wrote: > > Hi. This is in more detail what I mean: > > > > http://gvsigmobileonopenmoko.files.wordpress.com/2008/08/message.pdf > > > > Thanks, > > Lucas > > Hi Lucas, > > I think you are seeing that the IBM J9 must be doing their alpha > blending in buffered image processing in their runtime library instead > of using the Windows Mobile native functions to do the alpha blending. > > Currently, in phoneME there is no Java side image processing to support > alpha blending on Windows Mobile. If you or some other developer on > this forum would like to volunteer to work on that, let us know and we > can help you get started and take back your contribution for the phoneME > project. > > It would be a good isolated task to work as to help our open source > project and others needing the same functionality. > > > Thanks, > > Hinkmond
I was just about to reply the same. My previous alpha blending tests were done with IE on the Windows Mobile emulators and on my PDA, and they showed the same kind of errors as those in the pdf. On my PDA, I have another viewer that shows png with alpha channels correctly. So I guess J9 is indeed doing alpha blending on its own.
Moreover, while a pMEA linux build with Qt produces correct results, a pMEA GTK build does not. I haven't looked at the Qt AWT peer implementation to see if there is special code to handle alpha blending, or if Qt handles this all by itself.
Davy
[signature.asc]
|
|
|
|
|
|
|
|
Re: Phoneme advanced, personal profile, PNG images
Posted:
Aug 14, 2008 6:47 PM
in response to: Davy Preuveneers
|
|
|
Just to quickly reply to myself:
While the problem is best solved in the VM itself, you can also do the alpha blending in your application itself.
http://www.cs.kuleuven.ac.be/~davy/phoneme/test/ImageViewer.java
I first draw a background image "back.png" using a standard image drawing method, and then I draw a transparent image "alpha.png" pixel by pixel while blending the alpha channels.
The code is rather slow, and just serves as a proof of concept. If you want to optimize, eliminate the creation of the Color objects and compute the blending directly with the integers. You can also replace the setRGB call
offscreenSurface.setRGB(x + startX, y + startY, newColor.getRGB());
with
blendPixels[y*width + x] = newColor.getRGB();
and then after blending the pixels, you can create an Image object that you draw like the first image:
image = createImage(new MemoryImageSource(width, height, blendPixels, 0, width)); Graphics2D g2d = (Graphics2D)offscreenSurface.getGraphics(); g2d.drawImage(image, 0, 0, null);
Davy
--------------------------------------------------------------------- To unsubscribe, e-mail: advanced-unsubscribe@phoneme.dev.java.net For additional commands, e-mail: advanced-help@phoneme.dev.java.net
|
|
|
|
|
|
|
|
Re: Phoneme advanced, personal profile, PNG images
Posted:
Aug 15, 2008 3:05 AM
in response to: Davy Preuveneers
|
|
|
Hello. The pixel-by-pixel approach is a bit scary in this young JME world :-P
Anyway, I'll try your code. Thanks for the reply.
|
|
|
|
|
|
|
|
Re: Phoneme advanced, personal profile, PNG images
Posted:
Aug 15, 2008 3:21 AM
in response to: jldominguez
|
|
|
On Friday 15 August 2008, phonemeadvanced@mobileandembedded.org wrote: > Hello. The pixel-by-pixel approach is a bit scary in this young JME world > :-P > > Anyway, I'll try your code. Thanks for the reply. > [Message sent by forum member 'jldominguez' (jldominguez)]
I am well aware that this method can be a few hundred times slower 
Windows Mobile 5 provides the AlphaBlend method call, but it appears that not all devices support it. I have read some reports on forums that the Imaging API is rather slow too:
http://msdn.microsoft.com/en-us/library/ms879887.aspx http://msdn.microsoft.com/en-us/library/aa452202.aspx
But it is probably faster than the Java implementation. If the AlphaBlend method does not work, I can only hope that providing a native blending implementation helps.
Davy
--------------------------------------------------------------------- To unsubscribe, e-mail: advanced-unsubscribe@phoneme.dev.java.net For additional commands, e-mail: advanced-help@phoneme.dev.java.net
|
|
|
|
|
|
|