The Source for Java Technology Collaboration

Home » java.net Forums » Phone ME » phoneME Advanced software

Thread: Phoneme advanced, personal profile, PNG images

Welcome, Guest Help
Login Login
Guest Settings Guest Settings
Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 11 - Last Post: Aug 15, 2008 3:21 AM by: Davy Preuveneers Threads: [ Previous | Next ]
jldominguez

Posts: 61
Phoneme advanced, personal profile, PNG images
Posted: Jul 29, 2008 4:57 AM
  Click to reply to this thread Reply

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

jldominguez

Posts: 61
Re: Phoneme advanced, personal profile, PNG images
Posted: Jul 31, 2008 3:12 AM   in response to: jldominguez
  Click to reply to this thread Reply

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

Hinkmond Wong
Re: Phoneme advanced, personal profile, PNG images
Posted: Aug 11, 2008 5:51 PM   in response to: jldominguez
  Click to reply to this thread Reply

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


Davy Preuveneers
Re: Phoneme advanced, personal profile, PNG images
Posted: Aug 12, 2008 1:15 AM   in response to: Hinkmond Wong
  Click to reply to this thread Reply

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


Hinkmond Wong
Re: Phoneme advanced, personal profile, PNG images
Posted: Aug 12, 2008 5:56 PM   in response to: Davy Preuveneers
  Click to reply to this thread Reply

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


jldominguez

Posts: 61
Re: Phoneme advanced, personal profile, PNG images
Posted: Aug 14, 2008 12:38 PM   in response to: Hinkmond Wong
  Click to reply to this thread Reply

Hi. This is in more detail what I mean:

http://gvsigmobileonopenmoko.files.wordpress.com/2008/08/message.pdf

Thanks,
Lucas

Hinkmond Wong
Re: Phoneme advanced, personal profile, PNG images
Posted: Aug 14, 2008 1:22 PM   in response to: jldominguez
  Click to reply to this thread Reply

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


Davy Preuveneers
Re: Phoneme advanced, personal profile, PNG images
Posted: Aug 14, 2008 2:31 PM   in response to: Hinkmond Wong
  Click to reply to this thread Reply

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]


Davy Preuveneers
Re: Phoneme advanced, personal profile, PNG images
Posted: Aug 14, 2008 6:47 PM   in response to: Davy Preuveneers
  Click to reply to this thread Reply

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


jldominguez

Posts: 61
Re: Phoneme advanced, personal profile, PNG images
Posted: Aug 15, 2008 3:05 AM   in response to: Davy Preuveneers
  Click to reply to this thread Reply

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.

Davy Preuveneers
Re: Phoneme advanced, personal profile, PNG images
Posted: Aug 15, 2008 3:21 AM   in response to: jldominguez
  Click to reply to this thread Reply

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


jldominguez

Posts: 61
Re: Phoneme advanced, personal profile, PNG images
Posted: Jul 31, 2008 3:13 AM   in response to: jldominguez
  Click to reply to this thread Reply

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




 XML java.net RSS