Friday, July 28, 2006

Effects and Qt Jambi

Yesterday for fun I implemented a new blurring method. Blurring is a very common effect that opens quite a lot of possibilities. For example one can use it for shadows and it works very nicely when one is trying to deemphasise something visually. The algorithms that we had for it in KDE were not impressive at all. I went ahead and implemented Mario Klingemann's "Stack Blur" algorithm. I changed his algorithm a bit, mainly added support for handling alpha channel correctly and I was very impressed. It gives really nice results and is blindingly fast.
On a 385px by 385px image i was getting around 200fps with it. This is all software mind you and it should prove that software algorithms are good enough to still do a lot of visually appealing 2D things.

I'm not certain where I'm going to put the algorithm itself though. Qt will get an api for filters but that will happen for 4.3 most likely. I think it would make sense for people to start using this algorithm right now. Like I mentioned a few times I don't like KImageEffects class at all, because it's a mess. So for now I decided to release the algorithm itself as part of a small demo app. Roberto who saw my last demo app where I was using South Park head character asked me to use his character next time. So, first of all the application is available here. And now a few screenshots:
First this is plain Roberto:

Now Roberto blurred:

And finally Roberto with ghost-traces:

It all works incredibly fast so you should be happy with the results.

Gunnar blogged about Qt Jambi and if you have java running I suggest you give it a spin. When I showed some of the demo apps to people on KDE Four Core meeting they were very impressed (rightfully so I might add ;) ). I love the fact that with Qt Jambi I don't have to work with listeners. I just could never get myself to like or even tolerate the syntax for using listeners in Swing. Being able to automatically connect slots by name with QtJavaUtils.connectSlotsByName is just neat.

6 comments:

Anonymous said...

Is the chessboard pattern in the background supposed to be there? The Image has about 9.5x8 slightly darker checks ...

Anonymous said...

Chessboard patterns are used to test the alpha channel. On a white background, differences in alpha channel cannot be seen.

Anonymous said...

this is amasing has an artist the feather efect is ine i wish for all the time, but in vector drwing it's a feature we dont have, and its one of the most usable feature you can implement, xara has it and you can see the degrea of prefection one can achive with xara.
Now hall we nead is an app to take advantage of the great grafical possaibities QT has to ofer.

Anonymous said...

Looks great! Works with Qt4.1 on Windows as well, just had to remove the translucency on the textbox.
But what kind of computer do you have to get 200FPS? I compiled it with benchmarking enabled (but release mode) and got only 39FPS on a Athlon 64 3200+.

Anonymous said...

Looks great here too, but at 10 fps on a AMD 64 3500+ (on 64bit Gentoo)

Anonymous said...

Cool, this blurring algorithm is really fast. And highly portable too, it was a matter of 10 mins to adapt this for Scribus and porting it to Qt 3.