Search code examples
javaswtalphablendingdraw2d

SWT draw2d alpha blending


I'm looking for some method to draw half transparent figures within the draw2d framework. Currently I'm using setAlpha() of org.eclipse.draw2d.Graphics. The problem is that it slows down the whole UI, if I draw more than one half transparent figure.

Here was another question regarding the perfomance of it [1]. It targets SWT on Linux, I target both Linux and Windows. The windows (Win7) system has a 3D capable graphic card and a i7 q720. The Linux machine is even better equipped and has also 3D, so I think it's not a performance issue of the platform.

My question is: Is there a performant way to achieve alpha blending in draw2d?

I've tried to use OpenGL respectivly LWJGL. Since draw2d and OpenGL can't be mixed up and I must rely on draw2d, I thought I could do something like this: draw2d -> OpenGL -> draw2d here where canvas is the Canvas where the OpenGL drawing happens and c1 is the Canvas where I want to get the drawn OpenGL picture. But my attempt to copy the OpenGL drawings doesn't work it gets me just the underlying Canvas (canvas) background. Besides this I'm not sure if this would improve the "perormance" anyway...

Thanks,
atx


Solution

  • This issue is known but unsolved. On the mailing list of draw2d there is a thread regarding this issue: mailing list

    TL;DR: A possible solution was dropped because of license issues between LWJGL and Eclipse.