Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Setting ImageData alpha behaves strange on Mac(Transparent images on Canvas, Mac OS X)
icon5.gif  Setting ImageData alpha behaves strange on Mac [message #661620] Fri, 25 March 2011 15:22 Go to next message
Albert Pikus is currently offline Albert PikusFriend
Messages: 70
Registered: October 2009
Member
Hi,

I have a question regarding transparent images. I have a Canvas, to which I set a semi-transparent image (ImageData.alpha = 127). Then, on top of this Canvas, I have another Canvas, to which I'm also setting semi-transparent image, appearing on the top of the first image. So the background of underlying image blends perfectly with background of the top image.

On Windows and GTK, this works perfectly, but on Mac, top image doesn't appear semi-transparent, it's darker than it should be.

Is there anything generally wrong with this approach (setting transparent image to Canvas which is on top of another Canvas, also holding transparent image)? Or am I perhaps seeing some bug in Cocoa?


Any hint or advice is appreciated, best regards,

Albert

[Updated on: Fri, 25 March 2011 15:28]

Report message to a moderator

Re: Setting ImageData alpha behaves strange on Mac [message #661990 is a reply to message #661620] Mon, 28 March 2011 18:47 Go to previous messageGo to next message
Lakshmi ShanmugamFriend
Messages: 276
Registered: July 2009
Location: India
Senior Member
Hi,

Are you using PNG images? If so, may be you are seeing this bug --> https://bugs.eclipse.org/bugs/show_bug.cgi?id=272592
(The bug has patch, you can try it out to see if it fixes the problem in your case)


Lakshmi P Shanmugam

[Updated on: Mon, 28 March 2011 18:47]

Report message to a moderator

Re: Setting ImageData alpha behaves strange on Mac [message #662842 is a reply to message #661990] Fri, 01 April 2011 08:16 Go to previous message
Albert Pikus is currently offline Albert PikusFriend
Messages: 70
Registered: October 2009
Member
Hi, Lakshmi,

thank you for your help. I'll try the patch provided.

I have another question that puzzles me, also related with image transparency.

I have a PNG image drawn on Canvas. This image already has transparency set, so some parts of it (corners) are completely transparent. When I draw this image onto Canvas, those parts remain transparent as they should.

But when I set alpha transparency to image before drawing it on Canvas, originally transparent areas of image become nontransparent. This is a bit hard to describe, so I'm attaching two screenshots:

Original PNG image has transparent corner, alpha is not set using SWT:

http://postimage.org/image/2aea6kemc/

Same image with alpha transparency set to 127, using SWT, before it's drawn to Canvas:

http://postimage.org/image/2aegspslg/

I wonder why this is happening. I looked at article on painting with SWT ( http://www.eclipse.org/articles/Article-SWT-images/graphics- resources.html), but I don't seem to find a solution to my problem. I'm sure that this is somehow my fault, since I'm not experienced with painting using SWT. Do you perhaps know what I'm missing here?

Best regards,

Albert

[Updated on: Fri, 01 April 2011 08:17]

Report message to a moderator

Previous Topic:[SOLVED] Unwanted canvas redrawing when maximizing/minimizing/restoring shell
Next Topic:Display#getSystemTaskbar() returns null on WinXP
Goto Forum:
  


Current Time: Fri Apr 10 10:34:26 GMT 2020

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

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

Back to the top