Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Alpha of ImageData not working for RAP(Setting ImageData.alpha has no effect in RAP)
Alpha of ImageData not working for RAP [message #1404771] Tue, 05 August 2014 15:35 Go to next message
John Gymer is currently offline John GymerFriend
Messages: 279
Registered: November 2012
Location: UK
Senior Member
Alpha transparency for SWT ImageData does not appear to be supported by RAP.
In SWT I often used this to create a series of images with different alpha values in order to animate a fade-out or fade-in effect, but this has no effect in RAP (or Tabris in fact), and the image remains at 100% alpha.

My code is something like this:

Image alphaImage = ...;
ImageData alphaImageData = alphaImage.getImageData();
alphaImageData.alpha = desiredAlpha; // 0-255
Image adjustedAlphaImage = new Image(display, alphaImageData);
myLabel.setImage(adjustedAlphaImage);


Is this a known limitation of RAP, or is it a bug?

Thanks, John


---
Just because you can doesn't mean you should
Re: Alpha of ImageData not working for RAP [message #1404931 is a reply to message #1404771] Wed, 06 August 2014 07:14 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2426
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi John,
RAP is using SWT org.eclipse.swt.graphics.ImageLoader#save to make an
image file from image data. Could you try the same code in SWT, but
instead setting the image on the Label directly, save it to a file
(with ImageLoader). Is the output image transparent? See also:
438401: Image created from ImageData does not show up on a label
https://bugs.eclipse.org/bugs/show_bug.cgi?id=438401

Best,
Ivan

--
Ivan Furnadjiev

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Alpha of ImageData not working for RAP [message #1404950 is a reply to message #1404931] Wed, 06 August 2014 08:08 Go to previous message
John Gymer is currently offline John GymerFriend
Messages: 279
Registered: November 2012
Location: UK
Senior Member
That pointed me in the right direction...
PNG images are not saved with the alpha value for the overall image... only the alphaBytes[] array. Therefore, I've changed my logic to set the alphaBytes[] and don't touch alpha at all, and this works perfectly in RAP.
Thanks Ivan!
John


---
Just because you can doesn't mean you should
Previous Topic:RAP 2.3 and eclipse e4 single-sourced RCP (soft migrated)
Next Topic:FileUpload + Feedback
Goto Forum:
  


Current Time: Sat Mar 30 06:57:05 GMT 2024

Powered by FUDForum. Page generated in 0.02075 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top