Advanced SWT graphics

July 19, 2008 – 6:05 am

In parallel with my portable Cairo GC project, I have been working on a library to simplify the creation of better looking SWT application. In particular, I got interested in building a customizable widget that would adopt different looks on different platforms and in different parts of an application. This is an example showing the widget as a replacement for the default status eclipse status bar. None of it is the result of using bitmaps, including the small icone on the buttons on the left side.

In the process of adding enhanced graphic effects to the widget, I ran again into SWT’s abysmal lack of support for advanced imaging when compared with Swing. The sum total of the resources available to deal with images in SWT is pretty much the following list. The sad part is that they pretty much all agree that manipulating images with the SWT can be quite time consuming and somewhat out of scope for SWT.

One of the usage for my widget is to replace the default eclipse perspective switcher on platforms where my unified toolbar is not available. The widget will support creating something like this with only a few lines of code.

One of the building blocks needed for that is a decent image effects library. A year ago, Daniel Spiewak tried to take a crack at showing how to create reflection effects on an SWT canvas. Although interesting, the result is nowhere near this, that, and much less that. Mathias Muller posted his own version of something similar, also suffering from some problems.

So starting with Romain’s work as a model…

… I started building my own graphics testing application. The snapshot uses the same bitmap Romain used in his example. The current code does not support variable length shadow, but this is coming next. The application also demos some of the additional capabilities I added to my graphic library. Among other things, it supports most of the compositing modes Romain built in BlendComposite.
These are additional examples running the sample testbed application:
Enter this code

You must be logged in to post a comment.