QRegion

Boudewijn Rempt boud at valdyas.org
Wed Jun 6 10:27:34 CEST 2007


On Monday 04 June 2007, Boudewijn Rempt wrote:

> It uses internally some X11 stuff that's meant for optimizing screen
> updates. Yes, having a class that collects rects, computes the smallest set
> of the biggests possible rects is an interesting problem.

I did think a bit on a KisRegion class and I fairly sure that I cannot make it 
work. 

My first though was to have an internal vector of QRects and juggle the rects 
whenever a new rect was added so they didn't overlap -- or only juggle the 
rects as soon as a rect or a vector of rects were extracted. I couldn't get 
that working, though -- one problem is that it degrades to pixels at some 
point. Another is that it's pretty hard to model for someone with little or 
no maths experience. I can do the situation where a new rect only overlaps 
with a single existing rect, but beyond that it becomes a mess of recursive 
splitting of rects. Maybe a real maths wizard can come up with something 
better than QRegion...

My second thought was to create a bitmap representing 64x64 rects and flip the 
bits that are covered with rects in the region (because we don't necessarily 
need the smallest possible rects covered by the region, just an approximation 
that's fast and doesn't degrade to scanlines), but then I realized that we 
already have something like this, and it's called the tile system -- and we 
cannot use the tile system because layers can be moved which mean the tile 
boundaries don't align anymore, which means that in a complex layer stack 
soon we'll have  problems marking layers as clean during the projection 
phase.

Anyway, we need a way to mark areas of layers dirty and clean them up; 
otherwise we'll always have to recomposite the entire visible area of the 
projection, which may well be the entire image, including applying all effect 
masks and adjustment layers. (And we'll have to recomposite the entire image 
anyway for the histogram computation.) But we lose the QRegion slowness.


-- 
Boudewijn Rempt 
http://www.valdyas.org/fading/index.cgi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/kimageshop/attachments/20070606/57f656f7/attachment.pgp 


More information about the kimageshop mailing list