Getting the region from a paint device

Bart Coppens kde at bartcoppens.be
Sun Jan 7 11:05:27 CET 2007


On Sunday 07 January 2007 10:44, Boudewijn Rempt wrote:
> I believe that we don't create tiles for places in a paint device where we
> haven't actually iterated with a non-const iterator; those areas are linked
> to the default tile -- is that correct?
That is correct.

> If so, how hard would be to add a QRegion KisPaintDevice::region() method
> that will give the QRegion of all non-default tiles?
Well, it's possible, and probably easy, too. But probably not very fast, since 
we use a (homegrown) hashtable, we'd have to iterate over each bucket, and 
then iterate over each chain. Probably not too much of an issue, but still.

Also don't forget that we sometimes do tricks with the default tile, so that 
you might get the technically correct QRegion, but doing stuff with it might 
result in a different result than expected (like the inverted selection).

Bart


More information about the kimageshop mailing list