[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[platform-swt-dev] Re: Images
|
SWT is definitely lacking in this arena. Starting from the Swing API,
last year I played with alpha composition. since then I extended it to
include custom composition rules. the alpha comp is implemented both in
software and using the native platform capabilities (most modern OS
support porter-duff) on cocoa. I have had to extend GC to make it work.
I think it is the while Image/ImageData that could be looked into...
that code seems to have evolved very little since... and even before that.
I certainly don't mean that the code is bad, it is actually remarkably
powerful and compact. It is just that it would be interesting to support
native ARGB/RGBA without the extra duplication of the alpha channel in
its own buffer. In the process, it might be time for a RGBA extension of
RGB. I think there is a plenty of time before the next release to talk
about that!??
Ed Kohlwey wrote:
Hi,
I have what I would think is a usual enough problem that I was hoping
someone could help me out with it.
I'm porting a UI component from AWT/Swing to SWT . It is a canvas that
has selectable objects. The object's selection must match exactly what
is rendered on the canvas. To do this in AWT/Swing, we created a custom
composite function and rendered the alpha channel of everything as a
unique color to a background buffer. Selection is accomplished by simply
seeing what unique color the mouse was over, and then retrieving the
associated object from a map.
This doesn't seem to be readily doable in SWT. You can create a wrapper
for a GC, make it ignore changes to color, and instead use a picking
color when drawing objects. You run into problems, however, when you
start rendering images because the images don't render the same way
shapes do. I've tried a number of approaches, all of which are
unsatisfactory because of the expense in instantiating Image objects.
Does anyone have an idea of how/if someone has done this in SWT? It
seems like there might be an inherent limitation in the platform that
would be worth taking a look at from a design perspective...
--
Laurent Mihalkovic, co-author SWT/JFace in Action (www.manning.com/scarpino)