Tuesday, 12 June 2007

Dropshadows with filters

Today I had my last exam this semester. Well, sort of. Actually this semester ended already in the beginning of May and this was just a chance to retake exams. Anyhow, the test was on Design of Algorithms. In itself, this is really an interesting area of computing science and I'm planning to do my master's studies in the algorithms sub-programme. For this course then, I'm getting a bit frustrated with it. In the first exam I had no idea, how to do operations on binomial heaps, and since that would have given one third of the points, it didn't go well. For this exam then, a quarter of points would have come from remembering an approximate solution to traveling salesman problem, giving at most double the length of ideal solution in polynomial time, and how to prove it won't give longer answers than that. I didn't remember that solution, so this time it won't go too well either. (and I didn't quite have the time to build the solution from scratch... ;)

In coding Inkscape, I had a lot more success. Today I committed code that allows for using SourceAlpha and BackgroundAlpha as input images in filter effects rendering. These are the image of filtered object and its background, but with all colour information stripped out.

I really have no idea, what I could do with BackgroundAlpha, but SourceAlpha at least gives me nice dropshadows. This star here, for example (can you tell, I like using stars as example material?-). It is just a green star, with a filter that takes the BackgroundAlpha image, offsets it by 10 units in both x and y directions, blurs the result and finally blends that image with the original green star.

There are still some oddities with that offset filter. I tried this first without blur, and it resulted in white gaps in the whole shape, which was a known bug for the offset filter. Not good. For my amazement, everything went just fine, when I added the blur. No banding, no spurious messages about trying to reserve almost 16 EiB of memory. I really need to take a better look into what's wrong with that feOffset renderer.

2 comments:

Gail said...

Hmm, approximate traveling salesman - we covered that in our fourth year algorithms class, so I feel your pain :) Hope the retake went ok...?

Niko Kiirala said...

gail: Well, this is something like third or fourth year course. A voluntary one, too, unless one is aiming to get the master's degree on algorithms sub-programme.

The retake didn't go too well, but at least it seems, that I'm passing the course this time. :P

Also, this kind of answering kind of bugs the hell out of me, as I'm used to instant messaging, e-mails, irc-galleria... where you send your response directly to the recipient.