Rectangles algorithm

Cyrille Berger cberger at cberger.net
Fri Jun 8 22:06:05 CEST 2007


Hi,

I took the time to experiment writting an algorithm that would create a set of 
rectangles from an other, but with an heuristic which allows to create 
rectangles which have area not cover by the original list of rectangles.

As you can see bellow:
http://cyrille.diwi.org/tmp/krita/rectangles.optimization.qregion1.png

Red rectangles are the output of the algorithm.
Blue rectangles are the rectangles in the input.

In fact the algorithm uses QRegion at the end to eliminates overlap, maybe a 
faster solution can be used, and there are some room to improve it even a bit 
further.

So compared to QRegion it's 10 times faster, but the drawback is that it 
accept to cover a bigger area, so it slightly increase the cost of 
compositing.

My next step is to see in action in Krita, but that's for next week.

The source code of the test application:
http://cyrille.diwi.org/tmp/krita/Rectangles.tar.bz2
-- 
Cyrille Berger


More information about the kimageshop mailing list