Posted by liquid
on July 9, 2009 at 2:57 AM PDT
Hey guys, i just posted something that might be of interest to JXLayer users :)
It's a (really small) AbstractLayerEffect implementation that uses Decora (that effects library powering javafx) to add hardware accelerated effects (where the graphics card, system, drivers, etc allow it of course, otherwise it's java or C+JNI - in my experience it's more often the case than not) to Swing thanks to JXLayer.
It's used just like the other BufferedImageOp based filter effects, where for example you used jerry huxtable's filters in a BufferedImageOpEffect, in a BufferedLayerUI with setLayerEffects. Here, you still call setLayerEffects but wrap your decora effects in my DecoraLayerEffect class, and you should be good to go.
The source and demos are available here, http://lqd.hybird.org/journal/?p=165
I don't have that much experience with JXLayer, so let me know if there's a problem with it, or if it doesn't somehow fit with the regular usage patterns, etc.
Alexander, i found the perf to be sufficient in those tests/demos, however there's obviously a lot of image data being moved left and right, with your knowledge of swing, and obviously jxlayer, do you think there's a way we could get more performance out of this.
As i see it, grossly oversimplified, swing paints into java2d images backed by opengl/d3d textures on recent machines, which are read into bufferedimages by jxlayer, then passed to the filters, decora in my case, which uploads them to opengl/direct3d textures again, and then all the way back after processing them. Decora uses java2d's RSL and i'm wondering if you think we could shorten this chain in any way, possibly by using that ?